Open danielpeng2 opened 3 months ago
Hi @danielpeng2!
I tried to replicate this issue, but after executing the code the tfstate
file shows the action with the value "DISABLE" indicating that the action was successfully generated without errors. Remember that the default service accounts
are generated by GCP, there aren't custom service accounts like google_service_account
resources that you can create by yourself.
The primary purpose of using action = "DISABLE"
in the google_project_default_service_accounts
resource is to prevent the creation of default service accounts for a GCP project. These default service accounts are system-generated and have broad permissions.
When you set action = "DISABLE"
, Terraform will attempt to prevent the creation of these default service accounts. However, it's important to note that:
Community Note
Terraform Version & Provider Version(s)
Terraform v1.7.5 on linux_amd64
Affected Resource(s)
google_project_default_service_accounts
Terraform Configuration
Debug Output
No response
Expected Behavior
In my GCP project, I have a default service account with the name
Default compute service account
. I expected this service account to be disabled.Actual Behavior
The default service account wasn't disabled.
Looking at the code, it seems like this resource expects a service account with the name
compute engine default service account
. However, in my GCP projects, sometimes this default service account will have a different name (Default compute service account
). I'm not entirely sure what causes the naming to be different, but I believe these accounts are functionally the same and accounts with either name should be disabled by this resource. https://github.com/hashicorp/terraform-provider-google/blob/72ca8f0668ff02a83f46e2ab5e9ee84114a4272f/google/services/resourcemanager/resource_google_project_default_service_accounts.go#L216-L225Steps to reproduce
terraform apply
Important Factoids
No response
References
No response