caf-terraform-landingzones
caf-terraform-landingzones copied to clipboard
fix(caf_solution/locals.remote_tfstates.tf): changing order of global…
…_settings within the merge function
- when reading global_settings the current landingzone global_settings block should be given preference. Since a merge function is used, the order of items in the map are important. - global_settings from reference tfstate files should only be included if global_settings_key =
is defined. - hence, reading global_settings from first tfstate is removed. try(data.terraform_remote_state.remote[keys(var.landingzone.tfstates)[0]].outputs.global_settings, null), - updated tags - tags defined in global_settings {} or custom_variables {} must have highest precedence.
Issue-id: 403
PR Checklist
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
- [x] My code follows the code style of this project.
- [x] I ran lint checks locally prior to submission.
- [x] Have you checked to ensure there aren't other open Pull Requests for the same update/change?
Description
When defining global_settings block for a given landingzone, the current landingzone should take precedence over global_settings defined in lower/other current landingzones. Also, the global_settings should only be imported when global_settings_key is defined. Since a merge function is used, the order of items in the map are important.
- when reading global_settings the current landingzone global_settings block should be given preference. Since a merge function is used, the order of items in the map are important.
- global_settings from reference tfstate files should only be included if global_settings_key =
is defined. - hence, reading global_settings from first tfstate is removed. try(data.terraform_remote_state.remote[keys(var.landingzone.tfstates)[0]].outputs.global_settings, null),
Does this introduce a breaking change
- [X ] YES [Potentially]
- [ ] NO
Testing
Create a landingzone with global_settings [passthrough = true;] Create another landingzone with global_settings [passthrough = false; prefix=xyz] Now withing the landingzone.tfvars, reference the 1st landingzone within the tfstate block.