Azure / caf-terraform-landingzones

This solution, offered by the Open-Source community, will no longer receive contributions from Microsoft. Customers are encouraged to transition to Microsoft Azure Verified Modules for continued support and updates from Microsoft. Please note, this repository is scheduled for decommissioning and will be removed on July 1, 2025.
https://github.com/aztfmod/caf-terraform-landingzones
MIT License
763 stars 662 forks source link

[bug] global_settings order of preference. #403

Open nusrath432 opened 2 years ago

nusrath432 commented 2 years ago

Describe the bug 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 is important.

To Reproduce Steps to reproduce the behaviour: Create a landingzone with global_settings [passthrough = true;] Create another landingzone with global_settings [passthrough = false; prefix=xyz] Now within the landingzone.tfvars, reference the 1st landingzone within the tfstate block.

Expected behavior passthrough = false, prefix = xyz should take preference and the resources should not be destroy by referencing to lower tfstate.

Pull Request [Global_settings precedence] https://github.com/Azure/caf-terraform-landingzones/pull/448

nusrath432 commented 2 years ago

Note: Until this issue is addressed, as a work around, we can define the following block, to override the lower level passthrough=true

custom_variables = {
  passthrough = false
}

This way, the resources will not be destroyed when we reference lower level TF state file.

Remember we have to override not just passthrough but all those values that cause a difference between global_settings {} vs custom_variables {} blocks. For example: prefixes, random_length etc

nusrath432 commented 1 year ago

@arnaudlh @LaurentLesle Could you share your thoughts on this issue please

Do we have any Roadmap or Project board for this project to track - it is a while since we had any new release.