terraform-google-modules / terraform-google-project-factory

Creates an opinionated Google Cloud project by using Shared VPC, IAM, and Google Cloud APIs
https://registry.terraform.io/modules/terraform-google-modules/project-factory/google
Apache License 2.0
835 stars 538 forks source link

Bootstrap error copying Terraform state to Cloud Storage #826

Closed jtblin closed 1 year ago

jtblin commented 1 year ago

TL;DR

In the step "Re-run terraform init. When you're prompted, agree to copy Terraform state to Cloud Storage."

I get the following error:


Initializing the backend...
Initializing modules...
╷
│ Error: Error inspecting states in the "local" backend:
│     querying Cloud Storage failed: storage: bucket doesn't exist```

Note that in the previous step (10), there was an error and there was no "UPDATE_PROJECTS_BACKEND" placement. Maybe this is related and I need to create a project manually to store Terraform state in a bucket?

### Expected behavior

State is saved to the bucket

### Observed behavior

_No response_

### Terraform Configuration

```hcl
My backend.tf looks like

terraform {
  backend "gcs" {
    bucket = "bkt-prj-b-seed-tfstate-7030"
    prefix = "terraform/bootstrap/state"
  }
}

### Terraform Version

```sh
Terraform v1.5.0
on darwin_arm64
+ provider registry.terraform.io/hashicorp/external v2.3.1
+ provider registry.terraform.io/hashicorp/google v4.69.1
+ provider registry.terraform.io/hashicorp/google-beta v4.69.1
+ provider registry.terraform.io/hashicorp/null v3.2.1
+ provider registry.terraform.io/hashicorp/random v3.5.1
+ provider registry.terraform.io/hashicorp/time v0.9.1

Additional information

No response

jtblin commented 1 year ago

Meant to open in https://github.com/terraform-google-modules/terraform-example-foundation/