-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
main.tf
54 lines (43 loc) 路 1.45 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
provider "aws" {
region = "eu-west-1"
}
#############################################################
# Data sources to get VPC and default security group details
#############################################################
data "aws_vpc" "default" {
default = true
}
data "aws_security_group" "default" {
name = "default"
vpc_id = "${data.aws_vpc.default.id}"
}
###########################
# Security groups examples
###########################
module "http_sg" {
source = "../../modules/https-443"
name = "computed-http-sg"
description = "Security group with HTTP port open for everyone, and HTTPS open just for the default security group"
vpc_id = "${data.aws_vpc.default.id}"
ingress_cidr_blocks = ["0.0.0.0/0"]
ingress_with_source_security_group_id = [
{
rule = "https-443-tcp"
source_security_group_id = "${data.aws_security_group.default.id}"
},
]
}
module "mysql_sg" {
source = "../../modules/mysql"
name = "computed-mysql-sg"
description = "Security group with MySQL/Aurora port open for HTTP security group created above (computed)"
vpc_id = "${data.aws_vpc.default.id}"
ingress_cidr_blocks = ["0.0.0.0/0"]
computed_ingress_with_source_security_group_id = [
{
rule = "mysql-tcp"
source_security_group_id = "${module.http_sg.this_security_group_id}"
},
]
number_of_computed_ingress_with_source_security_group_id = 1
}