Skip to content

auto_create_network=false requires "Compute Engine API" to be enabled or it fails project creation. #978

@andrew-j-hagner

Description

@andrew-j-hagner

TL;DR

auto_create_network=false requires "Compute Engine API" to be enabled or it fails project creation and, at least occasionally, leaves terraform in a non-reapply-able state until manually resolved.

Expected behavior

auto_create_network=false should probably auto-enable the required API(s?) and wait for it, or at the very least the documentation should note the dependency and possible required wait time.

Observed behavior

Error: Error deleting default network in project [REDACTED]: googleapi: Error 403: Compute Engine API has not been used in project [REDACTED] before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/compute.googleapis.com/overview?project=[REDACTED] then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

Terraform Configuration

module "<<REDACTED>>-project" {
  source   = "terraform-google-modules/project-factory/google"
  version  = "~> 14.0"

  name                    = <<REDACTED>>
  auto_create_network     = false
  billing_account         = var.billing_account
  org_id                  = var.org_id
  create_project_sa       = false
  default_service_account = "disable"
  folder_id               = <<REDACTED>>
  random_project_id       = true
  activate_apis = [
    "billingbudgets.googleapis.com",
    "cloudbilling.googleapis.com",
  ]
}

Terraform Version

1.7.5

Terraform Provider Versions

google-beta v4.41.0
google v4.41.0

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions