Add the Resource Group
An Azure resource group (docs) is a collection of resources that fundamentally share the same lifecycle in a specific data center region. All resources created in Azure need to live inside a resource group.
Following the Terraform documentation for resource groups, our azurerm_resource_group
resource needs a name
and location
definition. We will use the pre-defined RG-Dojo-Sandbox in the Central US region.
Although Terraform has the capability to dynamically create resource groups, currently requires that these are created through a request-approval process.
Write the Terraform to provision a resource group with the above values for the name and region. Give the resource the label dojo_resource_group
Hint: sample Resource Group answer code
resource "azurerm_resource_group" "dojo_resource_group" {
name = "RG-Dojo-Sandbox"
location = "Central US"
}
This will cause an intentional error!
We introduce an intentional error by using a resource
block for Azure RGs. Teams
do not have permission to provision Resource Groups, they will need to reference
an existing one. Make sure to update with a data
block to deploy resources!
"azurerm_resource_group" "dojo_resource_group" {
name = "RG-Dojo-Sandbox"
}