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 ValueHowever, 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: ValueThis 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. |
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 prpassesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.