https://github.com/swissgrc/docker-azure-pipelines-terraform
🐳 Docker image for running Terraform commands in an Azure Pipelines container job
https://github.com/swissgrc/docker-azure-pipelines-terraform
azure-cli azure-devops azure-pipelines docker hacktoberfest terraform
Last synced: 3 months ago
JSON representation
🐳 Docker image for running Terraform commands in an Azure Pipelines container job
- Host: GitHub
- URL: https://github.com/swissgrc/docker-azure-pipelines-terraform
- Owner: swissgrc
- License: mit
- Created: 2021-02-09T18:40:44.000Z (over 4 years ago)
- Default Branch: develop
- Last Pushed: 2025-03-14T08:57:25.000Z (4 months ago)
- Last Synced: 2025-03-28T08:11:48.184Z (3 months ago)
- Topics: azure-cli, azure-devops, azure-pipelines, docker, hacktoberfest, terraform
- Language: Dockerfile
- Homepage: https://hub.docker.com/r/swissgrc/azure-pipelines-terraform
- Size: 265 KB
- Stars: 2
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Docker image for running Terraform commands in Azure Pipelines container job
[](https://github.com/swissgrc/docker-azure-pipelines-terraform/blob/main/LICENSE) [](https://github.com/swissgrc/docker-azure-pipelines-terraform/actions/workflows/publish.yml) [](https://sonarcloud.io/summary/new_code?id=swissgrc_docker-azure-pipelines-terraform) [](https://hub.docker.com/r/swissgrc/azure-pipelines-terraform) [](https://hub.docker.com/r/swissgrc/azure-pipelines-terraform)
Docker image to run Terraform commands in [Azure Pipelines container jobs].
## Usage
This image can be used to run Terraform commands in [Azure Pipelines container jobs].
### Azure Pipelines Container Job
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
```yaml
- 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.```yaml
- 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)
```## Included Software
- [swissgrc/azure-pipelines-azurecli:net9](https://github.com/swissgrc/docker-azure-pipelines-azurecli-net9) as base image
- Terraform
- TfLint## Tags
| 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 | |[Azure Pipelines container jobs]: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/container-phases