You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to use gomplate to allow overriding and merging of sections of CloudFormation YAML templates with other YAML sections defined in other files by using the gomplate merge datasource. Unfortunately, gomplate drops the AWS-specific YAML tags in the merged output, breaking the template.
Example:
cloudfront_template.yaml:
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: A gomplate test
Parameters:
MyParameter:
Type: String
Globals:
Function:
Environment:
Variables:
MY_PARAMETER: !Ref MyParameter
AWSTemplateFormatVersion: 2010-09-09T00:00:00Z
Description: A gomplate test
Globals:
Function:
Environment:
Variables:
MY_OTHER_PARAMETER: my_other_value
MY_PARAMETER: MyParameter
Parameters:
MyParameter:
Type: String
Transform: AWS::Serverless-2016-10-31
Note in the output that MY_PARAMETER: !Ref MyParameter has not been preserved and instead has been transformed into MY_PARAMETER: MyParameter, losing the !Ref tag.
Is there any way to get gomplate to preserve all HTML tags in the output, or to provide a list of tags to preserve?
The text was updated successfully, but these errors were encountered:
greg-caffeine
changed the title
Gomplete not preserving AWS-specific custom YAML tags on merge
Gomplate not preserving AWS-specific custom YAML tags on merge
Feb 14, 2024
Custom YAML tags are something that are going to be pretty difficult to support with gomplate. The main problem is that internally the data is parsed into an intermediate form which is a map with nested maps, and so something like the above would be parsed into (in JSON terms) {"MY_PARAMETER": "MyParameter"}, with no ability to retain custom tags.
You may be able to accomplish this if you instead reframe the approach and build a template out of cloudfront_template.yaml rather than using it as part of a datasource.
Hmm... There may actually be a possibility to use a different intermediate format, as hinted at by go-yaml/yaml#191 (comment), but it's unclear exactly how. I'd need to find some time to dig into this deeper.
This issue is stale because it has been open for 60 days with no
activity. If it is no longer relevant or necessary, please close it.
Given no action, it will be closed in 14 days.
If it's still relevant, one of the following will remove the stale
marking:
A maintainer can add this issue to a milestone to indicate that
it's been accepted and will be worked on
I would like to use gomplate to allow overriding and merging of sections of CloudFormation YAML templates with other YAML sections defined in other files by using the gomplate
merge
datasource. Unfortunately, gomplate drops the AWS-specific YAML tags in the merged output, breaking the template.Example:
cloudfront_template.yaml:
cloudfront_overrides.yaml:
Gomplate Command
% gomplate -d 'merger=merge:cloudfront_template.yaml|cloudfront_overrides.yaml' -i '{{ include "merger" }}'
OUTPUT
Note in the output that
MY_PARAMETER: !Ref MyParameter
has not been preserved and instead has been transformed intoMY_PARAMETER: MyParameter
, losing the!Ref
tag.Is there any way to get gomplate to preserve all HTML tags in the output, or to provide a list of tags to preserve?
A list of AWS custom tags can be found here.
The text was updated successfully, but these errors were encountered: