Terraform JSON Examples
Terraform is an Infrastructure as Code (IaC) tool that allows teams to define cloud resources using configuration files instead of manual setup.
Using Terraform ensures consistency, version control, and automated provisioning across environments.
Example 1: Terraform JSON for AWS EC2
{
"resource": {
"aws_instance": {
"web_server": {
"ami": "ami-0abcd1234",
"instance_type": "t3.micro",
"availability_zone": "us-east-1a",
"tags": {
"Name": "web-server",
"Environment": "production"
}
}
}
}
}Example 2: Terraform JSON for AWS Lambda
{
"resource": {
"aws_lambda_function": {
"process_orders": {
"function_name": "processOrders",
"runtime": "nodejs18.x",
"handler": "index.handler",
"timeout": 30,
"memory_size": 256,
"role": "arn:aws:iam::123456789012:role/lambda-role"
}
}
}
}Example 3: Terraform JSON for S3 Bucket
{
"resource": {
"aws_s3_bucket": {
"assets": {
"bucket": "my-app-assets",
"acl": "private",
"versioning": {
"enabled": true
},
"tags": {
"Project": "json-viewer"
}
}
}
}
}Example 4: Terraform JSON for VPC
{
"resource": {
"aws_vpc": {
"main": {
"cidr_block": "10.0.0.0/16",
"enable_dns_support": true,
"enable_dns_hostnames": true,
"tags": {
"Name": "main-vpc"
}
}
}
}
}Example 5: Terraform JSON for IAM Role
{
"resource": {
"aws_iam_role": {
"app_role": {
"name": "app-execution-role",
"assume_role_policy": "{...}",
"tags": {
"Service": "backend"
}
}
}
}
}Format & Explore JSON Instantly
Use these real-world JSON examples to test formatting, validation, and syntax highlighting with our online tool.
Try these Terraform JSONs in JSON Viewer →