-
Notifications
You must be signed in to change notification settings - Fork 0
/
instance.tf
68 lines (56 loc) · 1.73 KB
/
instance.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
# A Linode data volume and instance.
# Ref: https://www.terraform.io/docs/providers/linode/r/instance.html
# A Linode volume for Docker data.
# Note that the boot volume is declared with the instance resource below.
resource "linode_volume" "docker_data" {
label = "${var.instance_name}-data"
size = var.instance_datadisk_size
region = var.instance_region
}
# A Linode instance.
resource "linode_instance" "docker" {
label = var.instance_name
#group = "lab"
#tags = [ "whatever" ]
region = var.instance_region
type = var.instance_type
private_ip = true
disk {
label = "boot"
size = var.instance_bootdisk_size
image = "linode/ubuntu18.04"
# Note that if the StackScript is updated and you wish to REPLACE this instance,
# taint the resource in Terraform then run `terraform apply`.
# terraform taint linode_instance.docker && terraform apply
stackscript_id = linode_stackscript.docker.id
# Any of authorized_keys, authorized_users, and root_pass
# can be used for provisioning.
#authorized_keys = [ "ssh-rsa ...." ]
authorized_users = [data.linode_profile.me.username]
#root_pass = "abc123lol"
}
config {
label = "boot_config"
kernel = "linode/latest-64bit"
devices {
sda {
disk_label = "boot"
}
sdc {
volume_id = linode_volume.docker_data.id
}
}
root_device = "/dev/sda"
}
boot_config_label = "boot_config"
}
# Output useful information after a Terraform apply.
output "public_ip" {
value = linode_instance.docker.ip_address
}
output "instance_type_provided_disk" {
value = linode_instance.docker.specs.0.disk
}
output "instance_type_provided_memory" {
value = linode_instance.docker.specs.0.memory
}