-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix: fail with invalid resource, when RetentionPolicy has unresolved intrinsic value #2074
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,11 @@ Conditions: | |
- beta | ||
- beta | ||
|
||
Parameters: | ||
DeletePolicy: | ||
Default: Retain | ||
Type: String | ||
|
||
Resources: | ||
MinimalLayer: | ||
Type: 'AWS::Serverless::LayerVersion' | ||
|
@@ -35,4 +40,16 @@ Resources: | |
Type: 'AWS::Serverless::LayerVersion' | ||
Condition: TestCondition | ||
Properties: | ||
ContentUri: s3://sam-demo-bucket/layer.zip | ||
ContentUri: s3://sam-demo-bucket/layer.zip | ||
|
||
LayerWithCaseInsensitiveRetentionPolicy: | ||
Type: 'AWS::Serverless::LayerVersion' | ||
Properties: | ||
ContentUri: s3://sam-demo-bucket/layer.zip | ||
RetentionPolicy: DeleTe | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❤️ |
||
|
||
LayerWithRetentionPolicyParam: | ||
Type: 'AWS::Serverless::LayerVersion' | ||
Properties: | ||
ContentUri: s3://sam-demo-bucket/layer.zip | ||
RetentionPolicy: !Ref DeletePolicy |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,9 @@ Parameters: | |
Default: | ||
- Retain | ||
Type: List | ||
DeletePolicyIf: | ||
Default: False | ||
Type: Boolean | ||
|
||
Resources: | ||
LayerWithRuntimesString: | ||
|
@@ -43,4 +46,10 @@ Resources: | |
Type: 'AWS::Serverless::LayerVersion' | ||
Properties: | ||
ContentUri: s3://sam-demo-bucket/layer.zip | ||
RetentionPolicy: !Ref DeleteList | ||
RetentionPolicy: !Ref DeleteList | ||
|
||
LayerWithRetentionPolicyAsIntrinsic: | ||
Type: 'AWS::Serverless::LayerVersion' | ||
Properties: | ||
ContentUri: s3://sam-demo-bucket/layer.zip | ||
RetentionPolicy: !If [DeletePolicyIf, Retain, Delete] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have a test for Ref? I think that intrinsic is supported right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeap it is supported, and we already have tests in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we communicate that the customer could use the top level Attribute of DeletionPolicy? For customers needing or wanting the Intrinsic, this might be the only way forward for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, intrinsics are not supported for top level attributes; https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html
I tested with a template but I wasn't able to deploy it.