mcp-server-terraform

v0.1.0
mcp-server-terraform Checked 3 days ago Published 5 months ago

MCP server for Terraform infrastructure-as-code operations

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

terraform_plan

Preview changes Terraform will make to infrastructure without applying them. Shows added, changed, and destroyed resources.

ParameterTypeDescription
directory *stringWorking directory containing Terraform files
destroybooleanIf true, show destroy plan instead of normal plan
targetstringTarget specific resource (e.g., aws_instance.web)
var_filestringPath to variables file
varsobjectVariable values to pass (e.g., region=us-east-1)

terraform_apply

Apply Terraform changes to create, update, or destroy infrastructure resources.

ParameterTypeDescription
directory *stringWorking directory containing Terraform files
auto_approvebooleanSkip interactive approval (default: false — requires confirmation)
targetstringTarget specific resource
var_filestringPath to variables file
varsobjectVariable values to pass

terraform_destroy

Destroy all Terraform-managed infrastructure. Use with caution — this removes real resources.

ParameterTypeDescription
directory *stringWorking directory containing Terraform files
auto_approvebooleanSkip interactive approval (default: false)
targetstringTarget specific resource to destroy
var_filestringPath to variables file
varsobjectVariable values to pass

terraform_init

Initialize a Terraform working directory. Downloads providers, modules, and configures the backend.

ParameterTypeDescription
directory *stringWorking directory containing Terraform files
backend_configobjectBackend configuration values
reconfigurebooleanReconfigure the backend (discard previous state)
upgradebooleanUpgrade providers and modules to latest compatible versions

terraform_validate

Validate Terraform configuration files for syntax and internal consistency without contacting any remote services.

ParameterTypeDescription
directory *stringWorking directory containing Terraform files

terraform_state_list

List all resources tracked in the Terraform state file.

ParameterTypeDescription
directory *stringWorking directory containing Terraform files
id_patternstringFilter resources by ID pattern (supports glob)

terraform_state_show

Show detailed attributes of a specific resource in the Terraform state.

ParameterTypeDescription
directory *stringWorking directory containing Terraform files
resource_id *stringResource ID in state (e.g., aws_instance.web)

terraform_fmt

Reformat Terraform configuration files to canonical style (consistent indentation and alignment).

ParameterTypeDescription
directory *stringWorking directory containing Terraform files
checkbooleanCheck if files are formatted (don't modify, just report)
recursivebooleanProcess files in subdirectories

terraform_output

Show output values from the Terraform state. Outputs are defined in output blocks and often contain important resource attributes.

ParameterTypeDescription
directory *stringWorking directory containing Terraform files
jsonbooleanOutput in JSON format
namestringShow a specific output by name

terraform_import

Import an existing infrastructure resource into Terraform state. Maps a real-world resource to a Terraform resource address.

ParameterTypeDescription
directory *stringWorking directory containing Terraform files
resource_address *stringTerraform resource address (e.g., aws_instance.web)
resource_id *stringID of the existing resource to import (e.g., i-1234567890abcdef0)