-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
63 lines (47 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.38.0"
}
}
}
locals {
tags = {
Project = "Wordpress Solution"
Environment = "Dev"
ManagedBy = "Terraform"
}
}
module "wp-alb" {
source = "./modules/alb"
name = "internet-facing-wp-alb"
vpc_id = module.three_tier_vpc.vpc_id
lb_sg_id = aws_security_group.alb.id
subnet_az1_id = module.three_tier_vpc.public_subnets_id[0]
subnet_az2_id = module.three_tier_vpc.public_subnets_id[1]
targets = module.wordpress_instances.ec2_targets
tags = local.tags
depends_on = [ module.three_tier_vpc, module.wordpress_instances ]
}
module "three_tier_vpc" {
source = "./modules/vpc"
name = "my-vpc"
cidr = "10.0.0.0/16"
azs = ["us-east-1a", "us-east-1b"]
public_subnets = ["10.0.0.0/24", "10.0.1.0/24"]
private_subnets = ["10.0.101.0/24", "10.0.102.0/24",
"10.0.103.0/24", "10.0.104.0/24"]
public_subnet_map_public_ip_on_launch = true
create_public_nat_gateway = true
create_ec2_endpoint = true
tags = local.tags
}
module "wordpress_instances" {
source = "./modules/ec2"
name = "wordpress"
ec2_subnets = module.three_tier_vpc.ec2_private_subnets
security_groups = [aws_security_group.wordpress_instances.id]
key_pair = "Bastion host key pair - AWS Wordpress Solution - Dev"
tags = local.tags
}