Skip to content
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

google_project_service fails if service is disabled outside of terraform #9841

Closed
Assignees
Labels
bug forward/review In review; remove label to forward service/serviceusage

Comments

@ericnorris
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Terraform v1.0.3
on linux_amd64

Affected Resource(s)

  • google_project_service

Terraform Configuration Files

resource "google_project_service" "shared_vpc_services" {
  for_each = toset(local.apis_to_enable)

  project = var.google_project.number
  service = "${each.value}.googleapis.com"

  disable_on_destroy         = false
  disable_dependent_services = false
}

Debug Output

N/A

Panic Output

N/A

Expected Behavior

The google_project_service resource should have noticed that cloudbuild.googleapis.com was disabled, and tried to re-enable it.

Actual Behavior

│ Error: service cloudbuild.googleapis.com not in enabled services for project 1234567890
│ 
│   with module.google_project_factory["some-identifier"].module.shared_vpc_subnet_access.google_project_service.shared_vpc_services["cloudbuild"],
│   on modules/google-shared-vpc-access/main.tf line 7, in resource "google_project_service" "shared_vpc_services":
│    7: resource "google_project_service" "shared_vpc_services" {

Steps to Reproduce

  1. terraform apply
  2. Disable cloudbuild.googleapis.com
  3. Run terraform plan

Important Factoids

Nothing special about our setup that would affect this.

Taking a look at the code, it looks like this changed ~11 months ago: https://github.com/hashicorp/terraform-provider-google/blame/46a8f7fed32d6ae19895c62edcd06482d47615e7/google/resource_google_project_service.go#L222-L230

Previously the resource did what I would expect: https://github.com/hashicorp/terraform-provider-google/blame/cf7d21afe9bcfed4a544d339cba58c22287cc53e/google/resource_google_project_service.go#L190-L192

I didn't note anything in the changelog (https://github.com/hashicorp/terraform-provider-google/blob/master/CHANGELOG.md) that indicated this change in behavior was expected.

References

None that I could find.

@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 10, 2021
@github-actions github-actions bot added forward/review In review; remove label to forward service/serviceusage labels Jan 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.