Skip to content
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

Support serverless variables syntax ${} #66

Closed
wants to merge 1 commit into from

Conversation

mnapoli
Copy link

@mnapoli mnapoli commented Jul 29, 2020

This is a follow up from serverless/serverless#3184 (comment)

With a little changes, I managed to make this plugin support the ${} syntax of Serverless (instead of #{}). Here is an example:

functions:
    hello:
        handler: handler.hello
        environment:
            # We can reference `AWS::` variables
            REGION: ${AWS::Region}

            # We can use !Ref inline via the `ref:` prefix:
            BUCKET_NAME: ${ref:MyBucket}

            # We can use !GetAtt inline via the `getatt:` prefix:
            BUCKET_URL: 'https://${getatt:MyBucket.DomainName}'

            # We can use mix all that together in a string:
            REGIONAL_URL: 'https://${ref:MyBucket}.s3.${AWS::Region}.amazonaws.com'

            # We can also mix all of that with actual serverless variables (e.g. `${self:provider.stage}`)

resources:
    Resources:
        MyBucket:
            Type: AWS::S3::Bucket

I defined the following variables:

  • ${AWS::xxx} is compiled to #{AWS::xxx}
  • ${ref::xxx} is compiled to #{xxx}
  • ${getatt::xxx.yyy} is compiled to #{xxx.yyy}

I am opening this PR first to get some feedback and see if we should proceed with this. I like the fact that it is backward compatible, yet opens the possibility to switch to an entirely new syntax.

WDYT?

@medikoo
Copy link
Collaborator

medikoo commented Jul 22, 2021

Closing, as all functionalities as provided by this plugin are now covered by the Framework (since v2.50.0)

@medikoo medikoo closed this Jul 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants