From 27a002528103f751b5f6f62b489c9c60115c0919 Mon Sep 17 00:00:00 2001 From: Giacomo Marciani Date: Mon, 16 Oct 2023 11:46:37 +0200 Subject: [PATCH] [Ops] Add possibility to specify the infrastructure bucket name directly, rather than referencing the CloudFormation stack that deploys it. --- infrastructure/environments/demo-variables.sh | 5 ++++- infrastructure/update-environment-infra.sh | 17 ++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/infrastructure/environments/demo-variables.sh b/infrastructure/environments/demo-variables.sh index c40de999..3411150f 100644 --- a/infrastructure/environments/demo-variables.sh +++ b/infrastructure/environments/demo-variables.sh @@ -1,3 +1,6 @@ REGION=eu-west-1 STACK_NAME=parallelcluster-ui-demo -INFRA_BUCKET_STACK_NAME=pcluster-manager-github \ No newline at end of file +INFRA_BUCKET_STACK_NAME=pcluster-manager-github +# If the bucket used by the environment is not managed by a dedicated CloudFormation stack, +# specify the bucket name as follows and comment out 'INFRA_BUCKET_STACK_NAME'. +# INFRA_BUCKET_NAME=pcluster-ui-bucket \ No newline at end of file diff --git a/infrastructure/update-environment-infra.sh b/infrastructure/update-environment-infra.sh index b813bc47..56bff583 100755 --- a/infrastructure/update-environment-infra.sh +++ b/infrastructure/update-environment-infra.sh @@ -23,13 +23,16 @@ FILES=(parallelcluster-ui-cognito.yaml parallelcluster-ui.yaml) ENVIRONMENT=$1 . "${SCRIPT_DIR}/environments/${ENVIRONMENT}-variables.sh" -BUCKET=$(aws cloudformation describe-stack-resources \ - --stack-name "${INFRA_BUCKET_STACK_NAME}" \ - --logical-resource-id InfrastructureBucket \ - --region "${REGION}" \ - --output json \ - --query 'StackResources[0].PhysicalResourceId'\ - | tr -d '"' ) +if [[ -n $INFRA_BUCKET_NAME ]]; then + BUCKET=$INFRA_BUCKET_NAME +else + BUCKET=$(aws cloudformation describe-stack-resources \ + --stack-name "${INFRA_BUCKET_STACK_NAME}" \ + --logical-resource-id InfrastructureBucket \ + --output json \ + --query 'StackResources[0].PhysicalResourceId'\ + | tr -d '"' ) +fi # The yaml files describing the infrastructure are uploaded to a private S3 bucket # and then used to update the CloudFormation stack, where the same bucket is passed as parameters.