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

Using parameters in SAM file in DefinitionUri #101

Closed
ghost opened this issue Mar 5, 2017 · 2 comments
Closed

Using parameters in SAM file in DefinitionUri #101

ghost opened this issue Mar 5, 2017 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 5, 2017

Hi, FYI in my SAM file this works:
StageName: !Ref "Env"
DefinitionUri: "swagger-dev.yml"

But this doesn't work:
StageName: !Ref "Env"
DefinitionUri: !Sub "swagger-${Env}.yml"

And this also doesn't work:
StageName: !Ref "Env"
DefinitionUri:
Fn::Join:
- ''
- - "swagger-"
- !Ref: "Env"
- ".yml"

The error I get is:
"FAILED - Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [Api] is invalid. 'DefinitionUri' requires Bucket and Key properties to be specified"

My parameter is defined as:

Parameters:
Env:
Description: The environment id.
Type: String
ConstraintDescription: Can contain only one of the supported environment ids.

@sanathkr
Copy link
Contributor

You should use aws cloudformation package command if you specify local files. Unfortunately package doesn't parse intrinsic functions. So it doesn't concatenate the !Sub before uploading to S3. You should upload your files to S3 yourself and follow https://github.com/awslabs/serverless-application-model/blob/master/HOWTO.md#using-intrinsic-functions to specify Swagger URI using !Sub

@sanathkr
Copy link
Contributor

I don't see aws cloudformation package command supporting full CloudFormation Intrinsics spec anytime. It is a good use-case to use intrinsics for local paths, but very hard for a local tool to provide full fidelity support to intrinsic functions

hawflau added a commit that referenced this issue Mar 28, 2022
* feat: SAM support for /tmp config (#87)

* Add EphemeralStorage field

Add EphemeralStorage as a new option when creating SAM templates. Add functionality to
transform SAM templates with EphemeralStorage to Cloudformation templates. Add /translate
 tests for new field

* Add EphemeralStorage to global configs

* Add EphemeralStorage to global configs

* Add testing for functions with intrinsic refs, add EphemeralStorage to versions

Co-authored-by: Kevin Weng <[email protected]>

* chore: add integration test for /tmp (#101)

* Add integration test for /tmp

Also edit basic_function_event_destinations template file to avoid deprecated runtime error

* Add integration test for /tmp

Also edit basic_function_event_destinations template file to avoid deprecated runtime error

* Revert changes to template runtime and use getters in
test_function_with_ephemeral_storage. Delete duplicated test

* Revert runtime changes

Co-authored-by: Kevin Weng <[email protected]>

Co-authored-by: Kevin Weng <[email protected]>
Co-authored-by: Kevin Weng <[email protected]>
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

1 participant