Search code examples
google-cloud-build

Using hashicorp container with cloudbuild


All of the cloudbuild documentation references using Cloud builders (publicly available container images) that are hosted by GCP. I need to run a terraform build and have successfully used a terraform published container image in my cloudbuild configuration file:

steps:
- name: 'hashicorp/terraform:latest'

Is this the right approach or should creating my own terraform container image as shown below and using that? I'm not understanding what the value is of having my own 'builder' when one already exists... https://github.com/GoogleCloudPlatform/cloud-builders-community/blob/master/terraform/cloudbuild.yaml


Solution

  • Running Terraform builds in Cloud Build is best done using the hashicorp/terraform:latest container image. It offers the most recent version of Terraform because it has already been developed and is being maintained.

    If the default image does not meet your special needs or customizations, creating your own container image can be helpful. More control over the build environment is possible, but more upkeep is necessary.

    For the majority of use situations, the default Terraform image ought to be adequate.