Skip to content

Commit 5b5c896

Browse files
committed
fix(devcontainer-gcp): set builder image properly
1 parent f2bb1b5 commit 5b5c896

File tree

1 file changed

+4
-1
lines changed
  • examples/templates/gcp-devcontainer

1 file changed

+4
-1
lines changed

examples/templates/gcp-devcontainer/main.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ locals {
172172
# The startup script will write this to a file, which the Docker run command will reference.
173173
docker_env_list_base64 = base64encode(join("\n", [for k, v in local.docker_env_input : "${k}=${v}"]))
174174

175+
# Builder image will either be the builder image parameter, or the cached image, if cache is provided.
176+
builder_image = try(envbuilder_cached_image.cached[0].image, data.coder_parameter.devcontainer_builder.value)
177+
175178
# The GCP VM needs a startup script to set up the environment and start the container. Defining this here.
176179
# NOTE: make sure to test changes by uncommenting the local_file resource at the bottom of this file
177180
# and running `terraform apply` to see the generated script. You should also run shellcheck on the script
@@ -214,7 +217,7 @@ locals {
214217
-v /home/${local.linux_user}/envbuilder:/workspaces \
215218
-v /var/run/docker.sock:/var/run/docker.sock \
216219
--env-file /home/${local.linux_user}/env.txt \
217-
${data.coder_parameter.devcontainer_builder.value}
220+
${local.builder_image}
218221
META
219222
}
220223

0 commit comments

Comments
 (0)