-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
46 lines (41 loc) · 1.37 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
data "aws_caller_identity" "current" {}
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "~> 5.4.0"
azs = local.azs
cidr = var.vpc_cidr
create_igw = true # Expose public subnetworks to the Internet
enable_nat_gateway = true # Hide private subnetworks behind NAT Gateway
private_subnets = var.private_subnet_cidrs
private_subnet_names = local.private_subnet_names
public_subnets = var.public_subnet_cidrs
public_subnet_names = local.public_subnet_names
single_nat_gateway = true
one_nat_gateway_per_az = false
name = "${var.application}-vpc"
default_vpc_name = "${var.application}-vpc"
default_network_acl_name = "${var.application}-vpc-nacl"
default_route_table_name = "${var.application}-vpc-rt"
default_security_group_name = "${var.application}-vpc-sg"
default_security_group_egress = [
{
from_port = 80
to_port = 80
description = "HTTP traffic"
protocol = "tcp"
cidr_blocks = "0.0.0.0/0"
},
{
from_port = 443
to_port = 443
description = "HTTPS traffic"
protocol = "tcp"
cidr_blocks = "0.0.0.0/0"
}
]
}
module "ecs" {
source = "terraform-aws-modules/ecs/aws"
version = "~> 5.7.0"
cluster_name = "${var.application}-cluster"
}