awslabs / landing-zone-accelerator-on-aws

Deploy a multi-account cloud foundation to support highly-regulated workloads and complex compliance requirements.
https://aws.amazon.com/solutions/implementations/landing-zone-accelerator-on-aws/
Apache License 2.0
562 stars 448 forks source link

bug: Using StringList replacement doesn't properly work/validate #607

Open mbevc1 opened 1 month ago

mbevc1 commented 1 month ago

Describe the bug When using a StringList from replacements in Array field in other configs validation succeeds, but Prepare fails in the pipeline with:

* /reports/budgets/0/notifications/0/recipients/0 => must be string
* /reports/budgets/0/notifications/1/recipients/0 => must be string
* /reports/budgets/0/notifications/2/recipients/0 => must be string
* /reports/budgets/0/notifications/3/recipients/0 => must be string

To Reproduce Create a variable in replacements-config.yaml:

- key: BudgetEmails
    type: StringList
    value: [ email1@domain.com, email2@domain.com ]

then use it in global-config.yaml:

reports:
  budgets:
    - deploymentTargets:
        accounts:
          - Management
      name: accel-budget
      timeUnit: MONTHLY
      type: COST
      amount: 100
      includeUpfront: true
      includeTax: true
      includeSupport: true
      includeSubscription: true
      includeRecurring: true
      includeOtherSubscription: true
      includeDiscount: true
      includeCredit: false
      includeRefund: false
      useBlended: false
      useAmortized: false
      unit: USD
      notifications:
        - type: FORECASTED
          thresholdType: PERCENTAGE
          threshold: 100
          comparisonOperator: GREATER_THAN
          subscriptionType: EMAIL
          recipients: [ {{ BudgetEmails }} ]

Expected behavior Validation succeeds and so should the pipeline.

Please complete the following information about the solution:

To get the version of the solution, you can look at the description of the created AWS CloudFormation stack used to install the LZA (AWSAccelerator-InstallerStack). For example, "(SO0199) Landing Zone Accelerator on AWS. Version 1.5.1.". If the description does not contain the version information, you can look at the Parameters of the stack for the RepositoryBranchName as that should contain the version number.

Screenshots If applicable, add screenshots to help explain your problem (please DO NOT include sensitive information).

Additional context Add any other context about the problem here.

richardkeit commented 1 month ago

Hi @mbevc1 ,

What happens if you remove the square brace in your config?

Given your replacement is already a list, there may be an off chance it works

mbevc1 commented 1 month ago

Yeah, that was my first attempt, but in that case validator fails saying it's not an Array.