gradle-plugins icon indicating copy to clipboard operation
gradle-plugins copied to clipboard

dockerisation of terraform means that certain features in terraform are not supported such as ${file()} function

Open GvD49 opened this issue 5 years ago • 1 comments

When we dockerise terraform you depend on ensuring you mount all required files into the docker container. I observed you have used a volume to mount paths.

There needs to be a way to specify additional volume mounts within the definition of terraform task to allow external resources to be loaded.

`

Task :terraformValidate Executing: [validate] Executing: [docker, run, -i, --rm, -u, 501, -e, HOME=/build/wrapper, -v, /Users/../abc-platform/build:/build, -v, /Users/../abc-platform/src:/src, -v, /Users/../abc-platform/src/main/terraform:/etc/project/conf, -v, /Users/../abc-platform/build/.terraform:/.terraform, hashicorp/terraform:0.11.7, validate, /etc/project/conf]

Error: provider.google: file: open /Users/.../abc-platform/conf/alpha-service-account.json: no such file or directory in:

${file("${var.gcp_credentials_file_path}")}

Task :terraformValidate FAILED `

GvD49 avatar Mar 28 '19 05:03 GvD49

There is a terraform.client.volumeMappings property that allows the introduction of additional volumes. By default already /arc and /build are mapped. Not done (at least for now) is to do any kind of path mapping of the terraform scripts, so they need to make use of the Dockerized-paths (in Gradle the path mapping is happening automatically).

remmeier avatar Apr 01 '19 15:04 remmeier