Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Allow option for Conditions to not be evaluated at compile time #221

Closed
smithhannahm opened this issue Sep 10, 2019 · 2 comments
Closed

Comments

@smithhannahm
Copy link

If I am writing a template with conditions, on compile Goformation automatically processes the condition into a true/false output. For example, this:

template.Parameters["Environment"] = &parameter{
	Type:          "String",
	Description:   "The type of environment the VPC will host",
	Default:       "dev",
	AllowedValues: []string{"dev", "prod"},
}
template.Conditions["IsProduction"] = cloudformation.Equals(cloudformation.Ref("Environment"), "prod")

produces:

  "Conditions": {
    "IsProduction": false
  },
  "Parameters": {
    "Environment": {
      "AllowedValues": [
        "dev",
        "prod"
      ],
      "Default": "dev",
      "Description": "The type of environment the VPC will host",
      "Type": "String"
    },

While I would like it to produce this:

  "Conditions": {
    "IsProduction": {
      "Fn::Equals": [
        {"Ref": "Environment"},
        "prod"
      ]
  },
  "Parameters": {
    "Environment": {
      "AllowedValues": [
        "dev",
        "prod"
      ],
      "Default": "dev",
      "Description": "The type of environment the VPC will host",
      "Type": "String"
    },
smithhannahm added a commit to smithhannahm/goformation that referenced this issue Sep 16, 2019
@JerzyLa
Copy link
Contributor

JerzyLa commented Nov 14, 2019

@smithhannahm Can you make Pull Request with this commit? I have tested it in my project and works fine.

@PaulMaddox
Copy link
Contributor

Included in release v4.3.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants