- Module tested for Terraform 1.0.1.
- Azure provider version 3.21.1
main
branch: Provider versions not pinned to keep up with Terraform releasestags
releases: Tags are pinned with versions (use in your releases)
terrafrom init
terraform plan -var='teamid=tryme' -var='prjid=project1'
terraform apply -var='teamid=tryme' -var='prjid=project1'
terraform destroy -var='teamid=tryme' -var='prjid=project1'
Note: With this option please take care of remote state storage
Recommended method (stores remote state in storage using prjid
and teamid
to create directory structure):
- Create python 3.8+ virtual environment
python3 -m venv <venv name>
- Install package:
pip install tfremote --upgrade
- Set below environment variables:
export TF_AZURE_STORAGE_ACCOUNT=tfstatexxxxx # Output of remote_state.sh
export TF_AZURE_CONTAINER=tfstate # Output of remote_state.sh
export ARM_ACCESS_KEY=xxxxxxxxxx # Output of remote_state.sh
-
Updated
examples
directory to required values -
Run and verify the output before deploying:
tf -c=azure plan -var='teamid=foo' -var='prjid=bar'
- Run below to deploy:
tf -c=azure apply -var='teamid=foo' -var='prjid=bar'
- Run below to destroy:
tf -c=azure destroy -var='teamid=foo' -var='prjid=bar'
Note: Read more on tfremote
Terraform supports a number of different methods for authenticating to Azure:
- Authenticating to Azure using the Azure CLI
- Authenticating to Azure using Managed Service Identity
- Authenticating to Azure using a Service Principal and a Client Certificate
- Authenticating to Azure using a Service Principal and a Client Secret
module "resource_group" {
source = "../"
resource_group_settings = [
{
name = "demo1"
location = "westus2"
},
{
name = "demo2"
location = "westus2"
}
]
# ---------------------------------------------
# Note: Do not change teamid and prjid once set.
teamid = var.teamid
prjid = var.prjid
}
Please refer to examples directory link for references.
Name | Version |
---|---|
terraform | >= 1.0.1 |
azurerm | ~> 3.21.1 |
Name | Version |
---|---|
azurerm | ~> 3.21.1 |
No modules.
Name | Type |
---|---|
azurerm_resource_group.resource_group | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
config | Resource group configuration | map(any) |
n/a | yes |
extra_tags | Additional tags to associate | map(string) |
{} |
no |
Name | Description |
---|---|
resource_group | Name of the Resource group |
resource_group_id | Id of the Resource group |