From 758667d6f13d962ada825611f00b0d798d108ab2 Mon Sep 17 00:00:00 2001 From: Kim Carter Date: Mon, 20 Jul 2020 20:57:04 +1200 Subject: [PATCH] Added explicit reference to AWS_REGION env var in build script --- buildAndDeployCloudImages.sh | 9 ++++----- tf/roots/1_static/variables.tf | 6 ++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/buildAndDeployCloudImages.sh b/buildAndDeployCloudImages.sh index aa96fd7..e66a78c 100755 --- a/buildAndDeployCloudImages.sh +++ b/buildAndDeployCloudImages.sh @@ -7,7 +7,6 @@ # AWS_REGION # AWS_PROFILE # AWS_ACCOUNT_ID - export $(egrep -v '^#' .env | xargs) echo @@ -26,7 +25,7 @@ docker tag nodegoat_web:latest $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com echo "The following images are currently in the suts/nodegoat repository..............................." echo -echo $(aws ecr list-images --repository-name suts/nodegoat --filter tagStatus=ANY --output json --query 'imageIds[*]') | jq +echo $(aws ecr list-images --region $AWS_REGION --repository-name suts/nodegoat --filter tagStatus=ANY --output json --query 'imageIds[*]') | jq echo echo "Pushing the new images............................................................................" @@ -35,13 +34,13 @@ docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/suts/nodegoat:late echo echo "After pushing, the following images are currently in the suts/nodegoat repository................" echo -echo $(aws ecr list-images --repository-name suts/nodegoat --filter tagStatus=ANY --output json --query 'imageIds[*]') | jq +echo $(aws ecr list-images --region $AWS_REGION --repository-name suts/nodegoat --filter tagStatus=ANY --output json --query 'imageIds[*]') | jq echo echo "Waiting 8 seconds for untagging..." sleep 8 echo "Deleting the following old (untagged) images in the suts/nodegoat repository....................." echo -untagedNodeGoatImages=$(aws ecr list-images --repository-name suts/nodegoat --filter tagStatus=UNTAGGED --output json --query 'imageIds[*]') +untagedNodeGoatImages=$(aws ecr list-images --region $AWS_REGION --repository-name suts/nodegoat --filter tagStatus=UNTAGGED --output json --query 'imageIds[*]') echo $untagedNodeGoatImages | jq echo aws ecr batch-delete-image --repository-name suts/nodegoat --image-ids "$untagedNodeGoatImages" @@ -49,6 +48,6 @@ aws ecr batch-delete-image --repository-name suts/nodegoat --image-ids "$untaged echo echo "The following images are left in the suts/nodegoat repository...................................." echo -nodeGoatImages=$(aws ecr list-images --repository-name suts/nodegoat --filter tagStatus=ANY --output json --query 'imageIds[*]') +nodeGoatImages=$(aws ecr list-images --region $AWS_REGION --repository-name suts/nodegoat --filter tagStatus=ANY --output json --query 'imageIds[*]') echo $nodeGoatImages | jq diff --git a/tf/roots/1_static/variables.tf b/tf/roots/1_static/variables.tf index 47b6613..9ce0a9d 100644 --- a/tf/roots/1_static/variables.tf +++ b/tf/roots/1_static/variables.tf @@ -8,16 +8,14 @@ variable "AWS_PROFILE" { type = string } -variable "AWS_ACCOUNT_ID" { - description = "Not used. Is here to stop Terraform warnings." -} - provider "aws" { profile = var.AWS_PROFILE # Bug: region shouldn't be required but is: https://github.com/terraform-providers/terraform-provider-aws/issues/7750 region = var.AWS_REGION } +variable "AWS_ACCOUNT_ID" { description = "Not used. Is here to stop Terraform warnings." } + variable "cloudflare_account_id" { description = "Used in cloudflare provider. Not used in this root." type = string