Changing language resets inputs and results.

Reading AWS structure

Read the nested VPC, subnet, and EC2 boxes to understand resource placement.

Read the diagram

The VPC (aws_vpc.demo) contains the subnet (aws_subnet.app), with the EC2 instances app and new inside it. The instance marked for deletion, aws_instance.old, is displayed outside both boxes.

The diagram shows new being added and app being updated. Check before.subnet_id (subnet-app) in the JSON for the subnet old belonged to before deletion. The unchanged VPC and subnet provide context.

Relationship Lines and what omission changes (Glossary)

Input JSON

This fictional example has five resources. Follow Try sample, press the matching button on the conversion page, then Generate. It creates new, updates the instance_type of app, and deletes old. The VPC and subnet are unchanged.

Sample JSON Try sample

Show input JSON
{
  "format_version": "1.2",
  "terraform_version": "1.9.8",
  "resource_changes": [
    {
      "address": "aws_vpc.demo", "mode": "managed", "type": "aws_vpc", "name": "demo",
      "provider_name": "registry.terraform.io/hashicorp/aws",
      "change": {
        "actions": ["no-op"],
        "before": {"id": "vpc-demo", "cidr_block": "10.0.0.0/16"},
        "after": {"id": "vpc-demo", "cidr_block": "10.0.0.0/16"}
      }
    },
    {
      "address": "aws_subnet.app", "mode": "managed", "type": "aws_subnet", "name": "app",
      "provider_name": "registry.terraform.io/hashicorp/aws",
      "change": {
        "actions": ["no-op"],
        "before": {"id": "subnet-app", "vpc_id": "vpc-demo", "cidr_block": "10.0.1.0/24"},
        "after": {"id": "subnet-app", "vpc_id": "vpc-demo", "cidr_block": "10.0.1.0/24"}
      }
    },
    {
      "address": "aws_instance.new", "mode": "managed", "type": "aws_instance", "name": "new",
      "provider_name": "registry.terraform.io/hashicorp/aws",
      "change": {
        "actions": ["create"], "before": null,
        "after": {"subnet_id": "subnet-app", "instance_type": "t3.micro"}
      }
    },
    {
      "address": "aws_instance.app", "mode": "managed", "type": "aws_instance", "name": "app",
      "provider_name": "registry.terraform.io/hashicorp/aws",
      "change": {
        "actions": ["update"],
        "before": {"id": "i-app", "subnet_id": "subnet-app", "instance_type": "t3.micro"},
        "after": {"id": "i-app", "subnet_id": "subnet-app", "instance_type": "t3.small"}
      }
    },
    {
      "address": "aws_instance.old", "mode": "managed", "type": "aws_instance", "name": "old",
      "provider_name": "registry.terraform.io/hashicorp/aws",
      "change": {
        "actions": ["delete"],
        "before": {"id": "i-old", "subnet_id": "subnet-app", "instance_type": "t3.micro"},
        "after": null
      }
    }
  ],
  "configuration": {
    "root_module": {
      "resources": [
        {"address": "aws_vpc.demo"},
        {"address": "aws_subnet.app", "expressions": {"vpc_id": {"references": ["aws_vpc.demo.id"]}}},
        {"address": "aws_instance.app", "expressions": {"subnet_id": {"references": ["aws_subnet.app.id"]}}},
        {"address": "aws_instance.new", "expressions": {
          "subnet_id": {"references": ["aws_subnet.app.id"]},
          "user_data": {"references": ["aws_instance.app.private_ip"]}
        }}
      ]
    }
  }
}

SVG

This page displays pregenerated files and does not run conversion.

Open SVG in a new tab

Diagram of a VPC, subnet and three EC2 instances being created, updated and deleted

Try it

Search for aws_instance.app in the HTML viewer and find its parent subnet. Then check instance_type in the JSON to see the change from t3.micro to t3.small.

Open HTML in a new tab

Generation record