-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
74 lines (66 loc) · 1.78 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
terraform {
backend "s3" {
#define bucket and key
bucket = "var.bucket"
key = "var.key"
region = "eu-west-2"
#define dynamo DB tables to use
dynamodb_table = "var.dynamodb_table"
encrypt = true
}
}
provider "aws" {
region = "${var.region}"
shared_credentials_file = "~/.aws/credentials"
profile = "default"
}
#Defining VPC and CIDR
resource "aws_vpc" "Main" {
cidr_block = "${var.CIDR-Block}"
enable_dns_hostnames = "true"
enable_dns_support = "true"
tags = {
Name = "Main"
Type = "prod"
}
}
module "Public-Subnets" {
source = "./src/Subnet-public"
CIDR-Block = "${var.CIDR-Block}"
Public-CIDR = "${var.Public-CIDR}"
vpc_id = aws_vpc.Main.id
}
module "Private-Subnets" {
source = "./src/Subnet-Private"
CIDR-Block = "${var.CIDR-Block}"
Private-CIDR = "${var.Private-CIDR}"
vpc_id = aws_vpc.Main.id
}
module "Restricted-Subnets" {
source = "./src/Subnet-Restricted"
CIDR-Block = "${var.CIDR-Block}"
Restricted-CIDR = "${var.Restricted-CIDR}"
vpc_id = aws_vpc.Main.id
}
module "InetGW" {
source = "./src/InetGW"
vpc_id = aws_vpc.Main.id
}
module "RouteTables" {
source = "./src/RouteTable"
vpc_id = aws_vpc.Main.id
inet-gw-id = module.InetGW.Internet-gateway-id
public-subnet-id = module.Public-Subnets.Public-Subnet-id
private-subnet-id = module.Private-Subnets.Private-subnet-id
Restricted-subnet-id = module.Restricted-Subnets.Restricted-Subnet-id
NatGateway = module.NatGateway.Nat-Gateway-id
}
module "NatGateway"{
source = "./src/NatGateway"
vpc_id = aws_vpc.Main.id
Public-subnet-id = module.Public-Subnets.Public-Subnet-id
}
module "Logging"{
source = "./src/Logging"
vpc_id = aws_vpc.Main.id
}