You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got caught out today with the error IndexError: Fn::Select - List size is smaller than the Index given.
This was because my template was trying to add a "uniqifier" to some resource names based on the StackId (part of a Service Catalog product) using this:
rBastionSSMIAMRole:
Type: AWS::IAM::Role
Properties:
RoleName: !Sub
- '${pAccountShortName}-ssm-bastion-${uniqifier}-role'
- # AWS::StackId has this format
# arn:aws:cloudformation:us-west-2:123456789012:stack/teststack/51af3dc0-da77-11e4-872e-1234567db123
# Trying to capture the last piece after the '-'
# As stack name could contain "-"s, split on the "/"s first
uniqifier: !Select [ 4, !Split [ "-", !Select [ 2, !Split [ "/", !Ref AWS::StackId ] ] ] ]
By default StackId should have a non-blank value.
Workaround is to set this manually in test case
# Set a non-blank value for the StackId
Template.StackId = "arn:aws:cloudformation:us-west-2:123456789012:stack/teststack/51af3dc0-da77-11e4-872e-1234567db123"
The text was updated successfully, but these errors were encountered:
I got caught out today with the error
IndexError: Fn::Select - List size is smaller than the Index given.
This was because my template was trying to add a "uniqifier" to some resource names based on the StackId (part of a Service Catalog product) using this:
By default StackId should have a non-blank value.
Workaround is to set this manually in test case
The text was updated successfully, but these errors were encountered: