-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathfirewall_rules.tf
41 lines (38 loc) · 1.08 KB
/
firewall_rules.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
# firewall_rules.tf
locals {
# Firewall Rules definition
firewall_rules = {
"main-cni-vpc" = { # VPC Name here for the subset of rules below
rules = [{
name = "allow-ssh-ingress"
description = "Permit SSH into the VM"
direction = "INGRESS"
priority = null
ranges = ["0.0.0.0/0"]
source_tags = null
source_service_accounts = null
target_tags = ["ssh"]
target_service_accounts = null
allow = [{
protocol = "tcp"
ports = ["22"]
}]
deny = []
log_config = {
metadata = "INCLUDE_ALL_METADATA"
}
}
]
}
}
}
# Firewall Rules Creation
module "firewall_rules" {
for_each = local.firewall_rules
source = "terraform-google-modules/network/google//modules/firewall-rules"
version = "5.2.0"
project_id = var.project_id
network_name = each.key
rules = each.value.rules
depends_on = [module.vpcs]
}