Skip to content

Commit cf5e660

Browse files
committed
Install aws and show buckets in terraform script
1 parent b2d0ec8 commit cf5e660

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

internal/servicedeployer/_static/Dockerfile.terraform_deployer

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ENV GCLOUD_SDK_VERSION=467.0.0-0
33
ENV TERRAFORM_VERSION=1.9.6
44

55
RUN apt-get -qq update \
6-
&& apt-get install -yq curl apt-transport-https ca-certificates gnupg \
6+
&& apt-get install -yq curl apt-transport-https ca-certificates gnupg unzip \
77
&& apt-get clean
88

99
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \
@@ -18,6 +18,11 @@ RUN curl -fsSL https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/sh
1818
&& apt-get install -yq terraform=${TERRAFORM_VERSION}-1 \
1919
&& apt-get clean
2020

21+
RUN curl -s "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
22+
&& unzip -q awscliv2.zip \
23+
&& ./aws/install \
24+
&& rm -rf awscliv2.zip aws
25+
2126
HEALTHCHECK --timeout=3s CMD sh -c "[ -f /tmp/tf-applied ]"
2227

2328
ENV TF_IN_AUTOMATION=true

internal/servicedeployer/_static/terraform_deployer_run.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,16 @@ trap cleanup EXIT INT TERM
2020

2121
terraform init
2222
terraform plan
23+
24+
export AWS_DEFAULT_REGION="${AWS_REGION}"
25+
echo "Before Terraform Apply command"
26+
aws s3api list-buckets --query "Buckets[].Name" --output text | tr '\t' '\n'
27+
2328
terraform apply -auto-approve
2429

30+
echo "After Terraform Apply command"
31+
aws s3api list-buckets --query "Buckets[].Name" --output text | tr '\t' '\n'
32+
2533
terraform output -json > /output/tfOutputValues.json
2634

2735
touch /tmp/tf-applied # This file is used as indicator (healthcheck) that the service is UP, and so it must be placed as the last statement in the script

0 commit comments

Comments
 (0)