5

Fixing reported error from terragrunt

 2 years ago
source link: https://donghao.org/2022/10/28/fixing-reported-error-from-terragrunt/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Fixing reported error from terragrunt

When using “terragrunt init”, an error jumped out:

DEBU[0002] Remote state GCS bucket prokyon-systems-state-bucket does not exist. Attempting to create it  prefix=[/data/proj/prokyon-systems/auto-accountant/infra/non-prod/europe-central/dev/storage-bucket] 
ERRO[0002] Missing required GCS remote state configuration project 
ERRO[0002] Unable to determine underlying exit code, so Terragrunt will exit with error code 1
Plain Text
DEBU[0002] Remote state GCS bucket prokyon-systems-state-bucket does not exist. Attempting to create it  prefix=[/data/proj/prokyon-systems/auto-accountant/infra/non-prod/europe-central/dev/storage-bucket] 
ERRO[0002] Missing required GCS remote state configuration project 
ERRO[0002] Unable to determine underlying exit code, so Terragrunt will exit with error code 1

This error looks a little confusing because my attention was completely drawn by the “remote state configuration”. Where could I find the “remote state configuration”? Then I found it in “terragrunt.hcl”:

remote_state {
  backend = "gcs"
  config = {
    bucket  = "my_bucket"
    prefix  = "my_prefix/terraform.tfstate"
  }
}
Plain Text
remote_state {
  backend = "gcs"
  config = {
    bucket  = "my_bucket"
    prefix  = "my_prefix/terraform.tfstate"
  }
}

Which “configuration” did I miss? I went through a long way to finally realize that the plain word “project” at the end of the sentence “Missing required GCS remote state configuration project” is the most important one (this article). I just need to add a configuration item “project” in the “terragrunt.hcl”:

remote_state {
  backend = "gcs"
  config = {
    project = "gcp_project_id"
    bucket  = "my_bucket"
    prefix  = "my_prefix/terraform.tfstate"
  }
}
Plain Text
remote_state {
  backend = "gcs"
  config = {
    project = "gcp_project_id"
    bucket  = "my_bucket"
    prefix  = "my_prefix/terraform.tfstate"
  }
}

Related Posts

October 28, 2022 - 2:29 RobinDong ops
terragrunt
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Comment *

Name *

Email *

Website

Save my name, email, and website in this browser for the next time I comment.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK