-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve diff output when changing google_bigquery_dataset.access
#4085
Comments
Hmm - this might actually just be an upstream issue, since we don't have any control over how the diffs are generated. On the other hand, it might be that the hashkey for the access item in the set changes when you remove one, which shouldn't be happening and would be something to fix on our end? TF 0.12 did also change the way set items are output (instead of outputting with the hashkey like I'll need to repro to confirm whether it's an issue on our end or not, so I'll get back to you with a potential fix or file a bug against upstream. |
Hey, thanks for looking into this! We only recently switched to 0.12 and we had that issue in 0.11 already. There I could see that it was like you described, the hash key changed. Which is strange because from what I can see the algos check out and the entries are hashed individually. But I'm not a go programmer and cannot properly debug this... |
I found hashicorp/terraform#21901 So instead of: resource "google_bigquery_dataset" "warehouse" {
dataset_id = "warehouse"
location = var.project_location
dynamic "access" {
for_each = local.warehouse_access
content {
role = access.value.role
group_by_email = lookup(access.value, "group_by_email", null)
user_by_email = lookup(access.value, "user_by_email", null)
}
}
} I do resource "google_bigquery_dataset" "warehouse" {
dataset_id = "warehouse"
location = var.project_location
dynamic "access" {
for_each = local.warehouse_access
content {
role = access.value.role
group_by_email = lookup(access.value, "group_by_email", "")
user_by_email = lookup(access.value, "user_by_email", "")
special_group = ""
domain = ""
dynamic "view" {
for_each = []
content {
project_id = ""
dataset_id = ""
table_id = ""
}
}
}
}
} to get the desired output. |
Error occurs during the first
|
@swenzel You appear to have found the root cause already :) This is definitely not something we are able to address within the provider code given the current state of the SDK. The upstream issue will possibly fix this but I suspect we might need to wait until the next version of the SDK is released first. I'm going to close this as a duplicate of #3929 so that we can concentrate discussions in one place. @edwardmedia I think what you are seeing isn't related to the original issue here. If you have found a bug can you open a new issue? |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Community Note
Terraform Version
google provider and google provider beta are at 2.11.0
terraform version is 0.12.5
Affected Resource(s)
Terraform Configuration Files
click to expand
bigquery.tf
main.tf
variables.tf
Debug Output
Don't think this is necessary, but I will provide it if requested.
Expected Behavior
When changing
local.warehouse_access
and then runningterraform plan
orterraform apply
I want to see the actual changes:Actual Behavior
terraform plan
suggests that it will delete and recreate all other access entries too:Steps to Reproduce
terraform apply
user_by_email = google_service_account.object_owner.email
to
user_by_email = google_service_account.new_object_owner.email
terraform plan
Important Factoids
none
References
The text was updated successfully, but these errors were encountered: