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

Translate local file strings to AWS::Include transform #160

Closed
jdub opened this issue Jul 18, 2017 · 4 comments
Closed

Translate local file strings to AWS::Include transform #160

jdub opened this issue Jul 18, 2017 · 4 comments

Comments

@jdub
Copy link

jdub commented Jul 18, 2017

There are quite a few issues on this repo related to variable substitution in separate YAML files, particularly dealing with x-amazon-apigateway-integration's uri parameter.

What if, instead of aws cloudformation package translating a local file string to an s3:// URI, it translated it to an AWS::Include transform?

This SAM / CloudFormation template:

Resources:
  Api:
    Properties:
      DefinitionUri: ./swagger.yaml

… currently translates to:

Resources:
  Api:
    Properties:
      DefinitionUri: s3://bucket/swagger.yaml

… but could instead translate to:

Resources:
  Api:
    Properties:
      DefinitionBody:
        Fn::Transform:
          Name: AWS::Include
          Parameters:
            Location: s3://bucket/swagger.yaml
@sanathkr
Copy link
Contributor

sanathkr commented Aug 1, 2017

I am not sure. Inlining swagger file has some limitations:

  • Customers might run into their CloudFormation template size limitations
  • You would include CloudFormation constructs (like intrinsics or resource names) in your Swagger file, which makes it harder to share with others

Instead, it would be better to extend aws cloudformation package command to support S3 upload functionality for AWS::Include property. Customers can then choose to use the Include style if they want.

What do you think? This should be simple change to make the CLI. Want to send a PR?

@jdub
Copy link
Author

jdub commented Aug 1, 2017

Ah, I didn't consider the template size limitations. That does make it awkward.

Unfortunately, using CloudFormation constructs was part of my goal. 😅

Right now, Swagger files need hard-coded Lambda Function ARNs in, for example, x-amazon-apigateway-integration.uri, which benefit greatly from AWS::Region and Function.Arn references:

paths:
  /debug:
    get:
      x-amazon-apigateway-integration:
        httpMethod: POST
        type: "aws_proxy"
        uri:
          Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${DebugFunction.Arn}/invocations
      responses: {}

@sanathkr
Copy link
Contributor

Closing this because it has been out for a while without gathering much interests.

@ekcrisp
Copy link

ekcrisp commented Jul 10, 2018

@sanathkr

Instead, it would be better to extend aws cloudformation package command to support S3 upload functionality for AWS::Include property. Customers can then choose to use the Include style if they want.

any updates on this?

EDIT: I submitted a PR for this feature

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

No branches or pull requests

3 participants