-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-env.tf
More file actions
84 lines (68 loc) · 1.71 KB
/
test-env.tf
File metadata and controls
84 lines (68 loc) · 1.71 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
variable "node_count" {
default = "0"
}
//
// Separate disk for etcd
//
resource "google_compute_disk" "test-etcd-disk-" {
count = "${var.node_count}"
name = "knisbet-test-disk-${count.index}-etcd"
type = "pd-ssd"
size = "50"
labels = {
env = "test"
kevin = ""
user = "kevin"
}
}
//
// Create instance for testing gravity
//
resource "google_compute_instance" "test" {
count = "${var.node_count}"
name = "knisbet-test${count.index + 1}"
description = "Test VM for kevin"
machine_type = "custom-6-10240"
zone = "${var.zone}"
allow_stopping_for_update = true
can_ip_forward = true
tags = ["knisbet-dev"]
labels = {
env = "test"
kevin = ""
user = "kevin"
}
boot_disk {
auto_delete = true
initialize_params {
size = 60
type = "pd-ssd"
image = "${data.google_compute_image.dev.self_link}"
}
}
attached_disk {
source = "${element(google_compute_disk.test-etcd-disk-.*.self_link, count.index)}"
device_name = "${element(google_compute_disk.test-etcd-disk-.*.name, count.index)}"
}
network_interface {
network = "default"
access_config {
// Ephemeral IP
}
}
metadata {
startup-script = "${data.template_file.test_startup.rendered}"
shutdown-script = "${data.template_file.test_shutdown.rendered}"
}
service_account {
scopes = ["userinfo-email", "compute-rw", "storage-rw"]
}
}
data "template_file" "test_startup" {
template = "${file("scripts/test-startup.tpl")}"
vars {}
}
data "template_file" "test_shutdown" {
template = "${file("scripts/test-shutdown.tpl")}"
vars {}
}