Skip to content

Commit

Permalink
[WIP] vSphere UPI - Use a folder for virtual machines
Browse files Browse the repository at this point in the history
- Creates a vm folder
- Virtual Machines are deployed into the folder created
- Updated README.md
  • Loading branch information
jcpowermac authored and staebler committed Mar 28, 2019
1 parent bca44b5 commit 118ecb3
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions upi/vsphere/folder/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resource "vsphere_folder" "folder" {
path = "${var.path}"
type = "vm"
datacenter_id = "${var.datacenter_id}"
}
3 changes: 3 additions & 0 deletions upi/vsphere/folder/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "path" {
value = "${vsphere_folder.folder.path}"
}
11 changes: 11 additions & 0 deletions upi/vsphere/folder/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
variable "path" {
type = "string"
}

variable "datacenter_id" {
type = "string"
}

variable "vsphere_cluster" {
type = "string"
}
1 change: 1 addition & 0 deletions upi/vsphere/machine/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ resource "vsphere_virtual_machine" "vm" {
num_cpus = "4"
memory = "8192"
guest_id = "other26xLinux64Guest"
folder = "${var.folder_id}"

network_interface {
network_id = "${data.vsphere_network.network.id}"
Expand Down
4 changes: 4 additions & 0 deletions upi/vsphere/machine/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ variable "resource_pool_id" {
type = "string"
}

variable "folder_id" {
type = "string"
}

variable "datastore" {
type = "string"
}
Expand Down
11 changes: 11 additions & 0 deletions upi/vsphere/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,22 @@ module "resource_pool" {
vsphere_cluster = "${var.vsphere_cluster}"
}

module "folder" {
source = "./folder"

path = "${var.cluster_id}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
vsphere_cluster = "${var.vsphere_cluster}"
}

module "bootstrap" {
source = "./machine"

name = "bootstrap"
ignition_url = "${var.bootstrap_ignition_url}"
resource_pool_id = "${module.resource_pool.pool_id}"
datastore = "${var.vsphere_datastore}"
folder_id = "${module.folder.path}"
network = "${var.vm_network}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
template = "${var.vm_template}"
Expand All @@ -42,6 +51,7 @@ module "control_plane" {
name = "control-plane"
ignition = "${var.control_plane_ignition}"
resource_pool_id = "${module.resource_pool.pool_id}"
folder_id = "${module.folder.path}"
datastore = "${var.vsphere_datastore}"
network = "${var.vm_network}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
Expand All @@ -60,6 +70,7 @@ module "compute" {
name = "compute"
ignition = "${var.compute_ignition}"
resource_pool_id = "${module.resource_pool.pool_id}"
folder_id = "${module.folder.path}"
datastore = "${var.vsphere_datastore}"
network = "${var.vm_network}"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
Expand Down

0 comments on commit 118ecb3

Please sign in to comment.