-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.tf
68 lines (62 loc) · 1.65 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
64
65
66
67
68
# https://www.terraform.io/docs/providers/do/index.html
provider "digitalocean" {
token = "${var.DO_API_TOKEN}"
}
# https://www.terraform.io/docs/backends/types/local.html
data "terraform_remote_state" "root" {
backend = "local"
config {
path = "../../../terraform.tfstate"
}
}
# https://www.terraform.io/docs/backends/types/local.html
data "terraform_remote_state" "flips" {
backend = "local"
config {
path = "../../../flips/terraform.tfstate"
}
}
resource "digitalocean_firewall" "server_firewall" {
name = "server-000-deny-all-${uuid()}"
lifecycle {
ignore_changes = "name"
}
tags = ["${data.terraform_remote_state.root.server_tag_id}"]
droplet_ids = []
inbound_rule = [
{
# For ansible to work
protocol = "tcp"
port_range = "22"
source_addresses = ["0.0.0.0/0", "::/0"]
source_tags = []
source_droplet_ids = []
},
]
outbound_rule = [
{
# For apt installation
protocol = "tcp"
port_range = "443"
destination_addresses = ["0.0.0.0/0", "::/0"]
destination_tags = []
destination_droplet_ids = []
},
{
# For apt installation
protocol = "tcp"
port_range = "80"
destination_addresses = ["0.0.0.0/0", "::/0"]
destination_tags = []
destination_droplet_ids = []
},
{
# For name resolution
protocol = "udp"
port_range = "53"
destination_addresses = ["0.0.0.0/0", "::/0"]
destination_tags = []
destination_droplet_ids = []
},
]
}