Skip to content

Commit

Permalink
[Ops] Add possibility to specify the infrastructure bucket name direc…
Browse files Browse the repository at this point in the history
…tly, rather than referencing the CloudFormation stack that deploys it.
  • Loading branch information
gmarciani committed Oct 16, 2023
1 parent 6943988 commit 27a0025
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
5 changes: 4 additions & 1 deletion infrastructure/environments/demo-variables.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
REGION=eu-west-1
STACK_NAME=parallelcluster-ui-demo
INFRA_BUCKET_STACK_NAME=pcluster-manager-github
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
17 changes: 10 additions & 7 deletions infrastructure/update-environment-infra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 27a0025

Please sign in to comment.