2 Answers
- Newest
- Most votes
- Most comments
0
Hi,
I use a lot of such SSM parameters to hold (for example) container image names in my CFN templates. But, I don't use your resolve:ssm construct.
I do it this way:
Resources:
#define parameter
ImageUri:
Type: AWS::SSM::Parameter
DeletionPolicy: Delete
Properties:
Type: 'String'
Value: !Sub '${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${ImageName}:${ImageTag}'
#use parameter: see !GetAtt ImageUri.Value below
EcsTaskDefinition:
Type: AWS::ECS::TaskDefinition
DeletionPolicy: Delete
Properties:
Cpu: !Ref ContainerCpu
Memory: !Ref ContainerMemory
NetworkMode: 'awsvpc'
ExecutionRoleArn: !GetAtt EcsTaskRole.Arn
ContainerDefinitions:
- Name: !GetAtt ContainerName.Value
Cpu: !Ref ContainerCpu
Memory: !Ref ContainerMemory
Image: !GetAtt ImageUri.Value
It has been working fine for me over the last couple of years in numerous use cases.
Best,
Didier
0
Dynamic references are executed when resources (e.g., ECS task definitions) are created. CloudFormation doesn’t detect drifts for these, so they aren’t referenced in ChangeSets.[1]
Two workarounds:
- Mention the version in the dynamic reference. After updating the parameter, update the version in the stack and create a ChangeSet to see the retrieved value.
- Update the stack directly after parameter updates.
References: [1] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references-ssm.html
answered a year ago
