Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions data/data/vsphere/bootstrap/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
locals {
description = "Created By OpenShift Installer"
bootstrap_key = keys(var.vcenter_region_zone_map)[0]
region = var.vcenter_region_zone_map[local.bootstrap_key].region
}

provider "vsphere" {
Expand All @@ -11,31 +13,33 @@ provider "vsphere" {

resource "vsphere_virtual_machine" "vm_bootstrap" {
name = "${var.cluster_id}-bootstrap"
resource_pool_id = var.resource_pool
datastore_id = var.datastore
resource_pool_id = var.cluster[local.bootstrap_key].resource_pool_id
datastore_id = var.datastore[local.bootstrap_key].id
num_cpus = 4
memory = 16384
guest_id = var.guest_id
folder = var.folder
guest_id = var.template[local.bootstrap_key].guest_id


folder = var.folder[local.bootstrap_key].path
enable_disk_uuid = "true"
annotation = local.description

wait_for_guest_net_timeout = 0
wait_for_guest_net_routable = false

network_interface {
network_id = var.network
network_id = var.template[local.bootstrap_key].network_interfaces.0.network_id
}

disk {
label = "disk0"
size = 120
eagerly_scrub = var.scrub_disk
thin_provisioned = var.thin_disk
eagerly_scrub = var.template[local.bootstrap_key].disks.0.eagerly_scrub
thin_provisioned = var.template[local.bootstrap_key].disks.0.thin_provisioned
}

clone {
template_uuid = var.template
template_uuid = var.template[local.bootstrap_key].id
}

extra_config = {
Expand Down
38 changes: 19 additions & 19 deletions data/data/vsphere/bootstrap/variables.tf
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
variable "resource_pool" {
type = string
variable "datacenter" {
type = map
}

variable "folder" {
type = string
variable "datastore" {
type = map
}

variable "datastore" {
type = string
variable "cluster" {
type = map
}

variable "network" {
type = string
variable "folder" {
type = map
}

variable "datacenter" {
type = string
variable "ovaimport" {
type = map
}

variable "template" {
type = string
type = map
}

variable "guest_id" {
type = string
variable "tags" {
type = list
}

variable "tags" {
type = list
variable "cluster_domain" {
type = string
}

variable "thin_disk" {
type = bool
variable "cluster_id" {
type = string
}

variable "scrub_disk" {
type = bool
variable "vcenter_region_zone_map" {
type = map
}
29 changes: 21 additions & 8 deletions data/data/vsphere/master/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
locals {
description = "Created By OpenShift Installer"
zone_keys = keys(var.vcenter_region_zone_map)

}

provider "vsphere" {
Expand All @@ -9,36 +11,47 @@ provider "vsphere" {
allow_unverified_ssl = false
}


resource "vsphere_virtual_machine" "vm_master" {
count = var.master_count

name = "${var.cluster_id}-master-${count.index}"
resource_pool_id = var.resource_pool
datastore_id = var.datastore

// TODO: This needs to be changed to a correct existing resource pool
// TODO: as defined
resource_pool_id = var.cluster[local.zone_keys[count.index]].resource_pool_id
datastore_id = var.datastore[local.zone_keys[count.index]].id

num_cpus = var.vsphere_control_plane_num_cpus
num_cores_per_socket = var.vsphere_control_plane_cores_per_socket
memory = var.vsphere_control_plane_memory_mib
guest_id = var.guest_id
folder = var.folder

guest_id = var.template[local.zone_keys[count.index]].guest_id


folder = var.folder[local.zone_keys[count.index]].path
enable_disk_uuid = "true"
annotation = local.description

wait_for_guest_net_timeout = "0"
wait_for_guest_net_routable = "false"

network_interface {
network_id = var.network

// TODO: don't do this...Use Robert's fix
// TODO: unless we cheat ;-)
network_id = var.template[local.zone_keys[count.index]].network_interfaces.0.network_id
}

disk {
label = "disk0"
size = var.vsphere_control_plane_disk_gib
eagerly_scrub = var.scrub_disk
thin_provisioned = var.thin_disk
eagerly_scrub = var.template[local.zone_keys[count.index]].disks.0.eagerly_scrub
thin_provisioned = var.template[local.zone_keys[count.index]].disks.0.thin_provisioned
}

clone {
template_uuid = var.template
template_uuid = var.template[local.zone_keys[count.index]].uuid
}

extra_config = {
Expand Down
34 changes: 13 additions & 21 deletions data/data/vsphere/master/variables.tf
Original file line number Diff line number Diff line change
@@ -1,39 +1,31 @@
variable "resource_pool" {
type = string
}

variable "folder" {
type = string
variable "datacenter" {
type = map
}

variable "datastore" {
type = string
type = map
}

variable "network" {
type = string
variable "cluster" {
type = map
}

variable "datacenter" {
type = string
variable "folder" {
type = map
}

variable "template" {
type = string
variable "ovaimport" {
type = map
}

variable "guest_id" {
type = string
variable "template" {
type = map
}

variable "tags" {
type = list
}

variable "thin_disk" {
type = bool
}

variable "scrub_disk" {
type = bool
variable "vcenter_region_zone_map" {
type = map
}
Loading