-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
AutoPublishAlias does not accept a !Ref #778
Comments
That is a valid SAM template and deploys via CloudFormation. It appears that SAM is trying to resolve the parameter passed into AutoPublishAlias and can't, thus throwing an error. Allowing parameter overrides in |
Talked with @jfuss who brought up that template validation should depend on whether or not a template is valid, not on the existence of a parameter. Customers should not have to pass in parameters for validation. |
The issue here is that SAM actually needs to resolve the value of certain parameters in order to generate the logical ids of other CloudFormation resources during the transform. The fix for this is either for the SAM translator library to offer a |
Hi folks, just curious, is a fix for this on the roadmap? |
I pinged aws-cloudformation/cfn-lint#582 again. Was hoping the issue could be fixed on the cfn-lint side. |
Still seeing this issue, it has not been resolved yet. |
Just ran this issue again. Results:
|
Seeing this not only on validate but also on deploy.
When I deploy I get the following error: |
Just in case, check the issue is not the colon not needed after Parameters:
Environment:
Type: String
Description: Environment to deploy resources to
AllowedValues:
- staging
- production
Resources:
PutFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Sub 'put-${Environment}'
CodeUri: ./src/put-book/
Handler: index.handler
AutoPublishAlias: !Ref Environment |
@jbernalvallejo That was definitely the issue w/ !Ref, thanks! The remaining issue would be around !FindInMap:
|
SAM currently supports only |
@ShreyaGangishetty if "SAM currently supports only Ref for AutopublishAlias" is true, do you think we can close this issue? |
If not this ticket, where should support for Intrinsic functions (Fn::Join) be requested for AutoPublishAlias? |
That's not entirely accurate. Or more accurately, it does not support a Globals:
Function:
AutoPublishAlias: live
Resources:
HelloFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: "Hello"
CodeUri: ./src/hello/
Handler: index.handler
AutoPublishAlias: !Ref AWS::NoValue Is my use case common? No. I'm just transitioning to aliases, but there's one function that I need it disabled on. The suitable workaround is copy/paste. |
Closing in favor of #2533. |
Description:
Using a
!Ref
inAutoPublishAlias
throws an error when runningsam validate
.This is a duplicate of aws-cloudformation/cfn-lint#582 but it looks like it's a SAM error and not a cfn-lint error, so I'm opening a ticket here.
It is not a duplicate of #220 as using
!Ref
inAutoPublishAlias
should be allowed. Even the error message say so.Steps to reproduce the issue:
sam validate
on that templateObserved result:
The command results in an error 💥
Error: [InvalidResourceException('SkillFunction', "'AutoPublishAlias' must be a string or a Ref to a template parameter")] ('SkillFunction', "'AutoPublishAlias' must be a string or a Ref to a template parameter")
Expected result:
The command finishes successfully without any error message.
The text was updated successfully, but these errors were encountered: