Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Error: no project value set. project_id must be set at the resource level, or a default project value must be specified on the provider #55

Open
6aKa opened this issue Aug 3, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@6aKa
Copy link

6aKa commented Aug 3, 2022

TL;DR

locals {
  app_artifact_repo = "test-app-image-repo"
  region            = "europe-west3"
  project_id        = "test"
}

module "gcr-cleaner" {
  source  = "mirakl/gcr-cleaner/google"
  version = "1.3.0"

  gar_repositories = [
    {
      name       = local.app_artifact_repo
      region     = local.region
      project_id = local.project_id
    }
  ]
}

I got error from terraform

│ Error: no project value set. `project_id` must be set at the resource level, or a default `project` value must be specified on the provider
│
│   with module.gcr-cleaner.data.google_project.this,
│   on .terraform/modules/gcr-cleaner/data.tf line 2, in data "google_project" "this":
│    2: data "google_project" "this" {}

and from terragrunt

│ Error: project: required field is not set
│
│   with data.google_project.this,
│   on data.tf line 2, in data "google_project" "this":
│    2: data "google_project" "this" {}

I don't want specify project in the provider configuration, because module use from terragrunt with multiple projects. How I can set project_id on resource level?

Expected behavior

No response

Observed behavior

No response

Terraform Configuration

default

Terraform Version

Terraform v1.2.5
on darwin_amd64
+ provider registry.terraform.io/hashicorp/google v4.31.0
+ provider registry.terraform.io/hashicorp/google-beta v4.31.0

Your version of Terraform is out of date! The latest version
is 1.2.6. You can update by downloading from https://www.terraform.io/downloads.html

Additional information

No response

@6aKa 6aKa added the bug Something isn't working label Aug 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant