Skip to content

Conversation

@gorge511
Copy link
Contributor

@gorge511 gorge511 commented Nov 6, 2025

BREAKING CHANGE: Terraform will remove the IAM for cloudservices service agent and return it on the next run. Can be avoided with removing all the duplicated IAM resources from terraform state manually.

Previous code was creating duplicated IAM for cloudservices service agent. It doesn't matter when creating, but it matters when removing api from active apis list. Then it remove all the IAM for the cloudservices service agent and it gets fixed only with subsequent terraform apply.

See the plan below with two active apis. It creates two identical iam_member resources.

# module.shared_vpc_access.google_compute_subnetwork_iam_member.cloudservices_shared_vpc_subnet_users[0] will be created
+ resource "google_compute_subnetwork_iam_member" "cloudservices_shared_vpc_subnet_users" {
    + etag       = (known after apply)
    + id         = (known after apply)
    + member     = "serviceAccount:[email protected]"
    + project    = "my-host-project-1234"
    + region     = "europe-west1"
    + role       = "roles/compute.networkUser"
    + subnetwork = "subnet1"
  }
# module.shared_vpc_access.google_compute_subnetwork_iam_member.cloudservices_shared_vpc_subnet_users[1] will be created
+ resource "google_compute_subnetwork_iam_member" "cloudservices_shared_vpc_subnet_users" {
    + etag       = (known after apply)
    + id         = (known after apply)
    + member     = "serviceAccount:[email protected]"
    + project    = "my-host-project-1234"
    + region     = "europe-west1"
    + role       = "roles/compute.networkUser"
    + subnetwork = "subnet1"
  }

@gorge511 gorge511 requested review from a team and imrannayer as code owners November 6, 2025 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant