Skip to main content
Knowledge Base

run-all plan always reports 'Error: Backend initialization required'

Answer

Hello. I have a simple setup of one root module calling one local module and two environments. ``` ./terragrunt.hcl ./env1/terragrunt.hcl ./env2/terragrutn.hcl ``` env1 works fine with run-all. env2 plan always returns `Error: Backend initialization required, please run "terraform init"` even after running run-all init successfully. Even after removing `.terraform.lock.hcl` and `.terragrunt-cache` and running run-all init successfully. I'm using terragrunt 0.46.3 and terraform 1.4.6. What might the problem be? ``` $ cat terragrunt.hcl terraform { before_hook "before_hook" { commands = ["apply", "plan", "validate"] execute = ["tflint", "--minimum-failure-severity=error", "--config", "${get_path_to_repo_root()}/.tflint.hcl"] } } generate "provider" { path = "provider.tf" if_exists = "overwrite" contents = <<EOF provider "azurerm" { features {} subscription_id = "xxxxxxxxx" } EOF } remote_state { backend = "s3" disable_init = true # Bucket is managed by another terraform root-module # disable_dependency_optimization = true config = { bucket = "prod-azure-ece01-tf-state" dynamodb_table = "prod-azure-ece01-tf-state" region = "eu-west-1" role_arn = "arn:aws:iam::xxxxxxxxx:role/OperatorAccess" encrypt = true profile = "terraform" key = "${path_relative_to_include()}" s3_bucket_tags = { owner = "sre" maintainer = "terraform" purpose = "ece environments" repo = "https://github.com/xxxxxxx" } } generate = { path = "backend.tf" if_exists = "overwrite" } } ``` ``` cat env2/terragrunt.hcl include "dev" { path = find_in_parent_folders() } terraform { source = "../..//root-modules/ece_env" } inputs = { .... } ``` --- <ins datetime="2023-06-15T13:53:02Z"> <p><a href="https://support.gruntwork.io/hc/requests/110258">Tracked in ticket #110258</a></p> </ins>

From this bug https://github.com/gruntwork-io/terragrunt/issues/1422 it seems that `disable_init` means both don't generate the backend bucket *and* don't generate the state file in the bucket. Indeed if I set this to false (the default) I don't have the OP problem. I don't feel this setting should do what it does.