IT

Terraform 설명4 (mini project)

공부가나연 2024. 4. 9. 14:21
  • 생성할 object들
    • ec2,
    • vpc,
    • gateway,
    • route table,
    • subnet,
    • route table association,
    • security group,
      • ingress/egress rule,
    • network interface,
    • eip
# 1. create vpc
# 2. create Internet Gateway
# 3. create custom route table
# 4. create a subnet
# 5. associate subnet with route table
# 6. create security group to allow port 22, 80, 443
# 7. create a network interface with an ip in the subnet that was created in step4
# 8. assign an elastic IP to the network interface created in step7
# 9. create ubuntu server and install/ enable apache2

provider "aws" {
    region = "ap-northeast-2"
    access_key = "#########################"
    secret_key = "#######################################"
}

resource "aws_vpc" "prod-vpc" {
  cidr_block = "10.0.0.0/16"
  tags = {
    Name = "production"
  }
}

resource "aws_internet_gateway" "gw" {
    vpc_id = aws_vpc.prod-vpc.id
}

resource "aws_route_table" "prod-route-table" {
  vpc_id = aws_vpc.prod-vpc.id

  route {
    cidr_block = "10.0.0.0/24"
    gateway_id = aws_internet_gateway.gw.id
  }

  route {
    ipv6_cidr_block = "::/0"
    gateway_id = aws_internet_gateway.gw.id
  }

  tags = {
    Name = "Prod"
  }
}

resource "aws_subnet" "subnet-1" {
  vpc_id = aws_vpc.prod-vpc.id
  cidr_block = "10.0.1.0/24"
  availability_zone = "ap-northeast-2a"

  tags = {
    Name = "prod-subnet"
  }
}

resource "aws_route_table_association" "a" {
  subnet_id      = aws_subnet.subnet-1.id
  route_table_id = aws_route_table.prod-route-table.id
}

resource "aws_security_group" "allow_web" {
  name        = "allow_web_traffic"
  description = "Allow Web inbound traffic"
  vpc_id      = aws_vpc.prod-vpc.id

  tags = {
    Name = "allow_web"
  }
}

resource "aws_vpc_security_group_ingress_rule" "allow-https" {
    security_group_id = aws_security_group.allow_web.id
    description = "HTTPS ingress"
    from_port = 443
    to_port = 443
    ip_protocol = "tcp"
    cidr_ipv4 = aws_vpc.prod-vpc.cidr_block
}

resource "aws_vpc_security_group_ingress_rule" "allow-http" {
    security_group_id = aws_security_group.allow_web.id
    description = "HTTP ingress"
    from_port = 80
    to_port = 80
    ip_protocol = "tcp"
    cidr_ipv4 = aws_vpc.prod-vpc.cidr_block
}

resource "aws_vpc_security_group_ingress_rule" "allow-ssh" {
    security_group_id = aws_security_group.allow_web.id
    description = "SSH ingress"
    from_port = 20
    to_port = 20
    ip_protocol = "tcp"
    cidr_ipv4 = aws_vpc.prod-vpc.cidr_block
}

resource "aws_vpc_security_group_egress_rule" "allow-all-traffic" {
    security_group_id = aws_security_group.allow_web.id
    description = "egress"
    ip_protocol = "-1"
    cidr_ipv4 = "0.0.0.0/0"
}

resource "aws_network_interface" "web-server-nic" {
  subnet_id       = aws_subnet.subnet-1.id
  private_ips     = ["10.0.1.50"]
  security_groups = [aws_security_group.allow_web.id]
}

resource "aws_eip" "one" {
  domain = "vpc"
  network_interface = aws_network_interface.web-server-nic.id
  associate_with_private_ip = "10.0.1.50"
  depends_on = [ aws_internet_gateway.gw ]
}

resource "aws_instance" "web-server-instance" {
    ami = "ami-09a7535106fbd42d5"
    instance_type = "t2.micro"
    availability_zone = "ap-northeast-2a"
    key_name = "aws-ec2-key"

    network_interface {
      device_index = 0
      network_interface_id = aws_network_interface.web-server-nic.id
    }
    # subnet_id = "subnet-01e3dfb97da2a940a"

    user_data = <<-EOF
                #!/bin/bash
                sudo apt update -y
                sudo apt install apache2 -y
                sudo systemctl start apache2
                sudo bash -c 'echo youre very first web server > /var/www/html/index.html'
                EOF

    tags = {
      Name = "ubuntu"
    }
}

terraform.tfstate.tfstate

{
  "version": 4,
  "terraform_version": "1.7.5",
  "serial": 79,
  "lineage": "bce5d6fe-c4fd-30ff-f00c-a33f5b007e64",
  "outputs": {},
  "resources": [
    {
      "mode": "managed",
      "type": "aws_eip",
      "name": "one",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "address": null,
            "allocation_id": "eipalloc-0cb24efb12abdc25a",
            "associate_with_private_ip": "210.217.1.50",
            "association_id": "eipassoc-0b087ba3b99e33eb9",
            "carrier_ip": "",
            "customer_owned_ip": "",
            "customer_owned_ipv4_pool": "",
            "domain": "vpc",
            "id": "eipalloc-0cb24efb12abdc25a",
            "instance": "i-0b02ab292af730082",
            "network_border_group": "ap-northeast-2",
            "network_interface": "eni-098e051285dbd5c22",
            "private_dns": "ip-210-217-1-50.ap-northeast-2.compute.internal",
            "private_ip": "210.217.1.50",
            "public_dns": "ec2-43-201-128-150.ap-northeast-2.compute.amazonaws.com",
            "public_ip": "43.201.128.150",
            "public_ipv4_pool": "amazon",
            "tags": {},
            "tags_all": {},
            "timeouts": null,
            "vpc": true
          },
          "sensitive_attributes": [],
          "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiZGVsZXRlIjoxODAwMDAwMDAwMDAsInJlYWQiOjkwMDAwMDAwMDAwMCwidXBkYXRlIjozMDAwMDAwMDAwMDB9fQ==",
          "dependencies": [
            "aws_internet_gateway.gw",
            "aws_network_interface.web-server-nic",
            "aws_security_group.allow_web",
            "aws_subnet.subnet-1",
            "aws_vpc.prod-vpc"
          ]
        }
      ]
    },
    {
      "mode": "managed",
      "type": "aws_instance",
      "name": "web-server-instance",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
      "instances": [
        {
          "schema_version": 1,
          "attributes": {
            "ami": "ami-09a7535106fbd42d5",
            "arn": "arn:aws:ec2:ap-northeast-2:340097005648:instance/i-0b02ab292af730082",
            "associate_public_ip_address": true,
            "availability_zone": "ap-northeast-2a",
            "capacity_reservation_specification": [
              {
                "capacity_reservation_preference": "open",
                "capacity_reservation_target": []
              }
            ],
            "cpu_core_count": 1,
            "cpu_options": [
              {
                "amd_sev_snp": "",
                "core_count": 1,
                "threads_per_core": 1
              }
            ],
            "cpu_threads_per_core": 1,
            "credit_specification": [
              {
                "cpu_credits": "standard"
              }
            ],
            "disable_api_stop": false,
            "disable_api_termination": false,
            "ebs_block_device": [],
            "ebs_optimized": false,
            "enclave_options": [
              {
                "enabled": false
              }
            ],
            "ephemeral_block_device": [],
            "get_password_data": false,
            "hibernation": false,
            "host_id": "",
            "host_resource_group_arn": null,
            "iam_instance_profile": "",
            "id": "i-0b02ab292af730082",
            "instance_initiated_shutdown_behavior": "stop",
            "instance_lifecycle": "",
            "instance_market_options": [],
            "instance_state": "running",
            "instance_type": "t2.micro",
            "ipv6_address_count": 0,
            "ipv6_addresses": [],
            "key_name": "aws-ec2-key",
            "launch_template": [],
            "maintenance_options": [
              {
                "auto_recovery": "default"
              }
            ],
            "metadata_options": [
              {
                "http_endpoint": "enabled",
                "http_protocol_ipv6": "disabled",
                "http_put_response_hop_limit": 1,
                "http_tokens": "optional",
                "instance_metadata_tags": "disabled"
              }
            ],
            "monitoring": false,
            "network_interface": [
              {
                "delete_on_termination": false,
                "device_index": 0,
                "network_card_index": 0,
                "network_interface_id": "eni-098e051285dbd5c22"
              }
            ],
            "outpost_arn": "",
            "password_data": "",
            "placement_group": "",
            "placement_partition_number": 0,
            "primary_network_interface_id": "eni-098e051285dbd5c22",
            "private_dns": "ip-210-217-1-50.ap-northeast-2.compute.internal",
            "private_dns_name_options": [
              {
                "enable_resource_name_dns_a_record": false,
                "enable_resource_name_dns_aaaa_record": false,
                "hostname_type": "ip-name"
              }
            ],
            "private_ip": "210.217.1.50",
            "public_dns": "",
            "public_ip": "43.201.128.150",
            "root_block_device": [
              {
                "delete_on_termination": true,
                "device_name": "/dev/sda1",
                "encrypted": false,
                "iops": 100,
                "kms_key_id": "",
                "tags": {},
                "tags_all": {},
                "throughput": 0,
                "volume_id": "vol-08c07ebc28c5b3694",
                "volume_size": 8,
                "volume_type": "gp2"
              }
            ],
            "secondary_private_ips": [],
            "security_groups": [],
            "source_dest_check": true,
            "spot_instance_request_id": "",
            "subnet_id": "subnet-0b1f760275d128ed9",
            "tags": {
              "Name": "ubuntu"
            },
            "tags_all": {
              "Name": "ubuntu"
            },
            "tenancy": "default",
            "timeouts": null,
            "user_data": "d64a4bc9daa4679ae49f80da46c799508539921e",
            "user_data_base64": null,
            "user_data_replace_on_change": false,
            "volume_tags": null,
            "vpc_security_group_ids": [
              "sg-0b6d55fe27d4020d2"
            ]
          },
          "sensitive_attributes": [],
          "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwicmVhZCI6OTAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9",
          "dependencies": [
            "aws_network_interface.web-server-nic",
            "aws_security_group.allow_web",
            "aws_subnet.subnet-1",
            "aws_vpc.prod-vpc"
          ]
        }
      ]
    },
    {
      "mode": "managed",
      "type": "aws_internet_gateway",
      "name": "gw",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "arn": "arn:aws:ec2:ap-northeast-2:340097005648:internet-gateway/igw-0182971eeb1019d33",
            "id": "igw-0182971eeb1019d33",
            "owner_id": "340097005648",
            "tags": {},
            "tags_all": {},
            "timeouts": null,
            "vpc_id": "vpc-0457ff6baabd654a0"
          },
          "sensitive_attributes": [],
          "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19",
          "dependencies": [
            "aws_vpc.prod-vpc"
          ]
        }
      ]
    },
    {
      "mode": "managed",
      "type": "aws_network_interface",
      "name": "web-server-nic",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "arn": "arn:aws:ec2:ap-northeast-2:340097005648:network-interface/eni-098e051285dbd5c22",
            "attachment": [
              {
                "attachment_id": "eni-attach-030dbeb3ced277d60",
                "device_index": 0,
                "instance": "i-0b02ab292af730082"
              }
            ],
            "description": "",
            "id": "eni-098e051285dbd5c22",
            "interface_type": "interface",
            "ipv4_prefix_count": 0,
            "ipv4_prefixes": [],
            "ipv6_address_count": 0,
            "ipv6_address_list": [],
            "ipv6_address_list_enabled": false,
            "ipv6_addresses": [],
            "ipv6_prefix_count": 0,
            "ipv6_prefixes": [],
            "mac_address": "02:ad:c2:5b:c0:57",
            "outpost_arn": "",
            "owner_id": "340097005648",
            "private_dns_name": "",
            "private_ip": "210.217.1.50",
            "private_ip_list": [
              "210.217.1.50"
            ],
            "private_ip_list_enabled": false,
            "private_ips": [
              "210.217.1.50"
            ],
            "private_ips_count": 0,
            "security_groups": [
              "sg-0b6d55fe27d4020d2"
            ],
            "source_dest_check": true,
            "subnet_id": "subnet-0b1f760275d128ed9",
            "tags": {},
            "tags_all": {}
          },
          "sensitive_attributes": [],
          "private": "bnVsbA==",
          "dependencies": [
            "aws_security_group.allow_web",
            "aws_subnet.subnet-1",
            "aws_vpc.prod-vpc"
          ]
        }
      ]
    },
    {
      "mode": "managed",
      "type": "aws_route_table",
      "name": "prod-route-table",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "arn": "arn:aws:ec2:ap-northeast-2:340097005648:route-table/rtb-01d6f6c8c9bed6b76",
            "id": "rtb-01d6f6c8c9bed6b76",
            "owner_id": "340097005648",
            "propagating_vgws": [],
            "route": [
              {
                "carrier_gateway_id": "",
                "cidr_block": "",
                "core_network_arn": "",
                "destination_prefix_list_id": "",
                "egress_only_gateway_id": "",
                "gateway_id": "igw-0182971eeb1019d33",
                "ipv6_cidr_block": "::/0",
                "local_gateway_id": "",
                "nat_gateway_id": "",
                "network_interface_id": "",
                "transit_gateway_id": "",
                "vpc_endpoint_id": "",
                "vpc_peering_connection_id": ""
              },
              {
                "carrier_gateway_id": "",
                "cidr_block": "192.168.0.0/24",
                "core_network_arn": "",
                "destination_prefix_list_id": "",
                "egress_only_gateway_id": "",
                "gateway_id": "igw-0182971eeb1019d33",
                "ipv6_cidr_block": "",
                "local_gateway_id": "",
                "nat_gateway_id": "",
                "network_interface_id": "",
                "transit_gateway_id": "",
                "vpc_endpoint_id": "",
                "vpc_peering_connection_id": ""
              }
            ],
            "tags": {
              "Name": "Prod"
            },
            "tags_all": {
              "Name": "Prod"
            },
            "timeouts": null,
            "vpc_id": "vpc-0457ff6baabd654a0"
          },
          "sensitive_attributes": [],
          "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJ1cGRhdGUiOjEyMDAwMDAwMDAwMH19",
          "dependencies": [
            "aws_internet_gateway.gw",
            "aws_vpc.prod-vpc"
          ]
        }
      ]
    },
    {
      "mode": "managed",
      "type": "aws_route_table_association",
      "name": "a",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "gateway_id": "",
            "id": "rtbassoc-0613ce451aaff006e",
            "route_table_id": "rtb-01d6f6c8c9bed6b76",
            "subnet_id": "subnet-0b1f760275d128ed9",
            "timeouts": null
          },
          "sensitive_attributes": [],
          "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJ1cGRhdGUiOjEyMDAwMDAwMDAwMH19",
          "dependencies": [
            "aws_internet_gateway.gw",
            "aws_route_table.prod-route-table",
            "aws_subnet.subnet-1",
            "aws_vpc.prod-vpc"
          ]
        }
      ]
    },
    {
      "mode": "managed",
      "type": "aws_security_group",
      "name": "allow_web",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
      "instances": [
        {
          "schema_version": 1,
          "attributes": {
            "arn": "arn:aws:ec2:ap-northeast-2:340097005648:security-group/sg-0b6d55fe27d4020d2",
            "description": "Allow Web inbound traffic",
            "egress": [
              {
                "cidr_blocks": [
                  "0.0.0.0/0"
                ],
                "description": "egress",
                "from_port": 0,
                "ipv6_cidr_blocks": [],
                "prefix_list_ids": [],
                "protocol": "-1",
                "security_groups": [],
                "self": false,
                "to_port": 0
              }
            ],
            "id": "sg-0b6d55fe27d4020d2",
            "ingress": [
              {
                "cidr_blocks": [
                  "210.217.0.0/16"
                ],
                "description": "HTTP ingress",
                "from_port": 80,
                "ipv6_cidr_blocks": [],
                "prefix_list_ids": [],
                "protocol": "tcp",
                "security_groups": [],
                "self": false,
                "to_port": 80
              },
              {
                "cidr_blocks": [
                  "210.217.0.0/16"
                ],
                "description": "HTTPS ingress",
                "from_port": 443,
                "ipv6_cidr_blocks": [],
                "prefix_list_ids": [],
                "protocol": "tcp",
                "security_groups": [],
                "self": false,
                "to_port": 443
              },
              {
                "cidr_blocks": [
                  "210.217.0.0/16"
                ],
                "description": "SSH ingress",
                "from_port": 20,
                "ipv6_cidr_blocks": [],
                "prefix_list_ids": [],
                "protocol": "tcp",
                "security_groups": [],
                "self": false,
                "to_port": 20
              }
            ],
            "name": "allow_web_traffic",
            "name_prefix": "",
            "owner_id": "340097005648",
            "revoke_rules_on_delete": false,
            "tags": {
              "Name": "allow_web"
            },
            "tags_all": {
              "Name": "allow_web"
            },
            "timeouts": null,
            "vpc_id": "vpc-0457ff6baabd654a0"
          },
          "sensitive_attributes": [],
          "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0=",
          "dependencies": [
            "aws_vpc.prod-vpc"
          ]
        }
      ]
    },
    {
      "mode": "managed",
      "type": "aws_subnet",
      "name": "subnet-1",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
      "instances": [
        {
          "schema_version": 1,
          "attributes": {
            "arn": "arn:aws:ec2:ap-northeast-2:340097005648:subnet/subnet-0b1f760275d128ed9",
            "assign_ipv6_address_on_creation": false,
            "availability_zone": "ap-northeast-2a",
            "availability_zone_id": "apne2-az1",
            "cidr_block": "210.217.1.0/24",
            "customer_owned_ipv4_pool": "",
            "enable_dns64": false,
            "enable_lni_at_device_index": 0,
            "enable_resource_name_dns_a_record_on_launch": false,
            "enable_resource_name_dns_aaaa_record_on_launch": false,
            "id": "subnet-0b1f760275d128ed9",
            "ipv6_cidr_block": "",
            "ipv6_cidr_block_association_id": "",
            "ipv6_native": false,
            "map_customer_owned_ip_on_launch": false,
            "map_public_ip_on_launch": false,
            "outpost_arn": "",
            "owner_id": "340097005648",
            "private_dns_hostname_type_on_launch": "ip-name",
            "tags": {
              "Name": "prod-subnet"
            },
            "tags_all": {
              "Name": "prod-subnet"
            },
            "timeouts": null,
            "vpc_id": "vpc-0457ff6baabd654a0"
          },
          "sensitive_attributes": [],
          "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9",
          "dependencies": [
            "aws_vpc.prod-vpc"
          ]
        }
      ]
    },
    {
      "mode": "managed",
      "type": "aws_vpc",
      "name": "prod-vpc",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
      "instances": [
        {
          "schema_version": 1,
          "attributes": {
            "arn": "arn:aws:ec2:ap-northeast-2:340097005648:vpc/vpc-0457ff6baabd654a0",
            "assign_generated_ipv6_cidr_block": false,
            "cidr_block": "210.217.0.0/16",
            "default_network_acl_id": "acl-0064b4615ad19c0cc",
            "default_route_table_id": "rtb-0030aa2b4479eed58",
            "default_security_group_id": "sg-0f4377c696d3ea396",
            "dhcp_options_id": "dopt-c3210aaa",
            "enable_dns_hostnames": false,
            "enable_dns_support": true,
            "enable_network_address_usage_metrics": false,
            "id": "vpc-0457ff6baabd654a0",
            "instance_tenancy": "default",
            "ipv4_ipam_pool_id": null,
            "ipv4_netmask_length": null,
            "ipv6_association_id": "",
            "ipv6_cidr_block": "",
            "ipv6_cidr_block_network_border_group": "",
            "ipv6_ipam_pool_id": "",
            "ipv6_netmask_length": 0,
            "main_route_table_id": "rtb-0030aa2b4479eed58",
            "owner_id": "340097005648",
            "tags": {
              "Name": "production"
            },
            "tags_all": {
              "Name": "production"
            }
          },
          "sensitive_attributes": [],
          "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ=="
        }
      ]
    },
    {
      "mode": "managed",
      "type": "aws_vpc_security_group_egress_rule",
      "name": "allow-all-traffic",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "arn": "arn:aws:ec2:ap-northeast-2:340097005648:security-group-rule/sgr-0562764b29f3afa05",
            "cidr_ipv4": "0.0.0.0/0",
            "cidr_ipv6": null,
            "description": "egress",
            "from_port": null,
            "id": "sgr-0562764b29f3afa05",
            "ip_protocol": "-1",
            "prefix_list_id": null,
            "referenced_security_group_id": null,
            "security_group_id": "sg-0b6d55fe27d4020d2",
            "security_group_rule_id": "sgr-0562764b29f3afa05",
            "tags": null,
            "tags_all": {},
            "to_port": null
          },
          "sensitive_attributes": [],
          "dependencies": [
            "aws_security_group.allow_web",
            "aws_vpc.prod-vpc"
          ]
        }
      ]
    },
    {
      "mode": "managed",
      "type": "aws_vpc_security_group_ingress_rule",
      "name": "allow-http",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "arn": "arn:aws:ec2:ap-northeast-2:340097005648:security-group-rule/sgr-054cd683ef8cd4081",
            "cidr_ipv4": "210.217.0.0/16",
            "cidr_ipv6": null,
            "description": "HTTP ingress",
            "from_port": 80,
            "id": "sgr-054cd683ef8cd4081",
            "ip_protocol": "tcp",
            "prefix_list_id": null,
            "referenced_security_group_id": null,
            "security_group_id": "sg-0b6d55fe27d4020d2",
            "security_group_rule_id": "sgr-054cd683ef8cd4081",
            "tags": null,
            "tags_all": {},
            "to_port": 80
          },
          "sensitive_attributes": [],
          "dependencies": [
            "aws_security_group.allow_web",
            "aws_vpc.prod-vpc"
          ]
        }
      ]
    },
    {
      "mode": "managed",
      "type": "aws_vpc_security_group_ingress_rule",
      "name": "allow-https",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "arn": "arn:aws:ec2:ap-northeast-2:340097005648:security-group-rule/sgr-034ce0129f59e9c08",
            "cidr_ipv4": "210.217.0.0/16",
            "cidr_ipv6": null,
            "description": "HTTPS ingress",
            "from_port": 443,
            "id": "sgr-034ce0129f59e9c08",
            "ip_protocol": "tcp",
            "prefix_list_id": null,
            "referenced_security_group_id": null,
            "security_group_id": "sg-0b6d55fe27d4020d2",
            "security_group_rule_id": "sgr-034ce0129f59e9c08",
            "tags": null,
            "tags_all": {},
            "to_port": 443
          },
          "sensitive_attributes": [],
          "dependencies": [
            "aws_security_group.allow_web",
            "aws_vpc.prod-vpc"
          ]
        }
      ]
    },
    {
      "mode": "managed",
      "type": "aws_vpc_security_group_ingress_rule",
      "name": "allow-ssh",
      "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "arn": "arn:aws:ec2:ap-northeast-2:340097005648:security-group-rule/sgr-086f67e399d80781b",
            "cidr_ipv4": "210.217.0.0/16",
            "cidr_ipv6": null,
            "description": "SSH ingress",
            "from_port": 20,
            "id": "sgr-086f67e399d80781b",
            "ip_protocol": "tcp",
            "prefix_list_id": null,
            "referenced_security_group_id": null,
            "security_group_id": "sg-0b6d55fe27d4020d2",
            "security_group_rule_id": "sgr-086f67e399d80781b",
            "tags": null,
            "tags_all": {},
            "to_port": 20
          },
          "sensitive_attributes": [],
          "dependencies": [
            "aws_security_group.allow_web",
            "aws_vpc.prod-vpc"
          ]
        }
      ]
    }
  ],
  "check_results": null
}