hashicorp/terraform · error

address argument is required

Error message

address argument is required

What it means

The HTTP backend's Configure() requires an 'address' (the REST endpoint URL where state is GET/PUT). It's resolved from the config attribute or the TF_HTTP_ADDRESS env var with an empty-string default; if the result is empty, the backend cannot construct any URL and refuses to configure.

Source

Thrown at internal/backend/remote-state/http/backend.go:127

			},
		},
	}
}

type Backend struct {
	backendbase.Base

	client *httpClient
}

func (b *Backend) Configure(configVal cty.Value) tfdiags.Diagnostics {
	address := backendbase.GetAttrEnvDefaultFallback(
		configVal, "address",
		"TF_HTTP_ADDRESS", cty.StringVal(""),
	).AsString()
	if address == "" {
		return backendbase.ErrorAsDiagnostics(
			fmt.Errorf("address argument is required"),
		)
	}
	updateURL, err := url.Parse(address)
	if err != nil {
		return backendbase.ErrorAsDiagnostics(
			fmt.Errorf("failed to parse address URL: %s", err),
		)
	}
	if updateURL.Scheme != "http" && updateURL.Scheme != "https" {
		return backendbase.ErrorAsDiagnostics(
			fmt.Errorf("address must be HTTP or HTTPS"),
		)
	}

	updateMethod := backendbase.GetAttrEnvDefaultFallback(
		configVal, "update_method",
		"TF_HTTP_UPDATE_METHOD", cty.StringVal("POST"),
	).AsString()

View on GitHub (pinned to c9def3e214)

Solutions

  1. Add address = "https://state.example.com/?type=axios" (or your endpoint) to the http backend block.
  2. Or export TF_HTTP_ADDRESS in the environment before 'terraform init'.
  3. Confirm the value isn't an interpolation that resolves to empty; check with 'terraform init -backend=false' then inspect the rendered config.

Example fix

// before
terraform {
  backend "http" {}
}

// after
terraform {
  backend "http" {
    address = "https://state.my-org.dev/?type=axios"
  }
}
Defensive patterns

Strategy: validation

Validate before calling

addr := os.Getenv("TF_HTTP_ADDRESS")
if addr == "" { log.Fatal("address argument is required: set backend.address or TF_HTTP_ADDRESS") }

Prevention

When it happens

Trigger: 'terraform init' with a backend "http" {} block that omits address and does not set TF_HTTP_ADDRESS; or sets it to an empty string explicitly.

Common situations: Migrated config where the address block was deleted; env var typo (TF_HTTP vs TF_HTTP_ADDRESS); templating rendered the attribute to empty in CI; copy-paste from a partial example.

Related errors


AI-assisted analysis of hashicorp/terraform@c9def3e214 (2026-08-07). Data as JSON: /api/errors/ad0b7c01b8497f67. Report an issue: GitHub.