Skip to content

Commit

Permalink
chore(ssm): latest parameter value with dynamic reference (#14205)
Browse files Browse the repository at this point in the history
CloudFormation now allows referencing the latest Systems Manager parameter
values in templates without specifying parameter versions using dynamic
references.

Remove the "trick" with the `Parameter` using a default value.

See https://aws.amazon.com/about-aws/whats-new/2021/04/now-reference-latest-aws-systems-manager-parameter-values-in-aws-cloudformation-templates-without-specifying-parameter-versions/

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
jogold authored Apr 21, 2021
1 parent c80e1cf commit 9e421e5
Show file tree
Hide file tree
Showing 55 changed files with 175 additions and 1,326 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -765,9 +765,7 @@
"FirelensConfiguration": {
"Type": "fluentbit"
},
"Image": {
"Ref": "SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter"
},
"Image": "{{resolve:ssm:/aws/service/aws-for-fluent-bit/latest}}",
"LogConfiguration": {
"LogDriver": "awslogs",
"Options": {
Expand Down Expand Up @@ -1634,9 +1632,7 @@
"FirelensConfiguration": {
"Type": "fluentbit"
},
"Image": {
"Ref": "SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter"
},
"Image": "{{resolve:ssm:/aws/service/aws-for-fluent-bit/latest}}",
"LogConfiguration": {
"LogDriver": "awslogs",
"Options": {
Expand Down Expand Up @@ -2622,9 +2618,7 @@
"FirelensConfiguration": {
"Type": "fluentbit"
},
"Image": {
"Ref": "SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter"
},
"Image": "{{resolve:ssm:/aws/service/aws-for-fluent-bit/latest}}",
"LogConfiguration": {
"LogDriver": "awslogs",
"Options": {
Expand Down Expand Up @@ -3484,12 +3478,6 @@
}
}
},
"Parameters": {
"SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/aws/service/aws-for-fluent-bit/latest"
}
},
"Outputs": {
"greeterloadbalancerdnsoutput": {
"Value": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ export = {
FirelensConfiguration: {
Type: 'fluentbit',
},
Image: {
Ref: 'SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter',
},
Image: '{{resolve:ssm:/aws/service/aws-for-fluent-bit/latest}}',
LogConfiguration: {
LogDriver: 'awslogs',
Options: {
Expand Down Expand Up @@ -119,4 +117,4 @@ export = {
test.done();
},

};
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ nodeunitShim({
});

expect(stack).toMatch({
'Parameters': {
'SsmParameterValueawsserviceamiamazonlinuxlatestamznamihvmx8664gp2C96584B6F00A464EAD1953AFF4B05118Parameter': {
'Type': 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>',
'Default': '/aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-gp2',
},
},
'Resources': {
'MyFleetInstanceSecurityGroup774E8234': {
'Type': 'AWS::EC2::SecurityGroup',
Expand Down Expand Up @@ -89,7 +83,7 @@ nodeunitShim({
'IamInstanceProfile': {
'Ref': 'MyFleetInstanceProfile70A58496',
},
'ImageId': { 'Ref': 'SsmParameterValueawsserviceamiamazonlinuxlatestamznamihvmx8664gp2C96584B6F00A464EAD1953AFF4B05118Parameter' },
'ImageId': '{{resolve:ssm:/aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-gp2}}',
'InstanceType': 'm4.micro',
'SecurityGroups': [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,7 @@
"FleetLaunchConfig59F79D36": {
"Type": "AWS::AutoScaling::LaunchConfiguration",
"Properties": {
"ImageId": {
"Ref": "SsmParameterValueawsserviceamiamazonlinuxlatestamzn2amihvmx8664gp2C96584B6F00A464EAD1953AFF4B05118Parameter"
},
"ImageId": "{{resolve:ssm:/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2}}",
"InstanceType": "t2.micro",
"IamInstanceProfile": {
"Ref": "FleetInstanceProfileC6192A66"
Expand Down Expand Up @@ -477,11 +475,5 @@
}
}
}
},
"Parameters": {
"SsmParameterValueawsserviceamiamazonlinuxlatestamzn2amihvmx8664gp2C96584B6F00A464EAD1953AFF4B05118Parameter": {
"Type": "AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>",
"Default": "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2"
}
}
}
Loading

0 comments on commit 9e421e5

Please sign in to comment.