# In this directory, run the following command to build this builder.
# $ gcloud builds submit . --config=cloudbuild.yaml

substitutions:
  _TERRAFORM_VERSION: 0.12.29
  _TERRAFORM_VERSION_SHA256SUM: 872245d9c6302b24dc0d98a1e010aef1e4ef60865a2d1f60102c8ad03e9d5a1d
  _TERRAGRUNT_VERSION: 0.26.4
  _TERRAGRUNT_VERSION_SHA256SUM: 8459105f8f02663d44108d3240e11c6944f22f1e59b4e2f061eae3b32911ac9b

steps:
  - name: "gcr.io/cloud-builders/docker"
    env:
      - "TERRAFORM_VERSION=${_TERRAFORM_VERSION}"
      - "TERRAFORM_VERSION_SHA256SUM=${_TERRAFORM_VERSION_SHA256SUM}"
      - "TERRAGRUNT_VERSION=${_TERRAGRUNT_VERSION}"
      - "TERRAGRUNT_VERSION_SHA256SUM=${_TERRAGRUNT_VERSION_SHA256SUM}"
    args:
      - "build"
      - --build-arg
      - TERRAFORM_VERSION=${_TERRAFORM_VERSION}
      - --build-arg
      - TERRAFORM_VERSION_SHA256SUM=${_TERRAFORM_VERSION_SHA256SUM}
      - --build-arg
      - TERRAGRUNT_VERSION=${_TERRAGRUNT_VERSION}
      - --build-arg
      - TERRAGRUNT_VERSION_SHA256SUM=${_TERRAGRUNT_VERSION_SHA256SUM}
      - --tag
      - "gcr.io/${PROJECT_ID}/terragrunt:${_TERRAFORM_VERSION}-${_TERRAGRUNT_VERSION}"
      - --tag
      - "gcr.io/${PROJECT_ID}/terragrunt:latest"
      - "."
images:
  - "gcr.io/${PROJECT_ID}/terragrunt:${_TERRAFORM_VERSION}-${_TERRAGRUNT_VERSION}"
  - "gcr.io/${PROJECT_ID}/terragrunt:latest"
tags: ["cloud-builders-community"]
