-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
70 lines (61 loc) · 1.93 KB
/
main.tf
File metadata and controls
70 lines (61 loc) · 1.93 KB
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
provider "google" {
region = "${var.region}"
project = "${var.project_id}"
credentials = "${file(var.account_file_path)}"
}
resource "google_compute_network" "auto-vpc" {
name = "${var.project_tag}-vpc"
auto_create_subnetworks = "false"
}
resource "google_compute_subnetwork" "auto-subnet-1" {
name = "${var.project_tag}-subnet-1"
ip_cidr_range = "192.168.101.0/24"
network = "${google_compute_network.auto-vpc.self_link}"
region = "${var.region}"
private_ip_google_access = "false"
}
resource "google_compute_subnetwork" "auto-subnet-2" {
name = "${var.project_tag}-subnet-2"
ip_cidr_range = "192.168.102.0/24"
network = "${google_compute_network.auto-vpc.self_link}"
region = "${var.region}"
private_ip_google_access = "false"
}
resource "google_compute_subnetwork" "auto-subnet-3" {
name = "${var.project_tag}-subnet-3"
ip_cidr_range = "192.168.103.0/24"
network = "${google_compute_network.auto-vpc.self_link}"
region = "${var.region}"
private_ip_google_access = "false"
}
resource "google_compute_firewall" "auto-firewall-rule-deny-all" {
name = "${var.project_tag}-firewall-rule-deny-all"
network = "${google_compute_network.auto-vpc.self_link}"
priority = "65534"
deny {
protocol = "all"
}
}
resource "google_compute_firewall" "auto-firewall-rule-allow-internal" {
name = "${var.project_tag}-firewall-rule-allow-internal"
network = "${google_compute_network.auto-vpc.self_link}"
allow {
protocol = "all"
}
source_ranges = [
"192.168.101.0/24",
"192.168.102.0/24",
"192.168.103.0/24"
]
}
resource "google_compute_firewall" "auto-firewall-rule-bastion" {
name = "${var.project_tag}-firewall-rule-bastion"
network = "${google_compute_network.auto-vpc.self_link}"
target_tags = ["${var.bastion_tag}"]
allow {
protocol = "all"
}
source_ranges = [
"0.0.0.0/0"
]
}