unbounce / iidy

iidy (Is it done yet?) -- CloudFormation with Confidence
MIT License
52 stars 7 forks source link

iidy render `!Not [!Equals ]` produces invalid YAML for CloudFormation #262

Closed rymndhng closed 2 years ago

rymndhng commented 3 years ago

Expected

Input Template untouched

Actual

Template pre-processed unexpectedly and CloudFormation is not happy with it.

Input Template

Conditions:
  CreateAlarms: !Equals [ !Ref CreateAlarms, "yes" ]
  InitialNoop: !Equals [ !Ref CodePath, "initial-noop" ]
  CreateStreamAlarms: !Equals [ !Ref CreateAlarms, "yes" ]
  InVpc:
    !Not [!Equals [!Ref VpcStackName, "" ]]

Result

❯ iidy render invalid_expansion.yml
Conditions:
  CreateAlarms: !Equals
    - !Ref CreateAlarms
    - 'yes'
  InitialNoop: !Equals
    - !Ref CodePath
    - initial-noop
  CreateStreamAlarms: !Equals
    - !Ref CreateAlarms
    - 'yes'
  InVpc: !Not
    _data:
      - !Ref VpcStackName
      - ''
    visited: false
    ctor: !<tag:yaml.org,2002:js/function> |-
      class AnonTag extends Tag {
              constructor() {
                  super(...arguments);
                  this.tag_name = tag_name;
              }
          }
    tag_name: Equals
rymndhng commented 3 years ago

I've used the !$escape workaround to bypass this issue for now.