-
Notifications
You must be signed in to change notification settings - Fork 14
/
master.tf
49 lines (39 loc) · 1.04 KB
/
master.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
resource "google_compute_instance" "master" {
count = var.master_count
name = format("master%s", count.index)
machine_type = "n1-standard-1"
zone = format("%s-a", var.project_region)
tags = ["kubernetes", "master"]
boot_disk {
initialize_params {
image = "ubuntu-os-cloud/ubuntu-1804-lts"
size = var.disk_size
}
}
metadata = {
sshKeys = format("%s:%s", var.username, file(var.ssh_key))
}
network_interface {
network = google_compute_network.vpc_network.self_link
subnetwork = google_compute_subnetwork.public_subnet1a.name
access_config {
}
}
}
resource "google_compute_firewall" "master" {
name = format("%s-master", var.project_name)
network = google_compute_network.vpc_network.self_link
allow {
protocol = "tcp"
ports = ["22"]
}
allow {
protocol = "tcp"
ports = ["80"]
}
allow {
protocol = "tcp"
ports = ["443"]
}
target_tags = ["master"]
}