Skip to content
Latchkey

Terragrunt "Missing required argument" from generated backend in CI

Terraform validated the backend Terragrunt generated from remote_state.config and found a required argument missing. The remote_state block left out something the backend needs, such as the bucket, key, or region for S3.

What this error means

terragrunt init fails with "Error: Missing required argument" naming a backend attribute (for example key), pointing at the generated backend.tf.

terragrunt
Error: Missing required argument

  The argument "key" is required, but no definition was found.
  on backend.tf line 2, in terraform:
   2:   backend "s3" {}

Common causes

remote_state.config omits a required key

The backend needs bucket, key, and region (for S3), but one was left out of the config map, so the generated block is incomplete.

A conditional expression evaluated to null

A config value computed from a local or dependency resolved to null/empty, so the required argument is effectively absent.

How to fix it

Supply every required backend argument

  1. Read which argument Terraform says is missing.
  2. Add it to remote_state.config.
  3. Re-run init so the generated backend is complete.
terragrunt.hcl
remote_state {
  backend = "s3"
  config = {
    bucket = "acme-tfstate"
    key    = "${path_relative_to_include()}/terraform.tfstate"
    region = "us-east-1"
  }
}

Guard computed values so they are never null

Ensure locals or dependency outputs feeding the config always resolve to a non-empty string.

How to prevent it

  • Define bucket, key, and region for every remote_state backend.
  • Use path_relative_to_include() for a unique, always-present key.
  • Validate the config in CI before init runs across the stack.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →