This README provides details about the Azure DevOps Terraform pipeline with two stages: Plan and Apply.
This pipeline is designed specifically for Azure DevOps and uses the following stages:
- Terraform Init and Plan: Initialize Terraform and generate an execution plan.
- Terraform Apply: Apply the generated execution plan to create or modify the infrastructure.
- Utilizes Azure DevOps YAML pipelines
- Separates the Terraform planning and applying stages
- Validates the Terraform configuration before planning
- Publishes the Terraform plan as an artifact for later use
- Runs on an Ubuntu-Latest virtual machine image
- Azure DevOps account
- Azure Service Principal for authentication
- Azure Storage Account for storing Terraform remote state
- Terraform configuration files in the repository
- Install the Terraform Microsoft DevLabs Extension from the Azure DevOps Marketplace
This stage initializes Terraform, validates the configuration, generates an execution plan, and publishes it as an artifact. The following tasks are performed:
- Install the latest version of Terraform
- Checkout the repository
- Initialize Terraform with the
-reconfigure
option - Validate the Terraform configuration
- Generate a Terraform plan
- Publish the Terraform plan as an artifact
This stage applies the previously generated Terraform plan to create or modify the infrastructure. The following tasks are performed:
- Install the latest version of Terraform
- Checkout the repository
- Download the Terraform plan artifact
- Initialize Terraform with the
-reconfigure
option - Apply the Terraform plan with the
-auto-approve
and-input=false
options
The pipeline uses the ubuntu-latest
virtual machine image as its build agent. This image provides a Linux-based environment for running the pipeline tasks.