Skip to content

Commit

Permalink
Improve ADF version references in main template (#351)
Browse files Browse the repository at this point in the history
* Improve ADF version references in main template

**Why?**

For each new version of ADF, we need to update the version number in the
main template. However, as there are quite a few, it is likely to forget
one or search/replace another string that should not have matched.

**What?**

By adding the version number as a mapping, it can be updated quickly.
Reducing the number of times the version is repeated in the template to
two.

The first usage, in the Serverless Application Repository (SAR) metadata
is not able to use intrinsic CloudFormation functions unfortunately.
As described in the
[SAR Metadata property documentation](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-template-publishing-applications-metadata-properties.html).

* Use version metadata on new Version parameter too
  • Loading branch information
sbkok authored Apr 14, 2021
1 parent ef461d5 commit e16816e
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Metadata:
HomePageUrl: https://github.com/awslabs/aws-deployment-framework
SemanticVersion: 3.1.2
SourceCodeUrl: https://github.com/awslabs/aws-deployment-framework
Mappings:
Metadata:
ADF:
Version: 3.1.2
Parameters:
CrossAccountAccessRoleName:
Type: String
Expand Down Expand Up @@ -193,7 +197,7 @@ Resources:
TERMINATION_PROTECTION: false
MASTER_ACCOUNT_ID: !Ref AWS::AccountId
ORGANIZATION_ID: !GetAtt Organization.OrganizationId
ADF_VERSION: 3.1.2
ADF_VERSION: !FindInMap ['Metadata', 'ADF', 'Version']
ADF_LOG_LEVEL: INFO
FunctionName: StackWaiter
Role: !GetAtt LambdaRole.Arn
Expand All @@ -214,7 +218,7 @@ Resources:
DEPLOYMENT_ACCOUNT_BUCKET: !GetAtt SharedModulesBucketName.Value
MASTER_ACCOUNT_ID: !Ref AWS::AccountId
ORGANIZATION_ID: !GetAtt Organization.OrganizationId
ADF_VERSION: 3.1.2
ADF_VERSION: !FindInMap ['Metadata', 'ADF', 'Version']
ADF_LOG_LEVEL: INFO
FunctionName: DetermineEventFunction
Role: !GetAtt LambdaRole.Arn
Expand All @@ -235,7 +239,7 @@ Resources:
DEPLOYMENT_ACCOUNT_BUCKET: !GetAtt SharedModulesBucketName.Value
MASTER_ACCOUNT_ID: !Ref AWS::AccountId
ORGANIZATION_ID: !GetAtt Organization.OrganizationId
ADF_VERSION: 3.1.2
ADF_VERSION: !FindInMap ['Metadata', 'ADF', 'Version']
ADF_LOG_LEVEL: INFO
FunctionName: CrossAccountExecuteFunction
Role: !GetAtt LambdaRole.Arn
Expand All @@ -254,7 +258,7 @@ Resources:
S3_BUCKET_NAME: !Ref BootstrapTemplatesBucket
TERMINATION_PROTECTION: false
MASTER_ACCOUNT_ID: !Ref AWS::AccountId
ADF_VERSION: 3.1.2
ADF_VERSION: !FindInMap ['Metadata', 'ADF', 'Version']
ADF_LOG_LEVEL: INFO
FunctionName: RoleStackDeploymentFunction
Role: !GetAtt LambdaRole.Arn
Expand All @@ -273,7 +277,7 @@ Resources:
S3_BUCKET_NAME: !Ref BootstrapTemplatesBucket
TERMINATION_PROTECTION: false
MASTER_ACCOUNT_ID: !Ref AWS::AccountId
ADF_VERSION: 3.1.2
ADF_VERSION: !FindInMap ['Metadata', 'ADF', 'Version']
ADF_LOG_LEVEL: INFO
FunctionName: MovedToRootActionFunction
Role: !GetAtt LambdaRole.Arn
Expand All @@ -292,7 +296,7 @@ Resources:
S3_BUCKET_NAME: !Ref BootstrapTemplatesBucket
TERMINATION_PROTECTION: false
MASTER_ACCOUNT_ID: !Ref AWS::AccountId
ADF_VERSION: 3.1.2
ADF_VERSION: !FindInMap ['Metadata', 'ADF', 'Version']
ADF_LOG_LEVEL: INFO
FunctionName: UpdateResourcePoliciesFunction
Role: !GetAtt LambdaRole.Arn
Expand Down Expand Up @@ -472,7 +476,7 @@ Resources:
Image: "aws/codebuild/standard:5.0"
EnvironmentVariables:
- Name: ADF_VERSION
Value: 3.1.2
Value: !FindInMap ['Metadata', 'ADF', 'Version']
- Name: TERMINATION_PROTECTION
Value: false
- Name: PYTHONPATH
Expand Down Expand Up @@ -736,7 +740,7 @@ Resources:
Type: Custom::InitialCommit
Properties:
ServiceToken: !GetAtt InitialCommitHandler.Arn
Version: 3.1.2
Version: !FindInMap ['Metadata', 'ADF', 'Version']
RepositoryArn: !GetAtt CodeCommitRepository.Arn
DirectoryName: bootstrap_repository
ExistingAccountId: !Ref DeploymentAccountId
Expand Down Expand Up @@ -775,7 +779,7 @@ Resources:
ServiceToken: !GetAtt CrossRegionBucketHandler.Arn
Region: !Ref DeploymentAccountMainRegion
BucketNamePrefix: !Sub "adf-shared-modules-${DeploymentAccountMainRegion}"
Version: 3.1.2
Version: !FindInMap ['Metadata', 'ADF', 'Version']
PolicyDocument:
Statement:
- Action:
Expand Down Expand Up @@ -959,7 +963,7 @@ Resources:
Id: adf-codepipeline-trigger-bootstrap
Outputs:
ADFVersionNumber:
Value: 3.1.2
Value: !FindInMap ['Metadata', 'ADF', 'Version']
Export:
Name: "ADFVersionNumber"
LayerArn:
Expand Down

0 comments on commit e16816e

Please sign in to comment.