Skip to content

Commit ebd4f82

Browse files
committed
added aws vpc initial check-ins
1 parent fbcd404 commit ebd4f82

File tree

4 files changed

+105
-0
lines changed

4 files changed

+105
-0
lines changed

terraform-aws-vpc/private_subnets.tf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
resource "aws_subnet" "private_1" {
2+
vpc_id = aws_vpc.vpc_demo.id
3+
map_public_ip_on_launch = false
4+
cidr_block = "10.0.4.0/24"
5+
6+
tags = {
7+
Name = "private_1"
8+
}
9+
}
10+
resource "aws_subnet" "private_2" {
11+
vpc_id = aws_vpc.vpc_demo.id
12+
map_public_ip_on_launch = false
13+
cidr_block = "10.0.5.0/24"
14+
15+
tags = {
16+
Name = "private_1"
17+
}
18+
}
19+
resource "aws_subnet" "private_3" {
20+
vpc_id = aws_vpc.vpc_demo.id
21+
map_public_ip_on_launch = false
22+
cidr_block = "10.0.6.0/24"
23+
24+
tags = {
25+
Name = "private_1"
26+
}
27+
}

terraform-aws-vpc/public_subnets.tf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
resource "aws_subnet" "public_1" {
2+
vpc_id = aws_vpc.vpc_demo.id
3+
map_public_ip_on_launch = true
4+
cidr_block = "10.0.1.0/24"
5+
6+
tags = {
7+
Name = "public_1"
8+
}
9+
}
10+
resource "aws_subnet" "public_2" {
11+
vpc_id = aws_vpc.vpc_demo.id
12+
map_public_ip_on_launch = true
13+
cidr_block = "10.0.2.0/24"
14+
15+
tags = {
16+
Name = "public_1"
17+
}
18+
}
19+
resource "aws_subnet" "public_3" {
20+
vpc_id = aws_vpc.vpc_demo.id
21+
map_public_ip_on_launch = true
22+
cidr_block = "10.0.3.0/24"
23+
24+
tags = {
25+
Name = "public_1"
26+
}
27+
}

terraform-aws-vpc/variables.tf

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
variable "cidr" {
2+
description = "The CIDR block for the VPC. Default value is a valid CIDR, but not acceptable by AWS and should be overridden"
3+
type = string
4+
default = "10.0.0.0/16"
5+
}
6+
variable "instance_tenancy" {
7+
description = "A tenancy option for instances launched into the VPC"
8+
type = string
9+
default = "default"
10+
}
11+
12+
variable "enable_dns_hostnames" {
13+
description = "Should be true to enable DNS hostnames in the VPC"
14+
type = bool
15+
default = true
16+
}
17+
18+
variable "enable_dns_support" {
19+
description = "Should be true to enable DNS support in the VPC"
20+
type = bool
21+
default = true
22+
}
23+
24+
variable "enable_classiclink" {
25+
description = "Should be true to enable ClassicLink for the VPC. Only valid in regions and accounts that support EC2 Classic."
26+
type = bool
27+
default = false
28+
}
29+
30+
variable "tags" {
31+
description = "A map of tags to add to all resources"
32+
type = string
33+
default = "Vpc-custom-demo"
34+
}

terraform-aws-vpc/vpc.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
######
2+
# VPC
3+
######
4+
#terraform version >= 12
5+
############
6+
resource "aws_vpc" "vpc_demo" {
7+
cidr_block = var.cidr
8+
instance_tenancy = var.instance_tenancy
9+
enable_dns_hostnames = var.enable_dns_hostnames
10+
enable_dns_support = var.enable_dns_support
11+
enable_classiclink = var.enable_classiclink
12+
13+
tags = {
14+
Name = var.tags
15+
}
16+
17+
}

0 commit comments

Comments
 (0)