From d0e0ba718f77a5935c022ff9d9d38297e82d660a Mon Sep 17 00:00:00 2001 From: ACE-336 <167769682+ACE-336@users.noreply.github.com> Date: Thu, 9 May 2024 21:20:34 -0400 Subject: [PATCH] Update i2_vpc_cloud_project.tf --- i2_vpc_cloud_project.tf | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/i2_vpc_cloud_project.tf b/i2_vpc_cloud_project.tf index a0dfba4..b1d3418 100644 --- a/i2_vpc_cloud_project.tf +++ b/i2_vpc_cloud_project.tf @@ -53,7 +53,7 @@ resource "aws_vpn_gateway" "i2_project_terraform_virtual_private_gateway" { } } -// Attach Virtual Private Gateway to VPC +// Attach Virtual Private Gateway // https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpn_gateway_attachment resource "aws_vpn_gateway_attachment" "vpn_attachment" { vpc_id = aws_vpc.i2_project_aws_terraform_vpc.id @@ -72,6 +72,36 @@ resource "aws_dx_gateway_association_proposal" "i2_project_terraform_dx_gateway_ allowed_prefixes = ["10.3.1.0/24"] } +// Create Internet Gateway +// https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/internet_gateway +resource "aws_internet_gateway" "i2_project_aws_terraform_igw" { + vpc_id = aws_vpc.i2_project_aws_terraform_vpc.id + tags = { + Name = "i2_project_terraform_igw" + } +} + +// Create a route table +// https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route_table.html +resource "aws_route_table" "i2_project_aws_terraform_route_table" { + vpc_id = aws_vpc.i2_project_aws_terraform_vpc.id +} + +// Create a route to the Internet Gateway +// https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route +resource "aws_route" "i2_project_aws_terraform_internet_gateway_route" { + route_table_id = aws_route_table.i2_project_aws_terraform_route_table.id + destination_cidr_block = "0.0.0.0/0" + gateway_id = aws_internet_gateway.i2_project_aws_terraform_igw.id +} + +// Associate the route table with the subnet +// https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route_table_association +resource "aws_route_table_association" "i2_project_aws_terraform_route_table_association" { + subnet_id = aws_subnet.i2_project_aws_terraform_subnet_1.id + route_table_id = aws_route_table.i2_project_aws_terraform_route_table.id +} + // ***AWS Security Group*** // https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group resource "aws_security_group" "allow_ssh_icmp_from_gcp" {