Open simonmcc opened 5 years ago
This turns out to be a bug directly in helper/schema
, and has nothing really to do with for_each
at all. The addition of features like for_each
have only made it easier to hit this condition.
If an optional+computed set is unknown during plan, helper/schema
produces no diff for that attribute, which causes the plan to keep the same attributes. Even though we allow the legacy SDK to override attributes during apply in some cases, a set data structure is forced to adhere to the plan because there is no way to determine which elements are incorrect in order to stabilize on a clean plan.
Terraform Version
Terraform Configuration Files
Debug Output
N/A
Crash Output
N/A
Expected Behavior
Adding a new user to AAD will also update the group member list as required.
Actual Behavior
On the first run, users & groups are created as expected, but on subsequent work (i.e. adding a new user), the new user is created on the first pass & the set of members will be updated on the second pass. (members list can't be calculated until the azuread_user is created & the UUID known)
Steps to Reproduce
az cloud set --name AzureCloud
az login
terraform init
terraform apply
- users created, group created, users added to group: https://gist.github.com/simonmcc/ef1e01d34116f11f607a62d5c3df7ce7smccartney_test3 = { superuser = ["dv1", "us2"] }
terraform apply
- user gets created, but not added to group: https://gist.github.com/simonmcc/cbe2b879cbd6e6d428e879eb0e3eb61aterraform apply
- group gets updated, addingsmccartney_test3
's UUID: https://gist.github.com/simonmcc/726ef4a939e555019a6e942342340f43References