-
Notifications
You must be signed in to change notification settings - Fork 114
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
Warning: "unsupported string format" when using lift variables in IAM Policies #151
Comments
Hi @bboure ! As far as i know, It seems this plugin is conflicting with Lift probably because it resolves the variable (which gives a CDK token) but Lift never has a chance to transform the CDK token to a proper Cloudformation reference before the schema validation occurs. Not sure how to fix this but I guess if you bypass schema validation, then it would output a valid Cloudformation template. Reference links:
|
That's right, it's supported by a third party. I forgot to mention that. However, the plugin uses "native" validation and type So, this problem also happens here in the framework I just reproduced it: provider:
iam:
role:
statements:
- Effect: 'Allow'
Action:
- sqs:deleteMessageBatch
Resource:
- ${construct:winningsProcess.queueArn}
I am not sure how to fix that. Right now it's just a warning and cfn compiles just fine when all hooks run. Maybe a solution (or hack) would be to use custom tokens and token resolvers (not sure if this is possible) if tokens could be generated to something that match any of the possible values. eg:
- or - Overwrite |
Another use case I just stumbled upon is if we want to setup a Lambda Trigger for the dead letter queue. I was trying something along the following lines on
I did saw a PR regarding attaching a lambda to DLQ, but it seems it is blocked by other reasons. Appending '-dlq' does not feel right though. |
Description
When using lift variables as an IAM policy
Resource
, ServerlessFramework shows a warning.How to Reproduce
Warning:
Serverless: at 'functions.myFunction.iamRoleStatements[0].Resource[0]': unsupported string format
Additional Information
This is because when the config goes into the validation, variables have not fully been resolved and still contain the CDK tokens. Tokens don't match the ajv rules
eg:
Related/similar issue: serverless/serverless#8488
The text was updated successfully, but these errors were encountered: