-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
bugfix/integrate_intrinsics #1343
Conversation
When running local layer integration tests, there was a cleanup error that occured if there was a KeyboardExit occurred on the previous run. This causes problems with cached values on consecutive tests.
When running local layer integration tests, there was a cleanup error that occured if there was a KeyboardExit occurred on the previous run. This causes problems with cached values on consecutive tests.
…s-sam-cli into bugfix/integrate_intrinsics
Lambda Layers were added as a special case where Ref's to unresolved resources remained as {"Ref": logical_id}. This was chosen to be the default since SamTranslator handles the translation of some resource and converts some types such as {"Ref":"AWS::Region"} -> {"Ref": "us-east-1"} and replacing Globals.
The integrate_intrinsics pr failed because LambdaLayers were handling Refs in a different way than the default resolver. I now handle LambdaLayers as a special case since unresolved Refs become {"Ref": "logical_id"}. Before: SamTranslator was run and left attributes such as {"Ref": "value"} -> {"Ref": "value"}. The translator would leave the following resource as is. StageTest:
Properties:
RestApiId: !Ref Value However, we need to resolve these attributes in order to fully resolve intrinsics. After running a pass through the SamTranslator then IntrinsicResolver. Now, what we do is convert it to StageTest:
Properties:
RestApiId: Value This is because SamTranslator resolves a ref such as {"Ref": "AWS::Region"} to {"Ref": "us-east-1"}. It also replaces Global Attributes directly into the relevant resources. However, we want {"Ref": "AWS::Region"} to become "us-east-1". Thus, by default we take {"Ref": "value"} -> "value". To provide support for the special LambdaLayer case, I extended the IntrinsicSymbolTable to use
In terms of dealing and managing intrinsics cases such as this, this implementation is not inclusive of all ways to process Refs and Fn::GetAtt. There doesn't seem to be a good standard that CloudFormation has set for all Refs and Fn::GetAtts. We need to either add special support for more types as time goes on or find another way to deal with maintaining intrinsics in the longer term. |
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.
Thanks for the fix @viksrivat!
Issue #, if available:
There was a bug when dealing with layers and intrinsics. This is an update to add tests and to address it.
Description of changes:
Checklist:
make pr
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.