-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-sg.tf
81 lines (65 loc) · 1.93 KB
/
create-sg.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
75
76
77
78
79
80
81
data "http" "myip" {
url = "http://ipv4.icanhazip.com"
}
module "bastion_sg" {
source = "terraform-aws-modules/security-group/aws//modules/ssh"
name = "bastion"
description = "Security group for Bastion host"
vpc_id = module.vpc.vpc_id
ingress_cidr_blocks = ["${chomp(data.http.myip.body)}/32"]
tags = var.project_tags
}
module "ssh_internal_sg" {
source = "terraform-aws-modules/security-group/aws//modules/ssh"
name = "SSH"
description = "Security group for internal SSH access"
vpc_id = module.vpc.vpc_id
ingress_cidr_blocks = module.vpc.private_subnets_cidr_blocks
tags = var.project_tags
}
module "ssh_bastion_sg" {
source = "terraform-aws-modules/security-group/aws//modules/ssh"
name = "SSH"
description = "Security group for bastion SSH access"
vpc_id = module.vpc.vpc_id
ingress_cidr_blocks = [ "${module.ec2_bastion.private_ip[0]}/32" ]
tags = var.project_tags
}
module "consul_sg" {
source = "terraform-aws-modules/security-group/aws"
name = "consul"
description = "Security group for Consul"
vpc_id = module.vpc.vpc_id
ingress_cidr_blocks = module.vpc.private_subnets_cidr_blocks
ingress_with_cidr_blocks = [
{
from_port = 8300
to_port = 8300
protocol = "tcp"
description = "Server RPC"
},
{
from_port = 8301
to_port = 8301
protocol = "tcp"
description = "Serf LAN"
},
]
tags = var.project_tags
}
module "vault_sg" {
source = "terraform-aws-modules/security-group/aws"
name = "vault"
description = "Security group for Vault"
vpc_id = module.vpc.vpc_id
ingress_cidr_blocks = module.vpc.private_subnets_cidr_blocks
ingress_with_cidr_blocks = [
{
from_port = 8200
to_port = 8200
protocol = "tcp"
description = "Vault API"
},
]
tags = var.project_tags
}