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

RequestMappingTemplateS3Location does not work with Fn::If #1138

Open
fcobia opened this issue Apr 18, 2019 · 3 comments
Open

RequestMappingTemplateS3Location does not work with Fn::If #1138

fcobia opened this issue Apr 18, 2019 · 3 comments
Labels

Comments

@fcobia
Copy link

fcobia commented Apr 18, 2019

I have a template for an AppSync Pipeline Function that references a different template depending on a condition. While SAM normally translates the location to the proper s3 location, it does not work if I have an Fn::If.

I would have expected that SAM would translate both locations specified in the Fn::If.

Example:

  EnvironmentPipelineFunc:
    Type: "AWS::AppSync::FunctionConfiguration"
    Condition: IsProd
    Properties:
      Name: "Environment"
      RequestMappingTemplateS3Location: !If [IsProd, "prodRequest.vm", "testRequest.vm"]
      ResponseMappingTemplateS3Location: !If [IsProd, "prodResponse.vm", "testResponse.vm"]
      DataSourceName: !GetAtt "VTLDataSource.Name"
      FunctionVersion: "2018-05-29"
      ApiId: !GetAtt "API.ApiId"
@jlhood
Copy link
Contributor

jlhood commented Apr 19, 2019

Hi @fcobia. You're correct that SAM does not currently support Fn::If used with local file paths. This local path support is really a SAM CLI feature so I'll have the issue transferred to the SAM CLI GitHub repo.

As a side note, in your example, you have Condition: IsProd on your entire EnvironmentPipelineFunc resource so it doesn't seem to make sense to have the Fn::If within that resource use IsProd as the condition since if that's false, the entire resource won't exist in the deployment.

@fcobia
Copy link
Author

fcobia commented Apr 19, 2019

Sorry about the condition. That was actually part of my fix and I left it in. What I ended up doing was creating two resources with a condition so that only the correct one is created, but that also means everywhere I reference the resource, I have to put an Fn::If to make sure I reference the correct resource. So I have a lot of Ifs instead of a single one.

@jlhood
Copy link
Contributor

jlhood commented Apr 19, 2019

Ok makes sense. Just wanted to point it out in case you weren't aware! 😊

@sanathkr sanathkr transferred this issue from aws/serverless-application-model Apr 19, 2019
@jfuss jfuss added area/package sam package command type/feature Feature request labels Apr 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants