mediumFoundationSymptom-first#hcl#typo#argument#validation

Unsupported argument — typo or misplaced attribute

An argument named "instance_typo" is not expected here

Likely source:configuration

Focused incident mode — strips away everything but this runbook.

Symptoms

  • An argument named "instance_typo" is not expected here
  • terraform validate fails with unexpected argument
  • HCL syntax error after editing a resource block

Evidence to grab

Collect these artifacts before you change anything — they prove (or rule out) each cause.

  • Validation error message

    terraform validate 2>&1
  • File and line number

    terraform validate 2>&1 | grep -E 'on|line'

Diagnostic flow

Run the steps in order, marking each claim confirmed or refuted. The evidence you gather feeds the ranked causes below.

Guided decision tree is ready.

Steps with commands, expected output, and pass/fail branches.

Ranked root causes

Evidence checklist

  • Error names the exact misspelled argument
  • e.g. instance_typo instead of instance_type

Confirm before fixing

terraform validate 2>&1
READ

Get the exact error location

Fix

sed -i 's/instance_typo/instance_type/g' <FILE>.tf
CHANGE

Fix the typo in the resource block

Resolution runbook

Apply from top to bottom after the cause is confirmed. Review every command before running it — risk tags are shown on each.

1
terraform validate 2>&1
READ

Get the exact error location

2
grep -n '<BAD_ARG>' <FILE>.tf
READ

Find the typo in the file

3
terraform fmt -diff <FILE>.tf
CHANGE

Auto-format to clean up formatting issues

4
terraform validate
READ

Confirm the fix

Prevention

  • Use terraform validate in CI on every PR.
  • Use language server (tfls) in your editor for real-time HCL validation.
  • Pin provider versions to avoid attribute removal surprises on upgrade.
  • Run terraform fmt -check in CI to enforce consistent formatting.

Commands marked READ CHANGE DESTRUCTIVE — never run DESTRUCTIVE commands against production data you cannot restore. Copy → verify → execute.