Skip to content
This repository has been archived by the owner on Jan 27, 2023. It is now read-only.

liatrio/image-builder-azure-terraform

Repository files navigation

What is the image for?

The intended purpose of this image is for it to be used as a Jenkins agent. By using the installed features the user is able to create Jenkins pipelines that can trigger Terraform scripts to deploy to an Azure environment. Additionally, Terragrunt gives the ability to use extra tools for Terraform while TFLint gives us a Terraform linter. An example of using this image as a Jenkins agent via Kubernetes can be seen below.

First, an example of configuring the pod template in yaml to create the agent.

jenkins:
  clouds:
    - kubernetes:
        name: "kubernetes"
        templates:
          - name: "image-builder-azure-terraform"
            label: "image-builder-azure-terraform"
            nodeUsageMode: NORMAL
            containers:
              - name: "image-azure-terraform"
                image: "ghcr.io/liatrio/image-builder-azure-terraform:${builder_images_version}"

And then specifying the agent in the Jenkinsfile for an example step.

stage('Build') {
  agent {
    label "image-builder-azure-terraform"
  }
  steps {
    container('image-azure-terraform') {
      sh "terragrunt plan"
      sh "terragrunt apply"
      sh "az login --service-principal -u $AZURE_CLIENT_ID -p $AZURE_CLIENT_SECRET -t $AZURE_TENANT_ID"
    }
  }
}

What is installed on this image?

  • The Azure CLI
  • Version 1.18.2 of the Go programming language
  • Version 4.5.1 of yq, a command-line YAML, JSON and XML processor
  • Version 0.36.2 of Terraform linter TFLint
  • Version 1.2.5 of infrastructure as code tool Terraform
  • Version 0.38.4 of Terraform wrapper Terragrunt