diff --git a/.gitignore b/.gitignore index 13264f6..e58c84c 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,7 @@ aws/aws_simple/.terraform/providers/registry.terraform.io/hashicorp/template/2.2 aws/aws_simple/.terraform/providers/registry.terraform.io/hashicorp/aws/5.26.0/linux_amd64/terraform-provider-aws_v5.26.0_x5 aws/aws_simple/.terraform/terraform.tfstate aws/example-backend/terraform.tfstate +aws/aws_vpc_peering/.terraform.lock.hcl +aws/aws_vpc_peering/terraform.tfstate +.gitignore +aws/aws_vpc_peering/.terraform/providers/registry.terraform.io/hashicorp/aws/5.26.0/linux_amd64/terraform-provider-aws_v5.26.0_x5 diff --git a/aws/aws_vpc_peering/main.tf b/aws/aws_vpc_peering/main.tf new file mode 100644 index 0000000..c2d5a76 --- /dev/null +++ b/aws/aws_vpc_peering/main.tf @@ -0,0 +1,303 @@ +# Define AWS provider with aliases for us-west-1 and us-east-1 regions +provider "aws" { + alias = "us-west-1" + region = "us-west-1" +} + +provider "aws" { + alias = "us-east-1" + region = "us-east-1" +} + +# Create VPCs in us-west-1 and us-east-1 regions +resource "aws_vpc" "us-west-1" { + cidr_block = "10.0.0.0/16" + provider = aws.us-west-1 +} + +resource "aws_vpc" "us-east-1" { + cidr_block = "10.1.0.0/16" + provider = aws.us-east-1 +} + +# Create subnets in us-west-1 VPC +resource "aws_subnet" "us-west-1-subnet-1" { + vpc_id = aws_vpc.us-west-1.id + cidr_block = "10.0.1.0/24" + availability_zone = "us-west-1c" + provider = aws.us-west-1 +} + +resource "aws_subnet" "us-west-1-subnet-2" { + vpc_id = aws_vpc.us-west-1.id + cidr_block = "10.0.2.0/24" + availability_zone = "us-west-1b" + provider = aws.us-west-1 +} + +# Create subnets in us-east-1 VPC +resource "aws_subnet" "us-east-1-subnet-1" { + vpc_id = aws_vpc.us-east-1.id + cidr_block = "10.1.1.0/24" + availability_zone = "us-east-1c" + provider = aws.us-east-1 +} + + + +resource "aws_subnet" "us-east-1-subnet-2" { + vpc_id = aws_vpc.us-east-1.id + cidr_block = "10.1.2.0/24" + availability_zone = "us-east-1b" + provider = aws.us-east-1 +} + +# Create VPC peering connection between us-west-1 and us-east-1 VPCs +resource "aws_vpc_peering_connection" "peering_connection" { + vpc_id = aws_vpc.us-west-1.id + peer_vpc_id = aws_vpc.us-east-1.id + peer_region = "us-east-1" + auto_accept = false + provider = aws.us-west-1 +} + +# Create VPC peering connection accepter in us-east-1 region +resource "aws_vpc_peering_connection_accepter" "peering_accepter" { + vpc_peering_connection_id = aws_vpc_peering_connection.peering_connection.id + auto_accept = true + + provider = aws.us-east-1 +} + +# Create route tables for each VPC and associate them with the respective subnets +resource "aws_route_table" "us-west-1-route-table" { + vpc_id = aws_vpc.us-west-1.id + provider = aws.us-west-1 +} + +resource "aws_route_table_association" "us-west-1-subnet-1-association" { + subnet_id = aws_subnet.us-west-1-subnet-1.id + route_table_id = aws_route_table.us-west-1-route-table.id + provider = aws.us-west-1 +} + +resource "aws_route_table_association" "us-west-1-subnet-2-association" { + subnet_id = aws_subnet.us-west-1-subnet-2.id + route_table_id = aws_route_table.us-west-1-route-table.id + provider = aws.us-west-1 +} + +resource "aws_route_table" "us-east-1-route-table" { + vpc_id = aws_vpc.us-east-1.id + provider = aws.us-east-1 +} + +resource "aws_route_table_association" "us-east-1-subnet-1-association" { + subnet_id = aws_subnet.us-east-1-subnet-1.id + route_table_id = aws_route_table.us-east-1-route-table.id + provider = aws.us-east-1 +} + +resource "aws_route_table_association" "us-east-1-subnet-2-association" { + subnet_id = aws_subnet.us-east-1-subnet-2.id + route_table_id = aws_route_table.us-east-1-route-table.id + provider = aws.us-east-1 +} + + +# Create internet gateway for us-west-1 VPC +resource "aws_internet_gateway" "us-west-1-igw" { + vpc_id = aws_vpc.us-west-1.id + provider = aws.us-west-1 + + tags = { + Name = "us-west-1-igw" + } +} + +# Create internet gateway for us-east-1 VPC +resource "aws_internet_gateway" "us-east-1-igw" { + vpc_id = aws_vpc.us-east-1.id + provider = aws.us-east-1 + + tags = { + Name = "us-east-1-igw" + } +} + +# Attach internet gateway to the route table of each VPC +resource "aws_route" "us-west-1-igw-route" { + route_table_id = aws_route_table.us-west-1-route-table.id + destination_cidr_block = "0.0.0.0/0" + gateway_id = aws_internet_gateway.us-west-1-igw.id + provider = aws.us-west-1 +} + +resource "aws_route" "us-east-1-igw-route" { + route_table_id = aws_route_table.us-east-1-route-table.id + destination_cidr_block = "0.0.0.0/0" + gateway_id = aws_internet_gateway.us-east-1-igw.id + provider = aws.us-east-1 +} + +# Create security groups for EC2 instances +resource "aws_security_group" "us-west-1-instance-sg" { + vpc_id = aws_vpc.us-west-1.id + provider = aws.us-west-1 + tags = { + Name = "instance-west-security-group" + } + + # Allow inbound SSH, HTTP, and HTTPS traffic from any source + ingress { + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + ingress { + from_port = 80 + to_port = 80 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + ingress { + from_port = 443 + to_port = 443 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + # Allow outbound traffic to all private subnets in the VPC + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["10.1.0.0/16", "0.0.0.0/0"] + } +} + +resource "aws_security_group" "us-east-1-instance-sg" { + vpc_id = aws_vpc.us-east-1.id + provider = aws.us-east-1 + tags = { + Name = "instance-east-security-group" + } + + # Allow inbound SSH, HTTP, and HTTPS traffic from any source + ingress { + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + ingress { + from_port = 80 + to_port = 80 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + ingress { + from_port = 443 + to_port = 443 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + # Allow outbound traffic to all private subnets in the VPC + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["10.1.0.0/16", "0.0.0.0/0"] + } +} + +# Create EC2 instances in each subnet +resource "aws_instance" "us-west-1-instance-1" { + ami = "ami-0f3f6663da6750955" # Ubuntu 20.04 AMI + instance_type = "t3.small" # Add instance type + subnet_id = aws_subnet.us-west-1-subnet-1.id + vpc_security_group_ids = [aws_security_group.us-west-1-instance-sg.id] + associate_public_ip_address = true # Set ephemeral public IP address + user_data = base64encode(file("${path.module}/user-data.sh")) + # Other necessary configurations for the instance + provider = aws.us-west-1 + # ... + tags = { + Name = "us-west-1-instance-1" + SecurityGroup = "instance-west-security-group" + } +} + +resource "aws_instance" "us-west-1-instance-2" { + ami = "ami-0f3f6663da6750955" # Ubuntu 20.04 AMI + instance_type = "t3.small" # Add instance type + subnet_id = aws_subnet.us-west-1-subnet-2.id + vpc_security_group_ids = [aws_security_group.us-west-1-instance-sg.id] + associate_public_ip_address = true # Set ephemeral public IP address + user_data = base64encode(file("${path.module}/user-data.sh")) + # Other necessary configurations for the instance + provider = aws.us-west-1 + # ... + tags = { + Name = "us-west-1-instance-2" + SecurityGroup = "instance-west-security-group" + } +} + +resource "aws_instance" "us-east-1-instance-1" { + ami = "ami-04e369782a6d2125e" # Ubuntu 20.04 AMI + instance_type = "t3.small" # Add instance type + subnet_id = aws_subnet.us-east-1-subnet-1.id + vpc_security_group_ids = [aws_security_group.us-east-1-instance-sg.id] + associate_public_ip_address = true # Set ephemeral public IP address + user_data = base64encode(file("${path.module}/user-data.sh")) + # Other necessary configurations for the instance + provider = aws.us-east-1 + # ... + tags = { + Name = "us-east-1-instance-1" + SecurityGroup = "instance-east-security-group" + } +} + +resource "aws_instance" "us-east-1-instance-2" { + ami = "ami-04e369782a6d2125e" # Ubuntu 20.04 AMI + instance_type = "t3.small" # Add instance type + subnet_id = aws_subnet.us-east-1-subnet-2.id + vpc_security_group_ids = [aws_security_group.us-east-1-instance-sg.id] + associate_public_ip_address = true # Set ephemeral public IP address + user_data = base64encode(file("${path.module}/user-data.sh")) + # Other necessary configurations for the instance + provider = aws.us-east-1 + # ... + tags = { + Name = "us-east-1-instance-2" + SecurityGroup = "instance-east-security-group" + } +} + +# ... + +output "us-west-1-instance-1-public-ip" { + value = aws_instance.us-west-1-instance-1.public_ip +} + +output "us-west-1-instance-2-public-ip" { + value = aws_instance.us-west-1-instance-2.public_ip +} + +output "us-east-1-instance-1-public-ip" { + value = aws_instance.us-east-1-instance-1.public_ip +} + +output "us-east-1-instance-2-public-ip" { + value = aws_instance.us-east-1-instance-2.public_ip +} + + diff --git a/aws/aws_vpc_peering/terraform.tfstate.backup b/aws/aws_vpc_peering/terraform.tfstate.backup new file mode 100644 index 0000000..1d99e40 --- /dev/null +++ b/aws/aws_vpc_peering/terraform.tfstate.backup @@ -0,0 +1,1225 @@ +{ + "version": 4, + "terraform_version": "1.6.4", + "serial": 238, + "lineage": "061fcdf6-790c-d6b1-daa8-0a270cb1098d", + "outputs": { + "us-east-1-instance-1-public-ip": { + "value": "35.170.185.226", + "type": "string" + }, + "us-east-1-instance-2-public-ip": { + "value": "3.239.202.177", + "type": "string" + }, + "us-west-1-instance-1-public-ip": { + "value": "54.183.139.140", + "type": "string" + }, + "us-west-1-instance-2-public-ip": { + "value": "54.67.94.5", + "type": "string" + } + }, + "resources": [ + { + "mode": "managed", + "type": "aws_instance", + "name": "us-east-1-instance-1", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-east-1", + "instances": [ + { + "schema_version": 1, + "attributes": { + "ami": "ami-04e369782a6d2125e", + "arn": "arn:aws:ec2:us-east-1:349761350494:instance/i-0af840dc385d7adcb", + "associate_public_ip_address": true, + "availability_zone": "us-east-1c", + "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": 2 + } + ], + "cpu_threads_per_core": 2, + "credit_specification": [ + { + "cpu_credits": "unlimited" + } + ], + "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-0af840dc385d7adcb", + "instance_initiated_shutdown_behavior": "stop", + "instance_lifecycle": "", + "instance_market_options": [], + "instance_state": "running", + "instance_type": "t3.small", + "ipv6_address_count": 0, + "ipv6_addresses": [], + "key_name": "", + "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": [], + "outpost_arn": "", + "password_data": "", + "placement_group": "", + "placement_partition_number": 0, + "primary_network_interface_id": "eni-0346c453f64b7b8ff", + "private_dns": "ip-10-1-1-87.ec2.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": "10.1.1.87", + "public_dns": "", + "public_ip": "35.170.185.226", + "root_block_device": [ + { + "delete_on_termination": true, + "device_name": "/dev/sda1", + "encrypted": false, + "iops": 100, + "kms_key_id": "", + "tags": {}, + "throughput": 0, + "volume_id": "vol-0007cfd358eb7ee8b", + "volume_size": 8, + "volume_type": "gp2" + } + ], + "secondary_private_ips": [], + "security_groups": [], + "source_dest_check": true, + "spot_instance_request_id": "", + "subnet_id": "subnet-0b8fd542ac3ac99f0", + "tags": { + "Name": "us-east-1-instance-1", + "SecurityGroup": "instance-east-security-group" + }, + "tags_all": { + "Name": "us-east-1-instance-1", + "SecurityGroup": "instance-east-security-group" + }, + "tenancy": "default", + "timeouts": null, + "user_data": "cea2287097610e79f3bb839fad39d116ded10b48", + "user_data_base64": null, + "user_data_replace_on_change": false, + "volume_tags": null, + "vpc_security_group_ids": [ + "sg-0c4cb030408e58dd3" + ] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", + "dependencies": [ + "aws_security_group.us-east-1-instance-sg", + "aws_subnet.us-east-1-subnet-1", + "aws_vpc.us-east-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_instance", + "name": "us-east-1-instance-2", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-east-1", + "instances": [ + { + "schema_version": 1, + "attributes": { + "ami": "ami-04e369782a6d2125e", + "arn": "arn:aws:ec2:us-east-1:349761350494:instance/i-0c81e8d1c35180b62", + "associate_public_ip_address": true, + "availability_zone": "us-east-1b", + "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": 2 + } + ], + "cpu_threads_per_core": 2, + "credit_specification": [ + { + "cpu_credits": "unlimited" + } + ], + "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-0c81e8d1c35180b62", + "instance_initiated_shutdown_behavior": "stop", + "instance_lifecycle": "", + "instance_market_options": [], + "instance_state": "running", + "instance_type": "t3.small", + "ipv6_address_count": 0, + "ipv6_addresses": [], + "key_name": "", + "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": [], + "outpost_arn": "", + "password_data": "", + "placement_group": "", + "placement_partition_number": 0, + "primary_network_interface_id": "eni-0ade6c500ec9cde57", + "private_dns": "ip-10-1-2-152.ec2.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": "10.1.2.152", + "public_dns": "", + "public_ip": "3.239.202.177", + "root_block_device": [ + { + "delete_on_termination": true, + "device_name": "/dev/sda1", + "encrypted": false, + "iops": 100, + "kms_key_id": "", + "tags": {}, + "throughput": 0, + "volume_id": "vol-0f4c13aa0554257d3", + "volume_size": 8, + "volume_type": "gp2" + } + ], + "secondary_private_ips": [], + "security_groups": [], + "source_dest_check": true, + "spot_instance_request_id": "", + "subnet_id": "subnet-0a5006434f12ab81a", + "tags": { + "Name": "us-east-1-instance-2", + "SecurityGroup": "instance-east-security-group" + }, + "tags_all": { + "Name": "us-east-1-instance-2", + "SecurityGroup": "instance-east-security-group" + }, + "tenancy": "default", + "timeouts": null, + "user_data": "cea2287097610e79f3bb839fad39d116ded10b48", + "user_data_base64": null, + "user_data_replace_on_change": false, + "volume_tags": null, + "vpc_security_group_ids": [ + "sg-0c4cb030408e58dd3" + ] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", + "dependencies": [ + "aws_security_group.us-east-1-instance-sg", + "aws_subnet.us-east-1-subnet-2", + "aws_vpc.us-east-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_instance", + "name": "us-west-1-instance-1", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-west-1", + "instances": [ + { + "schema_version": 1, + "attributes": { + "ami": "ami-0f3f6663da6750955", + "arn": "arn:aws:ec2:us-west-1:349761350494:instance/i-0ff9245aefa0cc1c4", + "associate_public_ip_address": true, + "availability_zone": "us-west-1c", + "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": 2 + } + ], + "cpu_threads_per_core": 2, + "credit_specification": [ + { + "cpu_credits": "unlimited" + } + ], + "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-0ff9245aefa0cc1c4", + "instance_initiated_shutdown_behavior": "stop", + "instance_lifecycle": "", + "instance_market_options": [], + "instance_state": "running", + "instance_type": "t3.small", + "ipv6_address_count": 0, + "ipv6_addresses": [], + "key_name": "", + "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": [], + "outpost_arn": "", + "password_data": "", + "placement_group": "", + "placement_partition_number": 0, + "primary_network_interface_id": "eni-0d4d0fd7c3612b6a9", + "private_dns": "ip-10-0-1-239.us-west-1.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": "10.0.1.239", + "public_dns": "", + "public_ip": "54.183.139.140", + "root_block_device": [ + { + "delete_on_termination": true, + "device_name": "/dev/sda1", + "encrypted": false, + "iops": 100, + "kms_key_id": "", + "tags": {}, + "throughput": 0, + "volume_id": "vol-079ca1f047f6b1740", + "volume_size": 8, + "volume_type": "gp2" + } + ], + "secondary_private_ips": [], + "security_groups": [], + "source_dest_check": true, + "spot_instance_request_id": "", + "subnet_id": "subnet-0abc3ec32314d1f41", + "tags": { + "Name": "us-west-1-instance-1", + "SecurityGroup": "instance-west-security-group" + }, + "tags_all": { + "Name": "us-west-1-instance-1", + "SecurityGroup": "instance-west-security-group" + }, + "tenancy": "default", + "timeouts": null, + "user_data": "cea2287097610e79f3bb839fad39d116ded10b48", + "user_data_base64": null, + "user_data_replace_on_change": false, + "volume_tags": null, + "vpc_security_group_ids": [ + "sg-0c50bd6752e97a00b" + ] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", + "dependencies": [ + "aws_security_group.us-west-1-instance-sg", + "aws_subnet.us-west-1-subnet-1", + "aws_vpc.us-west-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_instance", + "name": "us-west-1-instance-2", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-west-1", + "instances": [ + { + "schema_version": 1, + "attributes": { + "ami": "ami-0f3f6663da6750955", + "arn": "arn:aws:ec2:us-west-1:349761350494:instance/i-0cad268b6a52b5208", + "associate_public_ip_address": true, + "availability_zone": "us-west-1b", + "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": 2 + } + ], + "cpu_threads_per_core": 2, + "credit_specification": [ + { + "cpu_credits": "unlimited" + } + ], + "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-0cad268b6a52b5208", + "instance_initiated_shutdown_behavior": "stop", + "instance_lifecycle": "", + "instance_market_options": [], + "instance_state": "running", + "instance_type": "t3.small", + "ipv6_address_count": 0, + "ipv6_addresses": [], + "key_name": "", + "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": [], + "outpost_arn": "", + "password_data": "", + "placement_group": "", + "placement_partition_number": 0, + "primary_network_interface_id": "eni-05978279bb00376be", + "private_dns": "ip-10-0-2-74.us-west-1.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": "10.0.2.74", + "public_dns": "", + "public_ip": "54.67.94.5", + "root_block_device": [ + { + "delete_on_termination": true, + "device_name": "/dev/sda1", + "encrypted": false, + "iops": 100, + "kms_key_id": "", + "tags": {}, + "throughput": 0, + "volume_id": "vol-059bb7120b0ed7f1d", + "volume_size": 8, + "volume_type": "gp2" + } + ], + "secondary_private_ips": [], + "security_groups": [], + "source_dest_check": true, + "spot_instance_request_id": "", + "subnet_id": "subnet-0d7c68ad12d2a648b", + "tags": { + "Name": "us-west-1-instance-2", + "SecurityGroup": "instance-west-security-group" + }, + "tags_all": { + "Name": "us-west-1-instance-2", + "SecurityGroup": "instance-west-security-group" + }, + "tenancy": "default", + "timeouts": null, + "user_data": "cea2287097610e79f3bb839fad39d116ded10b48", + "user_data_base64": null, + "user_data_replace_on_change": false, + "volume_tags": null, + "vpc_security_group_ids": [ + "sg-0c50bd6752e97a00b" + ] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMDB9LCJzY2hlbWFfdmVyc2lvbiI6IjEifQ==", + "dependencies": [ + "aws_security_group.us-west-1-instance-sg", + "aws_subnet.us-west-1-subnet-2", + "aws_vpc.us-west-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_route_table", + "name": "us-east-1-route-table", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-east-1", + "instances": [ + { + "schema_version": 0, + "attributes": { + "arn": "arn:aws:ec2:us-east-1:349761350494:route-table/rtb-084e339de78854020", + "id": "rtb-084e339de78854020", + "owner_id": "349761350494", + "propagating_vgws": [], + "route": [], + "tags": null, + "tags_all": {}, + "timeouts": null, + "vpc_id": "vpc-065dddfbb64588639" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJ1cGRhdGUiOjEyMDAwMDAwMDAwMH19", + "dependencies": [ + "aws_vpc.us-east-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_route_table", + "name": "us-west-1-route-table", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-west-1", + "instances": [ + { + "schema_version": 0, + "attributes": { + "arn": "arn:aws:ec2:us-west-1:349761350494:route-table/rtb-07c9c4ed12d42c96b", + "id": "rtb-07c9c4ed12d42c96b", + "owner_id": "349761350494", + "propagating_vgws": [], + "route": [], + "tags": null, + "tags_all": {}, + "timeouts": null, + "vpc_id": "vpc-087c627d211c1faf6" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJ1cGRhdGUiOjEyMDAwMDAwMDAwMH19", + "dependencies": [ + "aws_vpc.us-west-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_route_table_association", + "name": "us-east-1-subnet-1-association", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-east-1", + "instances": [ + { + "schema_version": 0, + "attributes": { + "gateway_id": "", + "id": "rtbassoc-08cf50c09827ce0f9", + "route_table_id": "rtb-084e339de78854020", + "subnet_id": "subnet-0b8fd542ac3ac99f0", + "timeouts": null + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJ1cGRhdGUiOjEyMDAwMDAwMDAwMH19", + "dependencies": [ + "aws_route_table.us-east-1-route-table", + "aws_subnet.us-east-1-subnet-1", + "aws_vpc.us-east-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_route_table_association", + "name": "us-east-1-subnet-2-association", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-east-1", + "instances": [ + { + "schema_version": 0, + "attributes": { + "gateway_id": "", + "id": "rtbassoc-0a2aacaa0e7003102", + "route_table_id": "rtb-084e339de78854020", + "subnet_id": "subnet-0a5006434f12ab81a", + "timeouts": null + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJ1cGRhdGUiOjEyMDAwMDAwMDAwMH19", + "dependencies": [ + "aws_route_table.us-east-1-route-table", + "aws_subnet.us-east-1-subnet-2", + "aws_vpc.us-east-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_route_table_association", + "name": "us-west-1-subnet-1-association", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-west-1", + "instances": [ + { + "schema_version": 0, + "attributes": { + "gateway_id": "", + "id": "rtbassoc-08473bd1a7a981b70", + "route_table_id": "rtb-07c9c4ed12d42c96b", + "subnet_id": "subnet-0abc3ec32314d1f41", + "timeouts": null + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJ1cGRhdGUiOjEyMDAwMDAwMDAwMH19", + "dependencies": [ + "aws_route_table.us-west-1-route-table", + "aws_subnet.us-west-1-subnet-1", + "aws_vpc.us-west-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_route_table_association", + "name": "us-west-1-subnet-2-association", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-west-1", + "instances": [ + { + "schema_version": 0, + "attributes": { + "gateway_id": "", + "id": "rtbassoc-0cc2ef70151fc7795", + "route_table_id": "rtb-07c9c4ed12d42c96b", + "subnet_id": "subnet-0d7c68ad12d2a648b", + "timeouts": null + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDAsImRlbGV0ZSI6MzAwMDAwMDAwMDAwLCJ1cGRhdGUiOjEyMDAwMDAwMDAwMH19", + "dependencies": [ + "aws_route_table.us-west-1-route-table", + "aws_subnet.us-west-1-subnet-2", + "aws_vpc.us-west-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_security_group", + "name": "us-east-1-instance-sg", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-east-1", + "instances": [ + { + "schema_version": 1, + "attributes": { + "arn": "arn:aws:ec2:us-east-1:349761350494:security-group/sg-0c4cb030408e58dd3", + "description": "Managed by Terraform", + "egress": [ + { + "cidr_blocks": [ + "10.1.0.0/16", + "0.0.0.0/0" + ], + "description": "", + "from_port": 0, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "-1", + "security_groups": [], + "self": false, + "to_port": 0 + } + ], + "id": "sg-0c4cb030408e58dd3", + "ingress": [ + { + "cidr_blocks": [ + "0.0.0.0/0" + ], + "description": "", + "from_port": 22, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [], + "self": false, + "to_port": 22 + }, + { + "cidr_blocks": [ + "0.0.0.0/0" + ], + "description": "", + "from_port": 443, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [], + "self": false, + "to_port": 443 + }, + { + "cidr_blocks": [ + "0.0.0.0/0" + ], + "description": "", + "from_port": 80, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [], + "self": false, + "to_port": 80 + } + ], + "name": "terraform-20231118005438355900000001", + "name_prefix": "terraform-", + "owner_id": "349761350494", + "revoke_rules_on_delete": false, + "tags": { + "Name": "instance-east-security-group" + }, + "tags_all": { + "Name": "instance-east-security-group" + }, + "timeouts": null, + "vpc_id": "vpc-065dddfbb64588639" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0=", + "dependencies": [ + "aws_vpc.us-east-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_security_group", + "name": "us-west-1-instance-sg", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-west-1", + "instances": [ + { + "schema_version": 1, + "attributes": { + "arn": "arn:aws:ec2:us-west-1:349761350494:security-group/sg-0c50bd6752e97a00b", + "description": "Managed by Terraform", + "egress": [ + { + "cidr_blocks": [ + "10.1.0.0/16", + "0.0.0.0/0" + ], + "description": "", + "from_port": 0, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "-1", + "security_groups": [], + "self": false, + "to_port": 0 + } + ], + "id": "sg-0c50bd6752e97a00b", + "ingress": [ + { + "cidr_blocks": [ + "0.0.0.0/0" + ], + "description": "", + "from_port": 22, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [], + "self": false, + "to_port": 22 + }, + { + "cidr_blocks": [ + "0.0.0.0/0" + ], + "description": "", + "from_port": 443, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [], + "self": false, + "to_port": 443 + }, + { + "cidr_blocks": [ + "0.0.0.0/0" + ], + "description": "", + "from_port": 80, + "ipv6_cidr_blocks": [], + "prefix_list_ids": [], + "protocol": "tcp", + "security_groups": [], + "self": false, + "to_port": 80 + } + ], + "name": "terraform-20231118005439030200000001", + "name_prefix": "terraform-", + "owner_id": "349761350494", + "revoke_rules_on_delete": false, + "tags": { + "Name": "instance-west-security-group" + }, + "tags_all": { + "Name": "instance-west-security-group" + }, + "timeouts": null, + "vpc_id": "vpc-087c627d211c1faf6" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6OTAwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIxIn0=", + "dependencies": [ + "aws_vpc.us-west-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_subnet", + "name": "us-east-1-subnet-1", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-east-1", + "instances": [ + { + "schema_version": 1, + "attributes": { + "arn": "arn:aws:ec2:us-east-1:349761350494:subnet/subnet-0b8fd542ac3ac99f0", + "assign_ipv6_address_on_creation": false, + "availability_zone": "us-east-1c", + "availability_zone_id": "use1-az2", + "cidr_block": "10.1.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-0b8fd542ac3ac99f0", + "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": "349761350494", + "private_dns_hostname_type_on_launch": "ip-name", + "tags": null, + "tags_all": {}, + "timeouts": null, + "vpc_id": "vpc-065dddfbb64588639" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9", + "dependencies": [ + "aws_vpc.us-east-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_subnet", + "name": "us-east-1-subnet-2", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-east-1", + "instances": [ + { + "schema_version": 1, + "attributes": { + "arn": "arn:aws:ec2:us-east-1:349761350494:subnet/subnet-0a5006434f12ab81a", + "assign_ipv6_address_on_creation": false, + "availability_zone": "us-east-1b", + "availability_zone_id": "use1-az1", + "cidr_block": "10.1.2.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-0a5006434f12ab81a", + "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": "349761350494", + "private_dns_hostname_type_on_launch": "ip-name", + "tags": null, + "tags_all": {}, + "timeouts": null, + "vpc_id": "vpc-065dddfbb64588639" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9", + "dependencies": [ + "aws_vpc.us-east-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_subnet", + "name": "us-west-1-subnet-1", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-west-1", + "instances": [ + { + "schema_version": 1, + "attributes": { + "arn": "arn:aws:ec2:us-west-1:349761350494:subnet/subnet-0abc3ec32314d1f41", + "assign_ipv6_address_on_creation": false, + "availability_zone": "us-west-1c", + "availability_zone_id": "usw1-az1", + "cidr_block": "10.0.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-0abc3ec32314d1f41", + "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": "349761350494", + "private_dns_hostname_type_on_launch": "ip-name", + "tags": null, + "tags_all": {}, + "timeouts": null, + "vpc_id": "vpc-087c627d211c1faf6" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9", + "dependencies": [ + "aws_vpc.us-west-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_subnet", + "name": "us-west-1-subnet-2", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-west-1", + "instances": [ + { + "schema_version": 1, + "attributes": { + "arn": "arn:aws:ec2:us-west-1:349761350494:subnet/subnet-0d7c68ad12d2a648b", + "assign_ipv6_address_on_creation": false, + "availability_zone": "us-west-1b", + "availability_zone_id": "usw1-az3", + "cidr_block": "10.0.2.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-0d7c68ad12d2a648b", + "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": "349761350494", + "private_dns_hostname_type_on_launch": "ip-name", + "tags": null, + "tags_all": {}, + "timeouts": null, + "vpc_id": "vpc-087c627d211c1faf6" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6MTIwMDAwMDAwMDAwMH0sInNjaGVtYV92ZXJzaW9uIjoiMSJ9", + "dependencies": [ + "aws_vpc.us-west-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_vpc", + "name": "us-east-1", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-east-1", + "instances": [ + { + "schema_version": 1, + "attributes": { + "arn": "arn:aws:ec2:us-east-1:349761350494:vpc/vpc-065dddfbb64588639", + "assign_generated_ipv6_cidr_block": false, + "cidr_block": "10.1.0.0/16", + "default_network_acl_id": "acl-0a7603e25f1233cef", + "default_route_table_id": "rtb-08ce8d4dfff1f1f86", + "default_security_group_id": "sg-0986bd00c792c02f6", + "dhcp_options_id": "dopt-6e030515", + "enable_dns_hostnames": false, + "enable_dns_support": true, + "enable_network_address_usage_metrics": false, + "id": "vpc-065dddfbb64588639", + "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-08ce8d4dfff1f1f86", + "owner_id": "349761350494", + "tags": null, + "tags_all": {} + }, + "sensitive_attributes": [], + "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==" + } + ] + }, + { + "mode": "managed", + "type": "aws_vpc", + "name": "us-west-1", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-west-1", + "instances": [ + { + "schema_version": 1, + "attributes": { + "arn": "arn:aws:ec2:us-west-1:349761350494:vpc/vpc-087c627d211c1faf6", + "assign_generated_ipv6_cidr_block": false, + "cidr_block": "10.0.0.0/16", + "default_network_acl_id": "acl-0a625ac6d1577cf74", + "default_route_table_id": "rtb-01f025a6d0914dec0", + "default_security_group_id": "sg-05043c20973654d7d", + "dhcp_options_id": "dopt-1adbfc7d", + "enable_dns_hostnames": false, + "enable_dns_support": true, + "enable_network_address_usage_metrics": false, + "id": "vpc-087c627d211c1faf6", + "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-01f025a6d0914dec0", + "owner_id": "349761350494", + "tags": null, + "tags_all": {} + }, + "sensitive_attributes": [], + "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==" + } + ] + }, + { + "mode": "managed", + "type": "aws_vpc_peering_connection", + "name": "peering_connection", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-west-1", + "instances": [ + { + "schema_version": 0, + "attributes": { + "accept_status": "pending-acceptance", + "accepter": [], + "auto_accept": false, + "id": "pcx-07c02e0bfd18ccdb9", + "peer_owner_id": "349761350494", + "peer_region": "us-east-1", + "peer_vpc_id": "vpc-065dddfbb64588639", + "requester": [ + { + "allow_remote_vpc_dns_resolution": false + } + ], + "tags": null, + "tags_all": {}, + "timeouts": null, + "vpc_id": "vpc-087c627d211c1faf6" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMCwiZGVsZXRlIjo2MDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMH19", + "dependencies": [ + "aws_vpc.us-east-1", + "aws_vpc.us-west-1" + ] + } + ] + }, + { + "mode": "managed", + "type": "aws_vpc_peering_connection_accepter", + "name": "peering_accepter", + "provider": "provider[\"registry.terraform.io/hashicorp/aws\"].us-east-1", + "instances": [ + { + "schema_version": 0, + "attributes": { + "accept_status": "active", + "accepter": [ + { + "allow_remote_vpc_dns_resolution": false + } + ], + "auto_accept": true, + "id": "pcx-07c02e0bfd18ccdb9", + "peer_owner_id": "349761350494", + "peer_region": "us-east-1", + "peer_vpc_id": "vpc-065dddfbb64588639", + "requester": [ + { + "allow_remote_vpc_dns_resolution": false + } + ], + "tags": null, + "tags_all": {}, + "timeouts": null, + "vpc_id": "vpc-087c627d211c1faf6", + "vpc_peering_connection_id": "pcx-07c02e0bfd18ccdb9" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMCwidXBkYXRlIjo2MDAwMDAwMDAwMH19", + "dependencies": [ + "aws_vpc.us-east-1", + "aws_vpc.us-west-1", + "aws_vpc_peering_connection.peering_connection" + ] + } + ] + } + ], + "check_results": null +} diff --git a/aws/aws_vpc_peering/user-data.sh b/aws/aws_vpc_peering/user-data.sh new file mode 100644 index 0000000..bbf36b4 --- /dev/null +++ b/aws/aws_vpc_peering/user-data.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Install necessary packages +sudo apt-get update +sudo apt-get install -y git amazon-efs-utils vim-nox neofetch htop tmux curl wget nginx + +# Create new user with sudo privileges +sudo useradd -m -s /bin/bash greg +sudo usermod -aG sudo greg + +# Add authorized keys for your public key +sudo mkdir -p /home/greg/.ssh +sudo touch /home/greg/.ssh/authorized_keys +sudo chmod 700 /home/greg/.ssh +sudo chmod 600 /home/greg/.ssh/authorized_keys +sudo chown -R greg:greg /home/greg/.ssh + +# Add your public key to authorized_keys +sudo echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCdOF80z0piQEnYzNCu2OGvOJdm7+3wfDuiC+Jzi8VbSC5VW4iJAQXOuDNGLzyqNi6uMjI77xpEL6Xzn29uJiQti6Y/LxhOZwNNIQiGUpFco1wkBYeBFbtgHQxsMLwumrxQGEj2fyCiSrACAPyy/l1fP4mlN7abBGD5aozBrYKxXPS/kfwO5nsWmw27RgTzfHJzie2dUU3ew/kd7td3wEdWrRXq8wNbu+yvAyiog54huUUWmYZwY3QVwXr6R1wsVudawM6BEl45QFq+hdB4t83azHG94XLy2NCAncohdU7zP40nsbvIDyh+4wIKeU90z6TLrXfHUYuBT6/ky7qOFm/Ym1QG4zCDz3jin8Qoa31PGaObzj/zoMJXgOXKcp16W0j9SZAenvnSfuWUEfBR1yBRR0T5Wg5v1vi7KGBTATaz8el802uliL+yZbGtMbNpAPGR5nK5C4yorf8yVYvIgo/LJaWCDND2O1e2mdut1WyRmvIwMnq7PFZT8zAsgGXfhDM= greg@ligma" >> /home/greg/.ssh/authorized_keys + +# Set hostname +INSTANCE_ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id) +AVAILABILITY_ZONE=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone) +HOSTNAME="$INSTANCE_ID-$AVAILABILITY_ZONE" +sudo hostnamectl set-hostname $HOSTNAME + +echo "hello world" >> /var/www/html/index.html +systemctm restart nginx + +# Run cloud-init.sh script +# sudo sh /path/to/cloud-init.sh