An Azure resource group is a logical group of related resources. All Azure resources must belong to a resource group.

This page describes how to create a resource group with Terraform.

Create a resource group

  1. Create a new file and enter the following Terraform code:

     resource "azurerm_resource_group" "rg" {
         name     = "azure-web-app-with-terraform-rg"
         location = "westus2"
     }
    
  2. Save this file as main.tf.

    We’ll create the rest of the infrastructure for this tutorial in this file.

We’ll reference this resource group when we create the remaining Azure resources.

Learn more

Updated: