From 70760ba24dfc8582a76eb42a20ef7af9f0c55321 Mon Sep 17 00:00:00 2001 From: Edoardo Tenani Date: Fri, 24 Dec 2021 16:06:46 +0100 Subject: [PATCH 1/4] update terraform deployer image Terraform deployer image may need some additional Cloud Service Provider specific tooling to handle corner cases not handled by Terraform itself. In this case this commits adds support for `bq` tool from GCP Cloud SDK. As `bq` and the entire GCP Cloud SDK requires python, is easy to add AWS or Azure dedicated tooling in the future (as both are Python-based). --- .../_static/Dockerfile.terraform_deployer | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/internal/install/_static/Dockerfile.terraform_deployer b/internal/install/_static/Dockerfile.terraform_deployer index acb0afb03..dc5a036b8 100644 --- a/internal/install/_static/Dockerfile.terraform_deployer +++ b/internal/install/_static/Dockerfile.terraform_deployer @@ -1,6 +1,23 @@ -FROM hashicorp/terraform:light -ENV TF_IN_AUTOMATION=true +FROM hashicorp/terraform:light as terraform + +FROM python:3-alpine + +# required by gcloud SDK +RUN apk add curl + +ENV GCLOUD_SDK_VERSION 367.0.0 +ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin +RUN curl "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-$GCLOUD_SDK_VERSION-linux-x86_64.tar.gz" > /tmp/google-cloud-sdk.tar.gz \ + && mkdir -p /usr/local/gcloud \ + && tar -C /usr/local/gcloud -xvf /tmp/google-cloud-sdk.tar.gz \ + && /usr/local/gcloud/google-cloud-sdk/install.sh -q --override-components="bq" + HEALTHCHECK --timeout=3s CMD sh -c "[ -f /tmp/tf-applied ]" + +COPY --from=terraform /bin/terraform /usr/bin/terraform + +ENV TF_IN_AUTOMATION=true ADD run.sh / WORKDIR /workspace + ENTRYPOINT sh /run.sh From b24fe3ad883ac1c95a174ee9c30171f2ad9a5e2f Mon Sep 17 00:00:00 2001 From: Edoardo Tenani Date: Wed, 19 Jan 2022 16:17:40 +0100 Subject: [PATCH 2/4] install git and openssh --- internal/install/_static/Dockerfile.terraform_deployer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/install/_static/Dockerfile.terraform_deployer b/internal/install/_static/Dockerfile.terraform_deployer index dc5a036b8..b006523de 100644 --- a/internal/install/_static/Dockerfile.terraform_deployer +++ b/internal/install/_static/Dockerfile.terraform_deployer @@ -3,7 +3,7 @@ FROM hashicorp/terraform:light as terraform FROM python:3-alpine # required by gcloud SDK -RUN apk add curl +RUN apk add git openssh curl ENV GCLOUD_SDK_VERSION 367.0.0 ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin From e9e3ca3d42c83df652ea4c795fbd09a09a8a088c Mon Sep 17 00:00:00 2001 From: Edoardo Tenani Date: Wed, 19 Jan 2022 16:17:52 +0100 Subject: [PATCH 3/4] skip using apk cache --- internal/install/_static/Dockerfile.terraform_deployer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/install/_static/Dockerfile.terraform_deployer b/internal/install/_static/Dockerfile.terraform_deployer index b006523de..4a509d9a6 100644 --- a/internal/install/_static/Dockerfile.terraform_deployer +++ b/internal/install/_static/Dockerfile.terraform_deployer @@ -3,7 +3,7 @@ FROM hashicorp/terraform:light as terraform FROM python:3-alpine # required by gcloud SDK -RUN apk add git openssh curl +RUN apk add --no-cache git openssh curl ENV GCLOUD_SDK_VERSION 367.0.0 ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin From 54883e31726e047f68f138db9285742441090614 Mon Sep 17 00:00:00 2001 From: Edoardo Tenani Date: Wed, 19 Jan 2022 16:18:17 +0100 Subject: [PATCH 4/4] cleanup google cloud SDK archive --- internal/install/_static/Dockerfile.terraform_deployer | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/install/_static/Dockerfile.terraform_deployer b/internal/install/_static/Dockerfile.terraform_deployer index 4a509d9a6..b3325d281 100644 --- a/internal/install/_static/Dockerfile.terraform_deployer +++ b/internal/install/_static/Dockerfile.terraform_deployer @@ -10,7 +10,8 @@ ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin RUN curl "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-$GCLOUD_SDK_VERSION-linux-x86_64.tar.gz" > /tmp/google-cloud-sdk.tar.gz \ && mkdir -p /usr/local/gcloud \ && tar -C /usr/local/gcloud -xvf /tmp/google-cloud-sdk.tar.gz \ - && /usr/local/gcloud/google-cloud-sdk/install.sh -q --override-components="bq" + && /usr/local/gcloud/google-cloud-sdk/install.sh -q --override-components="bq" \ + && rm /tmp/google-cloud-sdk.tar.gz HEALTHCHECK --timeout=3s CMD sh -c "[ -f /tmp/tf-applied ]"