/terraform-getting-started-azure

Getting Started Example from Terraform Docs

Primary LanguageShellMIT LicenseMIT

Getting Started with Terraform and Azure

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.

Requirements

  • Microsoft Azure subscription
  • A resource group to deploy this infrastructure into
  • Azure CLI
  • Terraform 1.0.0 or later

Deployment

  1. Create a resource group in your Azure subscription and make a note of the name.
    • Example: rg-getting-started
  2. Clone this repository.
  3. Login to your Azure subscription using az login.
  4. Change directories to ./infrastructure
  5. Run terraform init.
  6. 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.

Clean Up

  1. 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.
  2. Delete the resource group you created for this example.

Next Steps

For a more complete walk-through, including examples of using this demo with remote state and pipelines check out these articles:

  1. 2021 - Terraform Pipelines with Azure Devops: Getting Started
  2. 2019 - Safe Terraform Pipelines with Azure DevOps