org-formation / org-formation-cli

Better than landingzones!
MIT License
1.4k stars 129 forks source link

!GetAtt not working in Tags on update-stack task #491

Open mgorski-mg opened 1 year ago

mgorski-mg commented 1 year ago

Subject of the issue

I'm trying to copy the tag from CurrentAccunt to the stack level tag.

organization.yml:

ExampleAccount:
  Type: OC::ORG::Account
  Properties:
    AccountName: Sample
    RootEmail: sample@sample.com
    Tags:
      environment: prod

tasks.yml:

Parameters:
  EnvParam:
    Type: String

Examplestack:
  Type: update-stacks
  Template: ./sample.yml
  StackName: sample
  DefaultOrganizationBindingRegion: us-east-1
    DefaultOrganizationBinding:
    Account:
      - !Ref ExampleAccount
      - !Ref ExampleAccount2
      - !Ref ExampleAccount3
  Parameters:
    environment: !GetAtt CurrentAccount.Tags.environment
  Tags:
    environment: !GetAtt CurrentAccount.Tags.environment
    environment2: !Ref EnvParam

Instead of performing !GetAtt function, it converts value into JS object. It works properly for Parameters. For Tags it seems to work only with Parameters and !Ref function.

Your environment

Steps to reproduce

Just add Tag like mentioned to update-stack task.

Expected behaviour

Function !GetAtt should be performed and the tag environment should be reused from CurrentAccount.

Actual behaviour

!GetAtt CurrentAccount.Tags.environment is changed to JS object.