hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
42.32k stars 9.49k forks source link

Terraform GCP cannot create any resource with error accessNotConfigured (SA has owner permissions) #29006

Closed ghost closed 3 years ago

ghost commented 3 years ago

Description

I'm having issues creating a GCP compute engine using terraform. I have enabled the cloudbilling.googleapis.com and cloudresourcemanager.googleapis.com. I also have verified my service account is able to list zones in the project I am working on. However I am still getting the annoying error,

Error: Error loading zone 'us-central1-a': googleapi: Error 403: Compute Engine API has not been used in project 406281436678 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/compute.googleapis.com/overview?project=406281436678 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry., accessNotConfigured

Terraform Version

Terraform v0.15.5

Affected Resource(s)

Please list the resources as a list, for example:

google_compute_instance

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this. Terraform Configuration Files

Expected Behavior

Already configured project does not allow me to create any resource.

Actual Behavior

What actually happened?

Errors occur when creating resources that are depending on another resource that terraform is in the process of creating.

Error: Error loading zone 'us-central1-a': googleapi: Error 403: Compute Engine API has not been used in project 406281436678 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/compute.googleapis.com/overview?project=406281436678 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry., accessNotConfigured

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

Create a GCP project from scratch 
Errors when creating google_compute_subnetwork, google_compute_network, google_compute_instance.
Plan runs as expected
Apply fails with the error mentioned twice before
ghost commented 3 years ago

I am sorry, this is not an issue. I had a duplicate project. I was targeting the one without billing enabled.

github-actions[bot] commented 3 years ago

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.