filmov
tv
Terraform Tamil using Aws Vpc create
Показать описание
How to create #aws #vpc Using #terraform
# Create Test vpc
resource "aws_vpc" "Test_vpc" {
cidr_block = "10.0.0.0/16"
instance_tenancy = "default"
tags = {
Name = "TEst-Vpc"
}
}
# Create Public subnet
resource "aws_subnet" "Public" {
availability_zone = "ap-south-1a"
cidr_block = "10.0.2.0/24"
tags = {
Name="Public-subnet"
}
}
# Create Private subnet
resource "aws_subnet" "Private" {
availability_zone = "ap-south-1b"
cidr_block = "10.0.1.0/24"
tags = {
Name="Private-subnet"
}
}
# Create Route Table Private
resource "aws_route_table" "Pri_R" {
tags = {
Name="Private Route table "
}
}
# Create Route Table public
resource "aws_route_table" "Pub_R" {
route {
cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.IGW.id
}
tags = {
Name="Public Route table "
}
}
#Private Route table subnet associations
resource "aws_route_table_association" "RT_A_Pri-sub" {
subnet_id = aws_subnet.Private. id
route_table_id = aws_route_table.Pri_R.id
}
#Public Route table subnet associations
resource "aws_route_table_association" "RT_A_Pub-sub" {
subnet_id = aws_subnet.Public. id
route_table_id = aws_route_table.Pub_R.id
}
# Create internet gateway
resource "aws_internet_gateway" "IGW" {
tags = {
Name="IGW"
}
}
# Create Test vpc
resource "aws_vpc" "Test_vpc" {
cidr_block = "10.0.0.0/16"
instance_tenancy = "default"
tags = {
Name = "TEst-Vpc"
}
}
# Create Public subnet
resource "aws_subnet" "Public" {
availability_zone = "ap-south-1a"
cidr_block = "10.0.2.0/24"
tags = {
Name="Public-subnet"
}
}
# Create Private subnet
resource "aws_subnet" "Private" {
availability_zone = "ap-south-1b"
cidr_block = "10.0.1.0/24"
tags = {
Name="Private-subnet"
}
}
# Create Route Table Private
resource "aws_route_table" "Pri_R" {
tags = {
Name="Private Route table "
}
}
# Create Route Table public
resource "aws_route_table" "Pub_R" {
route {
cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.IGW.id
}
tags = {
Name="Public Route table "
}
}
#Private Route table subnet associations
resource "aws_route_table_association" "RT_A_Pri-sub" {
subnet_id = aws_subnet.Private. id
route_table_id = aws_route_table.Pri_R.id
}
#Public Route table subnet associations
resource "aws_route_table_association" "RT_A_Pub-sub" {
subnet_id = aws_subnet.Public. id
route_table_id = aws_route_table.Pub_R.id
}
# Create internet gateway
resource "aws_internet_gateway" "IGW" {
tags = {
Name="IGW"
}
}