言語の切替で入力と結果をリセットします。

AWS の配置を読み込む

VPC・サブネット・EC2 の入れ子から、リソースの配置を確認します。

図を読む

図の VPC(aws_vpc.demo)の中にサブネット(aws_subnet.app)があり、その中に EC2 の app と new が並びます。削除対象の aws_instance.old は VPC・サブネットの枠の外に表示されます。

new の追加と app の更新は図で確認できます。old の削除前の所属は JSON の before.subnet_id(subnet-app)で確認しましょう。変更なしの VPC とサブネットも、配置を理解する手掛かりになります。

Relationship Lines の意味と省略の詳細(用語)

入力 JSON

架空の5リソースの例です。「サンプルを試す」から変換ページの同名ボタンを押し、「生成する」で試せます。new を作成し、app の instance_type を更新し、old を削除します。VPC とサブネットは変更しません。

サンプル JSON サンプルを試す

入力 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

生成済みのファイルを表示するため、このページでは変換処理を実行しません。

SVG を別タブで開く

VPC・サブネットと作成・更新・削除する3台の EC2 の構成図

試してみる

HTML viewer で aws_instance.app を検索し、親のサブネットを確認します。次に JSON の instance_type を見て、t3.micro から t3.small への更新を確かめましょう。

HTML を別タブで開く

生成記録