hashicorp/terraform · error

address argument is required

Error message

address argument is required

What it means

Thrown by the HTTP remote state backend's Configure when the address attribute (or TF_HTTP_ADDRESS env var) resolves to an empty string. The address is the URL of the remote HTTP state endpoint and is mandatory.

Solutions

  1. Add address = "https://..." to the http backend block.
  2. Export TF_HTTP_ADDRESS in the shell/CI environment.
  3. Verify the variable or template that supplies address renders a non-empty value.

Example fix

// before
terraform {
  backend "http" {
  }
}
// after
terraform {
  backend "http" {
    address = "https://state.example.com/terraform"
  }
}
Defensive patterns

Strategy: validation

Validate before calling

address := strings.TrimSpace(/* config attr or env */ "")
if address == "" {
    address = os.Getenv("TF_HTTP_ADDRESS")
}
if address == "" {
    return fmt.Errorf("http backend requires 'address' or TF_HTTP_ADDRESS")
}

Type guard

func isNonEmptyAddress(a string) bool { return strings.TrimSpace(a) != "" }

Prevention

When it happens

Trigger: Configure computes address via GetAttrEnvDefaultFallback with config attr 'address', env 'TF_HTTP_ADDRESS', default empty; if all three resolve to empty the check fires.

Common situations: Backend block omits address; the variable backing address is unset; TF_HTTP_ADDRESS was expected to be exported by CI but was not; a templating step stripped the line.

Related errors


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

Appendix: 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 d32a084675)