aws / aws-extensions-for-dotnet-cli

Extensions to the dotnet CLI to simplify the process of building and publishing .NET Core applications to AWS services
Apache License 2.0
369 stars 86 forks source link

Support Template Substitutions in YAML files, regardless #312

Closed zaus closed 1 month ago

zaus commented 2 months ago

Describe the feature

Just like https://github.com/aws/aws-extensions-for-dotnet-cli/issues/116 would like to use template substitutions with YAML configuration files.

Use Case

Specifically trying to transclude Step Function State Machine DefinitionString which just needs to smush the contents of a separate JSON file into the YAML, no special processing necessary.

Proposed Solution

Remove the templatebody type check, and just warn if it's not JSON. i.e. make it obvious enough to the user that it's their own fault for trying it.

Other Information

No response

Acknowledgements

Targeted .NET platform

.NET 6+

CLI extension version

Package Id                      Version      Commands
------------------------------------------------------------------------
amazon.lambda.testtool-3.1      0.10.0       dotnet-lambda-test-tool-3.1
amazon.lambda.tools             5.10.4       dotnet-lambda
dotnet-xscgen                   2.0.662      xscgen

Environment details (OS name and version, etc.)

Windows 10

ashishdhingra commented 2 months ago

@zaus Good afternoon. Could you please advise if this is a duplicate of https://github.com/aws/aws-extensions-for-dotnet-cli/issues/116 or if your scenario is different? Or is it to provide some kind of warning in the output?

Thanks, Ashish

zaus commented 2 months ago

Slight nuance differs from #116 -- rather than properly support it with whatever that entails, I'm just looking for it to stuff the contents of another file (verbatim is fine?) into the main template. I'm hoping that current functionality will be sufficient for my purposes -- just get the JSON string from another file into the YAML, although being able to transclude other YAML snippets would be nice too.

ashishdhingra commented 2 months ago

@zaus Good morning. Discussed the issue with the team. Could you please advise if the issue https://github.com/aws/aws-extensions-for-dotnet-cli/issues/314 is fixed, then this issue could be closed!

zaus commented 2 months ago

Yes that would solve my specific issue.

I still think transclusion regardless of template format would be a neat feature. Ideally something like how Serverless Framework variables can pull from other files, but without bothering to parse the external file for specifics, just embed the file contents where requested.

With this you could split deployment files into separate components (like reusing a file declaring all the Powertools environment variables instead of copy-pasting each time)

ashishdhingra commented 1 month ago

For YAML parsing, we are relying on Yaml.NET and that package doesn't have support for JSONPath or it's equivalent. Hence, closing this issue.

github-actions[bot] commented 1 month ago

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.