Originally derived from the tutorial on learn.hashicorp.com, I've updated this example over the years to demonstrate the ways that I work with Terraform (especially in Azure DevOps pipelines).
Read on for instructions on how to use this example.
- Microsoft Azure subscription
- A resource group to deploy this infrastructure into
- Azure CLI
- Terraform 1.0.0 or later
- Create a resource group in your Azure subscription and make a note of the name.
- Example:
rg-getting-started
- Example:
- Clone this repository.
- Login to your Azure subscription using
az login
. - Change directories to
./infrastructure
- Run
terraform init
. - Run
terraform apply -var='resource_group_name=rg-getting-started
.- Note: adjust this command to match the name you used to create the resource group in step 1.
- When prompted by terraform, review the plan and type
yes
to deploy.
- Run
terraform destroy -var='resource_group_name=rg-getting-started
.- Note: adjust this command to match the name you used to create the resource group in step 1.
- When prompted by terraform, review the plan and type
yes
to remove the managed infrastructure.
- Delete the resource group you created for this example.
For a more complete walk-through, including examples of using this demo with remote state and pipelines check out these articles: