50 lines
1.2 KiB
Terraform
50 lines
1.2 KiB
Terraform
|
# 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/"
|
||
|
|
||
|
network_interface {
|
||
|
label = "VM Network"
|
||
|
}
|
||
|
|
||
|
disk {
|
||
|
datastore = "Nas"
|
||
|
template = "ubuntu_14"
|
||
|
}
|
||
|
}
|