Plan, apply, and inspect Terraform infrastructure from Claude Code — generate modules, review state, and manage cloud resources with AI-powered infrastructure-as-code assistance.
The Terraform MCP integrates Claude Code with the Terraform CLI and Terraform Cloud/HCP Terraform APIs. Claude can generate HCL modules, run terraform plan, inspect state files, validate configurations, and manage workspaces — making infrastructure-as-code workflows dramatically faster and less error-prone.
mcpizy install terraform
The MCP requires Terraform CLI to be installed on your machine. For Terraform Cloud integration, provide a TFC organization and API token during setup.
terraform validate and explain any errors.Provision a new S3 bucket with versioning and a lifecycle rule:
resource "aws_s3_bucket" "artifacts" {
bucket = "my-app-artifacts-prod"
}
resource "aws_s3_bucket_versioning" "artifacts" {
bucket = aws_s3_bucket.artifacts.id
versioning_configuration { status = "Enabled" }
}
resource "aws_s3_bucket_lifecycle_configuration" "artifacts" {
bucket = aws_s3_bucket.artifacts.id
rule {
id = "expire-old"
status = "Enabled"
expiration { days = 90 }
}
}
Claude generates this HCL, runs the plan, and reports back the expected changes.
.tfvars files.