forked from Cloud-Schematics/tomcat7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vm.tf
87 lines (83 loc) · 2.17 KB
/
vm.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
84
85
86
87
################################################################
# Module to deploy an VM with specified applications installed
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Licensed Materials - Property of IBM
#
# ©Copyright IBM Corp. 2017.
#
################################################################
variable "hostname" {
default = "hostname"
}
variable "domain" {
default = "domain.dev"
}
variable "datacenter" {
default = "wdc01"
}
variable "os_reference_code" {
default = "CENTOS_7"
}
variable "cores" {
default = "1"
}
variable "memory" {
default = "1024"
}
variable "disk_size" {
default = "25"
}
variable "private_network_only" {
default = "false"
}
variable "network_speed" {
default = "100"
}
variable "tags" {
default = ""
}
variable "ssh_user" {
default = "root"
description = "default user for VM"
}
variable "ssh_label" {
default = "public ssh key - Schematics VM"
}
variable "ssh_notes" {
default = ""
}
variable "ssh_key" {
default = ""
description = "public SSH key to use in keypair"
}
resource "ibm_compute_ssh_key" "ssh_key" {
label = "${var.ssh_label}"
notes = "${var.ssh_notes}"
public_key = "${var.ssh_key}"
}
resource "ibm_compute_vm_instance" "vm" {
hostname = "${var.hostname}"
os_reference_code = "${var.os_reference_code}"
domain = "${var.domain}"
datacenter = "${var.datacenter}"
network_speed = "${var.network_speed}"
hourly_billing = true
private_network_only = "${var.private_network_only}"
cores = "${var.cores}"
memory = "${var.memory}"
disks = ["${var.disk_size}"]
dedicated_acct_host_only = true
local_disk = false
ssh_key_ids = ["${ibm_compute_ssh_key.ssh_key.id}"]
tags = ["${var.tags}"]
user_metadata = "${file("install.yml")}"
}
output "public_ip" {
value = "http://${ibm_compute_vm_instance.vm.ipv4_address}"
}