Did VPC + created a subnet under that vpc.

This commit is contained in:
K
2025-09-08 10:12:33 +05:30
parent b5c5e36e56
commit eb2a5fac14
+26
View File
@@ -0,0 +1,26 @@
provider "aws" {
region = "ap-south-1"
}
resource "aws_vpc" "TestVPC" { # Create a VPC
cidr_block = "172.16.0.0/16" # Specify CIDR block (IP range)
enable_dns_support = true # DNS support
enable_dns_hostnames = true # Hostname support
tags = {
Name = "TestVPC" # Name for VPC (on AWS)
}
}
resource "aws_subnet" "TestSubnetOne" { # Create subnet
vpc_id = aws_vpc.TestVPC.id # Specify VPC under which subnet should be created
cidr_block = "172.16.1.0/24" # Specify segment of IP range (from VPC) for this subnet
availability_zone = "ap-south-1a" # Set availability zone
tags = {
Name = "TestSubnet1" # Name for subnet (on AWS)
}
}
# Internet gateway
# Route table
# Route
# Table association