2017-01-04 06:29:10 +00:00
|
|
|
# Everything required to build the Plex server workload goes here
|
|
|
|
# ESXI is the intended provider
|
|
|
|
provider "vsphere" {
|
|
|
|
user = "${var.vsphere_user}"
|
|
|
|
password = "${var.vsphere_password}"
|
|
|
|
vsphere_server = "${var.vsphere_server}"
|
|
|
|
#Because no signed cert
|
|
|
|
allow_unverified_ssl = true
|
|
|
|
}
|
|
|
|
|
|
|
|
# Create a folder for the vm
|
|
|
|
#resource "vsphere_folder" "plex" {
|
|
|
|
# path = "terraform/plex"
|
|
|
|
# datacenter = "Datacenter"
|
|
|
|
#}
|
|
|
|
|
|
|
|
# Create Disk File from Template
|
|
|
|
#resource "vsphere_file" "ubuntu_disk" {
|
|
|
|
# datastore = "datastore1 (1)"
|
|
|
|
# datacenter = "Datacenter"
|
|
|
|
# source_file = "[Nas] ubuntu_mini_template/ubuntu_mini_template.vmdk"
|
|
|
|
# destination_file = "${vsphere_folder.plex.path}/plex.vmdk"
|
|
|
|
#}
|
|
|
|
|
|
|
|
# Create the disk image file
|
|
|
|
#resource "vsphere_virtual_disk" "plex_disk" {
|
|
|
|
# size = 2
|
|
|
|
# vmdk_path = "${vsphere_folder.plex.path}/plex.vmdk"
|
|
|
|
# datacenter = "Datacenter"
|
|
|
|
# datastore = "datastore1 (1)"
|
|
|
|
# type = "thin"
|
|
|
|
#}
|
|
|
|
|
|
|
|
# Create the VM
|
|
|
|
resource "vsphere_virtual_machine" "plex" {
|
|
|
|
name = "terraform_plex"
|
|
|
|
vcpu = 1
|
|
|
|
memory = 2048
|
|
|
|
resource_pool = "192.168.1.31/"
|
2017-01-31 07:51:16 +00:00
|
|
|
cluster = "192.168.1.32"
|
|
|
|
datacenter = "Datacenter"
|
|
|
|
domain = "vsphere.local"
|
|
|
|
skip_customization = true
|
2017-01-04 06:29:10 +00:00
|
|
|
|
|
|
|
network_interface {
|
|
|
|
label = "VM Network"
|
2017-01-31 07:51:16 +00:00
|
|
|
adapter_type = "VMXNET 3"
|
|
|
|
ipv4_address = "192.168.1.39"
|
|
|
|
ipv4_prefix_length = "24"
|
|
|
|
ipv4_gateway = "192.168.1.1"
|
2017-01-04 06:29:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
disk {
|
2017-01-31 07:51:16 +00:00
|
|
|
datastore = "960GB Enterprise"
|
|
|
|
type = "thin"
|
2017-01-04 06:29:10 +00:00
|
|
|
template = "ubuntu_14"
|
|
|
|
}
|
|
|
|
}
|