Terraform · DevOpsadvanced
Terraform Configuration (JSON syntax)
A Terraform config in the native JSON syntax (.tf.json) — provider, variable, resource and output — for tooling that generates Terraform programmatically.
terraformiacdevopshclaws
Preview
{
"terraform": {
"required_providers": {
"aws": {
"source": "hashicorp/aws",
"version": "~> 5.0"
}
}
},
"provider": {
"aws": {
"region": "${var.region}"
}
},
"variable": {
"region": {
"type": "string",
"default": "us-east-1"
}
},
"resource": {
"aws_instance": {
"web": {
"ami": "ami-0c55b159cbfafe1f0",
"instance_type": "t3.micro",
"tags": {
"Name": "web"
}
}
}
},
"output": {
"public_ip": {
"value": "${aws_instance.web.public_ip}"
}
}
}AI actions
Documentation
Purpose
Describe infrastructure declaratively in Terraform’s JSON syntax, equivalent to HCL but machine-generatable.
When to use
When a tool emits or consumes Terraform config as JSON (.tf.json) rather than hand-written HCL.
Required fields
- resource — the infrastructure to manage
- provider — the target platform and its config
Optional fields
- variable — typed inputs with optional defaults
- output — values exposed after apply
- terraform.required_providers — provider version pins
Best practices
- Pin provider versions under required_providers.
- Keep state in a remote backend, never local for teams.
- Use variables and outputs instead of hardcoding values.
Security considerations
- Never commit .tfstate — it can contain secrets in plaintext.
- Pass credentials via environment or a secrets manager, not the config.
- Review `terraform plan` before every apply.