Mappings in template do not maintain quotes during package step
Hello, using aws cloudformation package with the following simple snippet results in the loss of quotes which causes a ChangeSet to remain in CREATE_IN_PROGRESS indefinitely in the proper scenerio.
Mappings:
'1234567890':
kmskeys:
'dev': 'arn:aws:kms:us-east-1:1234567890:key/1234567890-abcdefg-1234-1234'
'test': 'arn:aws:kms:us-east-1:1234567890:key/1234567890-abcdefg-1234-12345'
after the aws cloudformation package step:
Mappings:
1234567890:
kmskeys:
dev: arn:aws:kms:us-east-1:1234567890:key/1234567890-abcdefg-1234-1234
test: arn:aws:kms:us-east-1:1234567890:key/1234567890-abcdefg-1234-12345
This is a problem because when using the !Ref "AWS::AccountID" function, a string is returned so it will never match the mapping - if you are mapping per AccountID.
Per the docs, if a Mapping is not used, it is an invalid changeset
So, I'm curious if this is a bug. I feel like I should be able to create a Mapping with Account ID's and then reference the AccountID later in a later block and it is currently not possible with aws cloudformation package. Thoughts?
$ aws --version
aws-cli/1.11.47 Python/2.7.10 Darwin/16.0.0 botocore/1.5.10
Upon further review and testing, this problem ONLY exists if your account id starts with 0.
Ah interesting. My first guess is that YAML parser/dumper does type conversion which removes types. Need to dig into this further
aws/aws-cli#2556 gives you a workaround. You can use --use-json to dump in JSON instead of YAML. We still have aws/aws-cli#2511 open which will end up quoting every single string in output just to be safe.
Does this solve your problem?
Sure. I've already made a workaround. If you feel it is sufficient to close this, go ahead. Thanks for the response!
Sounds good.
@jolexa What was your workaround?
Using sed in a pre-deployment step. Ugly but quicker than waiting for awscli bugfixes :/