-
Notifications
You must be signed in to change notification settings - Fork 0
/
terraform-network.tf
83 lines (70 loc) · 2.68 KB
/
terraform-network.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
82
83
resource "google_compute_address" "github" {
name = "github"
region = "${var.region}"
project = "${var.project}"
}
resource "google_compute_network" "github" {
name = "${var.network}"
project = "${var.project}"
auto_create_subnetworks = "false"
}
resource "google_compute_subnetwork" "github" {
name = "github-${var.region}"
network = "${google_compute_network.github.self_link}"
ip_cidr_range = "${var.github-cidr}"
}
resource "google_compute_firewall" "internet-to-github-http" {
name = "internet-to-github-http"
description = "Web application access. All requests are redirected to the HTTPS port when SSL is enabled."
count = "${var.firewall-internet-to-github-http-enabled ? 1 : 0}"
network = "${google_compute_network.github.self_link}"
target_tags = ["${var.github-tag}"]
allow = {
protocol = "tcp"
ports = ["22"]
}
}
resource "google_compute_firewall" "internet-to-github-https" {
name = "internet-to-github-https"
description = "Web application and Git over HTTPS access."
count = "${var.firewall-internet-to-github-https-enabled ? 1 : 0}"
network = "${google_compute_network.github.self_link}"
target_tags = ["${var.github-tag}"]
allow = {
protocol = "tcp"
ports = ["443"]
}
}
resource "google_compute_firewall" "internet-to-github-https-console" {
name = "internet-to-github-https-console"
description = "Secure web based Management Console. Required for basic installation and configuration."
count = "${var.firewall-internet-to-github-https-console-enabled ? 1 : 0}"
network = "${google_compute_network.github.self_link}"
target_tags = ["${var.github-tag}"]
allow = {
protocol = "tcp"
ports = ["8443"]
}
}
resource "google_compute_firewall" "internet-to-github-ssh-git" {
name = "internet-to-github-ssh-git"
description = "Secure web based Management Console. Required for basic installation and configuration."
count = "${var.firewall-internet-to-github-ssh-git-enabled ? 1 : 0}"
network = "${google_compute_network.github.self_link}"
target_tags = ["${var.github-tag}"]
allow = {
protocol = "tcp"
ports = ["22"]
}
}
resource "google_compute_firewall" "internet-to-github-ssh-shell" {
name = "internet-to-github-ssh-shell"
description = "Secure web based Management Console. Required for basic installation and configuration."
count = "${var.firewall-internet-to-github-ssh-shell-enabled ? 1 : 0}"
network = "${google_compute_network.github.self_link}"
target_tags = ["${var.github-tag}"]
allow = {
protocol = "tcp"
ports = ["122"]
}
}