Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logical Id for LayerVersion not updated #703

Open
dqvist opened this issue Dec 6, 2018 · 2 comments

Comments

@dqvist
Copy link

commented Dec 6, 2018

Description:

When creating a AWS::Serverless::LayerVersion and using a combination of S3 Location Object and !Ref for the ContentUri the generated hash for the logical Id don't change.

Template in use:

HelloWorldLayer:
Type: "AWS::Serverless::LayerVersion"
Properties:
LayerName: hello-world
Description: Simple Hello World Layer
ContentUri:
Bucket: !Ref ArtifactBucket
Key: !Ref ArtifactKey
CompatibleRuntimes:
- python2.7
- python3.6
- python3.7
LicenseInfo: 'Available under the MIT-0 license.'
RetentionPolicy: Retain

Steps to reproduce the issue:

  1. Deploy a LayerVersion using the template snippet above.
  2. Update value for template parameter ArtifactKey
  3. Redeploy the LayerVersion

Observed result:

Same logical Id generated and the old LayerVersion gets deleted.

Expected result:

A new logical Id is generated and old LayerVersion is preserved.

@keetonian

This comment has been minimized.

Copy link
Contributor

commented Dec 6, 2018

Yes, I can see how this would happen, good find. We need to resolve the !Ref intrinsic in SAM instead of letting CFN do it.

Line to fix: https://github.com/awslabs/serverless-application-model/blob/master/samtranslator/model/sam_resources.py#L653

@dqvist

This comment has been minimized.

Copy link
Author

commented Dec 7, 2018

On the same topic. !Sub doesn't work either. It produce an error, sounds like the exact same root cause that intrinsic functions are nor resolved by SAM. Following produce an error:
ContentUri: !Sub s3://${ArtifactBucket}/${ArtifactKey}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.