diff --git a/upi/vsphere/README.md b/upi/vsphere/README.md index 6846d8de992..c0b5f192d59 100644 --- a/upi/vsphere/README.md +++ b/upi/vsphere/README.md @@ -1,7 +1,8 @@ # Pre-Requisites -* terraform -* jq +* Terraform >= 0.12 +* Jq +* AWS profile set and a region specified. The installation will create AWS route53 resources for routing to the OpenShift cluster. # Build a Cluster @@ -30,30 +31,29 @@ sshKey: YOUR_SSH_KEY 3. Fill out a terraform.tfvars file with the ignition configs generated. There is an example terraform.tfvars file in this directory named terraform.tfvars.example. The example file is set up for use with the dev cluster running at vcsa.vmware.devcluster.openshift.com. At a minimum, you need to set values for the following variables. + * cluster_id * cluster_domain * vsphere_user * vsphere_password * ipam_token -* bootstrap_ignition_url +* bootstrap_ignition_url => The bootstrap ignition config must be placed in a location that will be accessible by the bootstrap machine. For example, you could store the bootstrap ignition config in a gist. * control_plane_ignition * compute_ignition -The bootstrap ignition config must be placed in a location that will be accessible by the bootstrap machine. For example, you could store the bootstrap ignition config in a gist. -4. Run `terraform init`. -5. Ensure that you have you AWS profile set and a region specified. The installation will use create AWS route53 resources for routing to the OpenShift cluster. +4. Run `terraform init`. -6. Run `terraform apply -auto-approve`. +5. Run `terraform apply -auto-approve`. This will reserve IP addresses for the VMs. -7. Run `openshift-install wait-for bootstrap-complete`. Wait for the bootstrapping to complete. +6. Run `openshift-install wait-for bootstrap-complete`. Wait for the bootstrapping to complete. -8. Run `terraform apply -auto-approve -var 'bootstrap_complete=true'`. +7. Run `terraform apply -auto-approve -var 'bootstrap_complete=true'`. This will destroy the bootstrap VM. -9. Run `openshift-install wait-for install-complete`. Wait for the cluster install to finish. +8. Run `openshift-install wait-for install-complete`. Wait for the cluster install to finish. -10. Enjoy your new OpenShift cluster. +9. Enjoy your new OpenShift cluster. -11. Run `terraform destroy -auto-approve`. +10. Run `terraform destroy -auto-approve`. diff --git a/upi/vsphere/folder/main.tf b/upi/vsphere/folder/main.tf index 6f5605846f1..07552829b04 100644 --- a/upi/vsphere/folder/main.tf +++ b/upi/vsphere/folder/main.tf @@ -1,5 +1,5 @@ resource "vsphere_folder" "folder" { - path = "${var.path}" + path = var.path type = "vm" - datacenter_id = "${var.datacenter_id}" + datacenter_id = var.datacenter_id } diff --git a/upi/vsphere/folder/output.tf b/upi/vsphere/folder/output.tf index d20b194905c..5f11bccdc86 100644 --- a/upi/vsphere/folder/output.tf +++ b/upi/vsphere/folder/output.tf @@ -1,3 +1,3 @@ output "path" { - value = "${vsphere_folder.folder.path}" + value = vsphere_folder.folder.path } diff --git a/upi/vsphere/folder/variables.tf b/upi/vsphere/folder/variables.tf index a02bf0cfbc4..14076e43cef 100644 --- a/upi/vsphere/folder/variables.tf +++ b/upi/vsphere/folder/variables.tf @@ -1,7 +1,7 @@ variable "path" { - type = "string" + type = string } variable "datacenter_id" { - type = "string" + type = string } diff --git a/upi/vsphere/machine/ignition.tf b/upi/vsphere/machine/ignition.tf index 785c7b74d75..de8643cdb58 100644 --- a/upi/vsphere/machine/ignition.tf +++ b/upi/vsphere/machine/ignition.tf @@ -1,12 +1,12 @@ locals { - mask = "${element(split("/", var.machine_cidr), 1)}" - gw = "${cidrhost(var.machine_cidr,1)}" + mask = element(split("/", var.machine_cidr), 1) + gw = cidrhost(var.machine_cidr,1) ignition_encoded = "data:text/plain;charset=utf-8;base64,${base64encode(var.ignition)}" } data "ignition_file" "hostname" { - count = "${var.instance_count}" + count = var.instance_count filesystem = "root" path = "/etc/hostname" @@ -18,7 +18,7 @@ data "ignition_file" "hostname" { } data "ignition_file" "static_ip" { - count = "${var.instance_count}" + count = var.instance_count filesystem = "root" path = "/etc/sysconfig/network-scripts/ifcfg-ens192" @@ -41,7 +41,7 @@ EOF } data "ignition_systemd_unit" "restart" { - count = "${var.instance_count}" + count = var.instance_count name = "restart.service" @@ -57,18 +57,18 @@ EOF } data "ignition_config" "ign" { - count = "${var.instance_count}" + count = var.instance_count append { - source = "${var.ignition_url != "" ? var.ignition_url : local.ignition_encoded}" + source = var.ignition_url != "" ? var.ignition_url : local.ignition_encoded } systemd = [ - "${data.ignition_systemd_unit.restart.*.id[count.index]}", + data.ignition_systemd_unit.restart.*.id[count.index], ] files = [ - "${data.ignition_file.hostname.*.id[count.index]}", - "${data.ignition_file.static_ip.*.id[count.index]}", + data.ignition_file.hostname.*.id[count.index], + data.ignition_file.static_ip.*.id[count.index], ] } diff --git a/upi/vsphere/machine/ip.tf b/upi/vsphere/machine/ip.tf index 2ad92f8c4bf..3af4f846eea 100644 --- a/upi/vsphere/machine/ip.tf +++ b/upi/vsphere/machine/ip.tf @@ -1,30 +1,30 @@ locals { - network = "${cidrhost(var.machine_cidr,0)}" - ip_addresses = ["${coalescelist(var.ip_addresses, data.template_file.ip_address.*.rendered)}"] + network = cidrhost(var.machine_cidr,0) + ip_addresses = coalescelist(var.ip_addresses, data.template_file.ip_address.*.rendered) } data "external" "ip_address" { - count = "${length(var.ip_addresses) == 0 ? var.instance_count : 0}" + count = length(var.ip_addresses) == 0 ? var.instance_count : 0 program = ["bash", "${path.module}/cidr_to_ip.sh"] query = { hostname = "${var.name}-${count.index}.${var.cluster_domain}" - ipam = "${var.ipam}" - ipam_token = "${var.ipam_token}" + ipam = var.ipam + ipam_token = var.ipam_token } depends_on = ["null_resource.ip_address"] } data "template_file" "ip_address" { - count = "${length(var.ip_addresses) == 0 ? var.instance_count : 0}" + count = length(var.ip_addresses) == 0 ? var.instance_count : 0 - template = "${lookup(data.external.ip_address.*.result[count.index], "ip_address")}" + template = lookup(data.external.ip_address.*.result[count.index], "ip_address") } resource "null_resource" "ip_address" { - count = "${length(var.ip_addresses) == 0 ? var.instance_count : 0}" + count = length(var.ip_addresses) == 0 ? var.instance_count : 0 provisioner "local-exec" { command = <