Docker image to run Terraform commands in Azure Pipelines container jobs.
This image can be used to run Terraform commands in Azure Pipelines container jobs.
To use the image in an Azure Pipelines Container Job, add one of the following example tasks and use it with the container
property.
The following example shows the container used for a deployment step with a Terraform command
- stage: deploy
jobs:
- deployment: planTerraform
container: swissgrc/azure-pipelines-terraform:latest
environment: smarthotel-dev
strategy:
runOnce:
deploy:
steps:
- bash: |
terraform init -backend-config=./config/dev_backend.tfvars
The following example defines a deployment with the container using az login
before calling Terraform commands.
Note that two secret variables (Azure.UserName
and Azure.Password
) are passed to the task by the env block.
- stage: deploy
jobs:
- deployment: planTerraform
container: swissgrc/azure-pipelines-terraform:latest
environment: smarthotel-dev
strategy:
runOnce:
deploy:
steps:
- bash: |
az login -u $AZURE_USERNAME -p $AZURE_PASSWORD
terraform init -backend-config=./config/dev_backend.tfvars
terraform plan -var-file=./config/dev.tfvars
env:
AZURE_USERNAME: $(Azure.UserName)
AZURE_PASSWORD: $(Azure.Password)
- swissgrc/azure-pipelines-azurecli:net9 as base image
- Terraform
- TfLint
Tag | Description | Size |
---|---|---|
latest | Latest stable release (from main branch) |
|
unstable | Latest unstable release (from develop branch) |
|
x.y.z | Image for a specific version of Terraform |