diff --git a/elastio-s3-changelog/cloudformation-multiple-buckets-with-macros.yaml b/elastio-s3-changelog/cloudformation-multiple-buckets-with-macros.yaml index 42b22ac..0e0a62a 100644 --- a/elastio-s3-changelog/cloudformation-multiple-buckets-with-macros.yaml +++ b/elastio-s3-changelog/cloudformation-multiple-buckets-with-macros.yaml @@ -46,7 +46,7 @@ Resources: EnableQrts: !Ref EnableQrts QrtsBatchSize: !Ref QrtsBatchSize QrtsMaxDelay: !Ref QrtsMaxDelay - TemplateURL: https://{{S3_BUCKET}}.s3.{{AWS_REGION}}.amazonaws.com/{{S3_PREFIX}}/{{VERSION}}/cloudformation-single-bucket.yaml + TemplateURL: !Sub https://{{S3_BUCKET_PREFIX}}-${AWS::Region}.s3.${AWS::Region}.amazonaws.com/{{S3_KEY_PREFIX}}/{{VERSION}}/cloudformation-single-bucket.yaml Outputs: templateVersion: Value: "{{VERSION}}" diff --git a/elastio-s3-changelog/cloudformation-multiple-buckets.yaml b/elastio-s3-changelog/cloudformation-multiple-buckets.yaml index da98875..62bd438 100644 --- a/elastio-s3-changelog/cloudformation-multiple-buckets.yaml +++ b/elastio-s3-changelog/cloudformation-multiple-buckets.yaml @@ -102,7 +102,7 @@ Resources: EnableQrts: !Ref EnableQrts QrtsBatchSize: !Ref QrtsBatchSize QrtsMaxDelay: !Ref QrtsMaxDelay - TemplateURL: https://{{S3_BUCKET}}.s3.{{AWS_REGION}}.amazonaws.com/{{S3_PREFIX}}/{{VERSION}}/cloudformation-multiple-buckets-with-macros.yaml + TemplateURL: !Sub https://{{S3_BUCKET_PREFIX}}-${AWS::Region}.s3.${AWS::Region}.amazonaws.com/{{S3_KEY_PREFIX}}/{{VERSION}}/cloudformation-multiple-buckets-with-macros.yaml Outputs: templateVersion: diff --git a/elastio-s3-changelog/upload.sh b/elastio-s3-changelog/upload.sh index 311aa74..ec76050 100755 --- a/elastio-s3-changelog/upload.sh +++ b/elastio-s3-changelog/upload.sh @@ -3,12 +3,12 @@ # Upload the templates into your S3 bucket for testing # Use this script like this: # ```bash -# S3_BUCKET=bucket LINK_PARAMS='¶m_BucketNames=foo,bar' ./elastio-s3-changelog/upload.sh +# S3_BUCKET_PREFIX=bucket LINK_PARAMS='¶m_BucketNames=foo,bar' ./elastio-s3-changelog/upload.sh # ``` set -euxo pipefail -s3_prefix=contrib/elastio-s3-changelog +s3_key_prefix=contrib/elastio-s3-changelog trap cleanup SIGINT SIGTERM ERR EXIT @@ -38,12 +38,11 @@ cd "$temp_dir" # Using `|` separator instead of `/` for prefix, because prefix # by itself contains a `/` sed -i ./*.yaml \ - -e "s/{{AWS_REGION}}/$AWS_REGION/g" \ - -e "s/{{S3_BUCKET}}/$S3_BUCKET/g" \ - -e "s|{{S3_PREFIX}}|$s3_prefix|g" \ + -e "s/{{S3_BUCKET_PREFIX}}/$S3_BUCKET_PREFIX/g" \ + -e "s|{{S3_KEY_PREFIX}}|$s3_key_prefix|g" \ -e "s/{{VERSION}}/$version/g" -aws s3 cp --recursive ./ "s3://${S3_BUCKET}/${s3_prefix}/${version}/" +aws s3 cp --recursive ./ "s3://$S3_BUCKET_PREFIX-$AWS_REGION/${s3_key_prefix}/${version}/" # Skip opening the link if we're on CI if [[ -v CI ]]; then @@ -53,8 +52,8 @@ fi cfn_deep_link_parts=( "https://$AWS_REGION.console.aws.amazon.com/cloudformation/home" "?region=$AWS_REGION#/stacks/create/review?templateURL=" - "https://$S3_BUCKET.s3.$AWS_REGION.amazonaws.com/" - "$s3_prefix/$version/cloudformation-multiple-buckets.yaml" + "https://$S3_BUCKET_PREFIX-$AWS_REGION.s3.$AWS_REGION.amazonaws.com/" + "$s3_key_prefix/$version/cloudformation-multiple-buckets.yaml" "&stackName=elastio-s3-changelog" "${LINK_PARAMS:-}" )