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

ytt strips out AWS SAM template !Ref, !Sub, etc. directives out of my values #104

Closed
SnarfleBunny opened this issue Mar 8, 2020 · 2 comments
Labels
helping with an issue Debugging happening to identify the problem

Comments

@SnarfleBunny
Copy link

SnarfleBunny commented Mar 8, 2020

Is there a way I can keep those in the output YAML?

I have a subdir named etc/ which has this file in it:

#@ load("@ytt:data", "data")
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: FOS REST API

#! Parameters

Parameters:

  DeployEnv:
    Type: String
    Default: #@ data.values.deploy_env
  UsagePlanType:
    Type: String
    Default: PER_API

#! Conditions

#! Globals

Globals:
  HttpApi:
    Auth:
      ApiKeyRequired: true
      UsagePlan:
        CreateUsagePlan: !Ref UsagePlanType

#! Resources

Resources:


  FosRestApi:
    Type: AWS::Serverless::HttpApi
    Properties:
      StageName: !Ref DeployEnv


#! Outputs

Here is values.yml:

#@data/values
---
deploy_env: dev

The following is what it produces:

AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: FOS REST API
Parameters:
  DeployEnv:
    Type: String
    Default: dev
  UsagePlanType:
    Type: String
    Default: PER_API
Globals:
  HttpApi:
    Auth:
      ApiKeyRequired: true
      UsagePlan:
        CreateUsagePlan: UsagePlanType
Resources:
  FosRestApi:
    Type: AWS::Serverless::HttpApi
    Properties:
      StageName: DeployEnv

You will notice all the !Ref s are removed from the output. How do I let those directives remain in the output?

@cppforlife
Copy link
Contributor

this seems like same issue as this: #74. here is a possible workaround i have mentioned #74 (comment). currently ytt doesnt have ability to preserve custom tags, hence it wouldnt work with above example.

@cppforlife cppforlife added the helping with an issue Debugging happening to identify the problem label Mar 8, 2020
@cppforlife
Copy link
Contributor

closing this one, keeping #74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
helping with an issue Debugging happening to identify the problem
Projects
None yet
Development

No branches or pull requests

2 participants