Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform files for VMs creation on vSphere for Assisted Installer deployment automation (for HCI) #8912

Merged

Conversation

dahorak
Copy link
Contributor

@dahorak dahorak commented Nov 22, 2023

I've decided to split the whole work to few separated PRs whenever it will be possible, so it will be easier to review it.

This PR contains terraform configuration files and module for creating VMs on vSphere for the Assisted Installer deployment.

@dahorak dahorak self-assigned this Nov 22, 2023
@pull-request-size pull-request-size bot added the size/L PR that changes 100-499 lines label Nov 22, 2023
@dahorak dahorak added team/ecosystem Ecosystem team related issues/PRs and removed size/L PR that changes 100-499 lines do-not-merge/work-in-progress labels Nov 22, 2023
@pull-request-size pull-request-size bot added the size/L PR that changes 100-499 lines label Nov 22, 2023
- including README and .gitignore files

Signed-off-by: Daniel Horak <[email protected]>
@dahorak dahorak force-pushed the hci-deployment-automation-on-vsphere branch from d06dcd4 to 236e5e4 Compare November 23, 2023 12:43
@dahorak dahorak changed the title Assisted Installer deployment automation on vSphere (for HCI) Terraform files for VMs creation on vSphere for Assisted Installer deployment automation (for HCI) Nov 23, 2023
@dahorak dahorak marked this pull request as ready for review November 23, 2023 12:46
@dahorak dahorak requested a review from a team as a code owner November 23, 2023 12:46
@dahorak
Copy link
Contributor Author

dahorak commented Nov 23, 2023

This code is not yet integrated to the rest of the ocs-ci code, but is working correctly when used manually, so I would propose to merge it as it is to make the followup PRs smaller.

Verification triggered manually:

terraform init
Initializing modules...
- compute_vm in vm
- control_plane_vm in vm

Initializing the backend...

Initializing provider plugins...
- Finding latest version of hashicorp/vsphere...
- Installing hashicorp/vsphere v2.5.1...
- Installed hashicorp/vsphere v2.5.1 (signed by HashiCorp)

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

Created only two VMs - one control plane and one compute node:

$ terraform -chdir=terraform/vsphere/ai apply -state=terraform.tfstate -var-file=terraform.tfvars

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # vsphere_file.discovery_iso will be created
  + resource "vsphere_file" "discovery_iso" {
      + create_directories = true
      + datacenter         = "Datacenter-XYZ"
      + datastore          = "vsanDatastore"
      + destination_file   = "/iso/<cluster-id>-discovery.iso"
      + id                 = (known after apply)
      + source_file        = "/path/to/discovery.iso"
    }

  # vsphere_folder.folder will be created
  + resource "vsphere_folder" "folder" {
      + datacenter_id = "datacenter-43066"
      + id            = (known after apply)
      + path          = "<cluster-id>"
      + type          = "vm"
    }

  # vsphere_resource_pool.resource_pool will be created
  + resource "vsphere_resource_pool" "resource_pool" {
      + cpu_expandable           = true
      + cpu_limit                = -1
      + cpu_reservation          = 0
      + cpu_share_level          = "normal"
      + cpu_shares               = (known after apply)
      + id                       = (known after apply)
      + memory_expandable        = true
      + memory_limit             = -1
      + memory_reservation       = 0
      + memory_share_level       = "normal"
      + memory_shares            = (known after apply)
      + name                     = "<cluster-id>"
      + parent_resource_pool_id  = "resgroup-43072"
      + scale_descendants_shares = "disabled"
    }

  # module.compute_vm[0].vsphere_virtual_machine.vm will be created
  + resource "vsphere_virtual_machine" "vm" {
      + annotation                              = (known after apply)
      + boot_retry_delay                        = 10000
      + change_version                          = (known after apply)
      + cpu_limit                               = -1
      + cpu_share_count                         = (known after apply)
      + cpu_share_level                         = "normal"
      + datastore_id                            = "datastore-43331"
      + default_ip_address                      = (known after apply)
      + enable_disk_uuid                        = true
      + ept_rvi_mode                            = "automatic"
      + extra_config                            = {
          + "stealclock.enable" = "TRUE"
        }
      + extra_config_reboot_required            = true
      + firmware                                = "bios"
      + folder                                  = "<cluster-id>"
      + force_power_off                         = true
      + guest_id                                = "rhel8_64Guest"
      + guest_ip_addresses                      = (known after apply)
      + hardware_version                        = (known after apply)
      + host_system_id                          = (known after apply)
      + hv_mode                                 = "hvAuto"
      + id                                      = (known after apply)
      + ide_controller_count                    = 2
      + imported                                = (known after apply)
      + latency_sensitivity                     = "normal"
      + memory                                  = 65536
      + memory_limit                            = -1
      + memory_share_count                      = (known after apply)
      + memory_share_level                      = "normal"
      + migrate_wait_timeout                    = 30
      + moid                                    = (known after apply)
      + name                                    = "<cluster-id>-compute-0"
      + nested_hv_enabled                       = true
      + num_cores_per_socket                    = 1
      + num_cpus                                = 16
      + power_state                             = (known after apply)
      + poweron_timeout                         = 300
      + reboot_required                         = (known after apply)
      + resource_pool_id                        = (known after apply)
      + run_tools_scripts_after_power_on        = true
      + run_tools_scripts_after_resume          = true
      + run_tools_scripts_before_guest_shutdown = true
      + run_tools_scripts_before_guest_standby  = true
      + sata_controller_count                   = 0
      + scsi_bus_sharing                        = "noSharing"
      + scsi_controller_count                   = 1
      + scsi_type                               = "pvscsi"
      + shutdown_wait_timeout                   = 3
      + storage_policy_id                       = (known after apply)
      + swap_placement_policy                   = "inherit"
      + tools_upgrade_policy                    = "manual"
      + uuid                                    = (known after apply)
      + vapp_transport                          = (known after apply)
      + vmware_tools_status                     = (known after apply)
      + vmx_path                                = (known after apply)
      + wait_for_guest_ip_timeout               = 0
      + wait_for_guest_net_routable             = false
      + wait_for_guest_net_timeout              = 0

      + cdrom {
          + datastore_id   = "datastore-43331"
          + device_address = (known after apply)
          + key            = (known after apply)
          + path           = "/iso/<cluster-id>-discovery.iso"
        }

      + disk {
          + attach            = false
          + controller_type   = "scsi"
          + datastore_id      = "<computed>"
          + device_address    = (known after apply)
          + disk_mode         = "persistent"
          + disk_sharing      = "sharingNone"
          + eagerly_scrub     = false
          + io_limit          = -1
          + io_reservation    = 0
          + io_share_count    = 0
          + io_share_level    = "normal"
          + keep_on_remove    = false
          + key               = 0
          + label             = "disk0"
          + path              = (known after apply)
          + size              = 120
          + storage_policy_id = (known after apply)
          + thin_provisioned  = true
          + unit_number       = 0
          + uuid              = (known after apply)
          + write_through     = false
        }
      + disk {
          + attach            = false
          + controller_type   = "scsi"
          + datastore_id      = "<computed>"
          + device_address    = (known after apply)
          + disk_mode         = "persistent"
          + disk_sharing      = "sharingNone"
          + eagerly_scrub     = false
          + io_limit          = -1
          + io_reservation    = 0
          + io_share_count    = 0
          + io_share_level    = "normal"
          + keep_on_remove    = false
          + key               = 0
          + label             = "disk1"
          + path              = (known after apply)
          + size              = 256
          + storage_policy_id = (known after apply)
          + thin_provisioned  = true
          + unit_number       = 1
          + uuid              = (known after apply)
          + write_through     = false
        }
      + disk {
          + attach            = false
          + controller_type   = "scsi"
          + datastore_id      = "<computed>"
          + device_address    = (known after apply)
          + disk_mode         = "persistent"
          + disk_sharing      = "sharingNone"
          + eagerly_scrub     = false
          + io_limit          = -1
          + io_reservation    = 0
          + io_share_count    = 0
          + io_share_level    = "normal"
          + keep_on_remove    = false
          + key               = 0
          + label             = "disk2"
          + path              = (known after apply)
          + size              = 256
          + storage_policy_id = (known after apply)
          + thin_provisioned  = true
          + unit_number       = 2
          + uuid              = (known after apply)
          + write_through     = false
        }
      + disk {
          + attach            = false
          + controller_type   = "scsi"
          + datastore_id      = "<computed>"
          + device_address    = (known after apply)
          + disk_mode         = "persistent"
          + disk_sharing      = "sharingNone"
          + eagerly_scrub     = false
          + io_limit          = -1
          + io_reservation    = 0
          + io_share_count    = 0
          + io_share_level    = "normal"
          + keep_on_remove    = false
          + key               = 0
          + label             = "disk3"
          + path              = (known after apply)
          + size              = 256
          + storage_policy_id = (known after apply)
          + thin_provisioned  = true
          + unit_number       = 3
          + uuid              = (known after apply)
          + write_through     = false
        }

      + network_interface {
          + adapter_type          = "vmxnet3"
          + bandwidth_limit       = -1
          + bandwidth_reservation = 0
          + bandwidth_share_count = (known after apply)
          + bandwidth_share_level = "normal"
          + device_address        = (known after apply)
          + key                   = (known after apply)
          + mac_address           = (known after apply)
          + network_id            = "network-43332"
        }
    }

  # module.control_plane_vm[0].vsphere_virtual_machine.vm will be created
  + resource "vsphere_virtual_machine" "vm" {
      + annotation                              = (known after apply)
      + boot_retry_delay                        = 10000
      + change_version                          = (known after apply)
      + cpu_limit                               = -1
      + cpu_share_count                         = (known after apply)
      + cpu_share_level                         = "normal"
      + datastore_id                            = "datastore-43331"
      + default_ip_address                      = (known after apply)
      + enable_disk_uuid                        = true
      + ept_rvi_mode                            = "automatic"
      + extra_config                            = {
          + "stealclock.enable" = "TRUE"
        }
      + extra_config_reboot_required            = true
      + firmware                                = "bios"
      + folder                                  = "<cluster-id>"
      + force_power_off                         = true
      + guest_id                                = "rhel8_64Guest"
      + guest_ip_addresses                      = (known after apply)
      + hardware_version                        = (known after apply)
      + host_system_id                          = (known after apply)
      + hv_mode                                 = "hvAuto"
      + id                                      = (known after apply)
      + ide_controller_count                    = 2
      + imported                                = (known after apply)
      + latency_sensitivity                     = "normal"
      + memory                                  = 16384
      + memory_limit                            = -1
      + memory_share_count                      = (known after apply)
      + memory_share_level                      = "normal"
      + migrate_wait_timeout                    = 30
      + moid                                    = (known after apply)
      + name                                    = "<cluster-id>-control-plane-0"
      + nested_hv_enabled                       = false
      + num_cores_per_socket                    = 1
      + num_cpus                                = 4
      + power_state                             = (known after apply)
      + poweron_timeout                         = 300
      + reboot_required                         = (known after apply)
      + resource_pool_id                        = (known after apply)
      + run_tools_scripts_after_power_on        = true
      + run_tools_scripts_after_resume          = true
      + run_tools_scripts_before_guest_shutdown = true
      + run_tools_scripts_before_guest_standby  = true
      + sata_controller_count                   = 0
      + scsi_bus_sharing                        = "noSharing"
      + scsi_controller_count                   = 1
      + scsi_type                               = "pvscsi"
      + shutdown_wait_timeout                   = 3
      + storage_policy_id                       = (known after apply)
      + swap_placement_policy                   = "inherit"
      + tools_upgrade_policy                    = "manual"
      + uuid                                    = (known after apply)
      + vapp_transport                          = (known after apply)
      + vmware_tools_status                     = (known after apply)
      + vmx_path                                = (known after apply)
      + wait_for_guest_ip_timeout               = 0
      + wait_for_guest_net_routable             = false
      + wait_for_guest_net_timeout              = 0

      + cdrom {
          + datastore_id   = "datastore-43331"
          + device_address = (known after apply)
          + key            = (known after apply)
          + path           = "/iso/<cluster-id>-discovery.iso"
        }

      + disk {
          + attach            = false
          + controller_type   = "scsi"
          + datastore_id      = "<computed>"
          + device_address    = (known after apply)
          + disk_mode         = "persistent"
          + disk_sharing      = "sharingNone"
          + eagerly_scrub     = false
          + io_limit          = -1
          + io_reservation    = 0
          + io_share_count    = 0
          + io_share_level    = "normal"
          + keep_on_remove    = false
          + key               = 0
          + label             = "disk0"
          + path              = (known after apply)
          + size              = 120
          + storage_policy_id = (known after apply)
          + thin_provisioned  = true
          + unit_number       = 0
          + uuid              = (known after apply)
          + write_through     = false
        }

      + network_interface {
          + adapter_type          = "vmxnet3"
          + bandwidth_limit       = -1
          + bandwidth_reservation = 0
          + bandwidth_share_count = (known after apply)
          + bandwidth_share_level = "normal"
          + device_address        = (known after apply)
          + key                   = (known after apply)
          + mac_address           = (known after apply)
          + network_id            = "network-43332"
        }
    }

Plan: 5 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

vsphere_folder.folder: Creating...
vsphere_file.discovery_iso: Creating...
vsphere_resource_pool.resource_pool: Creating...
vsphere_resource_pool.resource_pool: Creation complete after 1s [id=resgroup-100238]
vsphere_folder.folder: Still creating... [10s elapsed]
vsphere_file.discovery_iso: Still creating... [10s elapsed]
vsphere_folder.folder: Still creating... [20s elapsed]
vsphere_file.discovery_iso: Still creating... [20s elapsed]
vsphere_folder.folder: Still creating... [30s elapsed]
vsphere_file.discovery_iso: Still creating... [30s elapsed]
vsphere_file.discovery_iso: Still creating... [40s elapsed]
vsphere_folder.folder: Still creating... [40s elapsed]
vsphere_file.discovery_iso: Still creating... [50s elapsed]
vsphere_folder.folder: Still creating... [50s elapsed]
vsphere_folder.folder: Still creating... [1m0s elapsed]
vsphere_file.discovery_iso: Still creating... [1m0s elapsed]
vsphere_folder.folder: Still creating... [1m10s elapsed]
vsphere_file.discovery_iso: Still creating... [1m10s elapsed]
vsphere_folder.folder: Still creating... [1m20s elapsed]
vsphere_file.discovery_iso: Still creating... [1m20s elapsed]
vsphere_folder.folder: Creation complete after 1m29s [id=group-v100239]
vsphere_file.discovery_iso: Still creating... [1m30s elapsed]
vsphere_file.discovery_iso: Still creating... [1m40s elapsed]
vsphere_file.discovery_iso: Still creating... [1m50s elapsed]
vsphere_file.discovery_iso: Still creating... [2m0s elapsed]
vsphere_file.discovery_iso: Still creating... [2m10s elapsed]
vsphere_file.discovery_iso: Still creating... [2m20s elapsed]
vsphere_file.discovery_iso: Creation complete after 2m22s [id=[vsanDatastore] Datacenter-XYZ//iso/<cluster-id>-discovery.iso]
module.control_plane_vm[0].vsphere_virtual_machine.vm: Creating...
module.compute_vm[0].vsphere_virtual_machine.vm: Creating...
module.control_plane_vm[0].vsphere_virtual_machine.vm: Still creating... [10s elapsed]
module.compute_vm[0].vsphere_virtual_machine.vm: Still creating... [10s elapsed]
module.control_plane_vm[0].vsphere_virtual_machine.vm: Still creating... [20s elapsed]
module.compute_vm[0].vsphere_virtual_machine.vm: Still creating... [20s elapsed]
module.control_plane_vm[0].vsphere_virtual_machine.vm: Still creating... [30s elapsed]
module.compute_vm[0].vsphere_virtual_machine.vm: Still creating... [30s elapsed]
module.control_plane_vm[0].vsphere_virtual_machine.vm: Still creating... [40s elapsed]
module.compute_vm[0].vsphere_virtual_machine.vm: Still creating... [40s elapsed]
module.control_plane_vm[0].vsphere_virtual_machine.vm: Creation complete after 43s [id=420f7af7-3420-daa9-2e44-a97972f85dd3]
module.compute_vm[0].vsphere_virtual_machine.vm: Creation complete after 49s [id=420f4d74-0175-e45b-69e9-38e54b6fc2e3]

Apply complete! Resources: 5 added, 0 changed, 0 destroyed.

And destroy of the created resources:

$ terraform -chdir=terraform/vsphere/ai destroy -state=terraform.tfstate -var-file=terraform.tfvars
vsphere_file.discovery_iso: Refreshing state... [id=[vsanDatastore] Datacenter-XYZ//iso/<cluster-id>-discovery.iso]
vsphere_folder.folder: Refreshing state... [id=group-v100239]
vsphere_resource_pool.resource_pool: Refreshing state... [id=resgroup-100238]
module.control_plane_vm[0].vsphere_virtual_machine.vm: Refreshing state... [id=420f7af7-3420-daa9-2e44-a97972f85dd3]
module.compute_vm[0].vsphere_virtual_machine.vm: Refreshing state... [id=420f4d74-0175-e45b-69e9-38e54b6fc2e3]

Note: Objects have changed outside of Terraform

Terraform detected the following changes made outside of Terraform since the last "terraform apply":

  # module.compute_vm[0].vsphere_virtual_machine.vm has been changed
  ~ resource "vsphere_virtual_machine" "vm" {
      + custom_attributes                       = {}
      + default_ip_address                      = "W.X.Y.Z"
      ~ guest_ip_addresses                      = [
          + "W.X.Y.Z",
          + "...",
          + "W.X.Y.Z",
          + "...",
          + "...",
        ]
        id                                      = "420f4d74-0175-e45b-69e9-38e54b6fc2e3"
        name                                    = "<cluster-id>-compute-0"
      + pci_device_id                           = []
      + tags                                    = []
      ~ vmware_tools_status                     = "guestToolsNotRunning" -> "guestToolsRunning"
        # (65 unchanged attributes hidden)



        # (6 unchanged blocks hidden)
    }
  # module.control_plane_vm[0].vsphere_virtual_machine.vm has been changed
  ~ resource "vsphere_virtual_machine" "vm" {
      + custom_attributes                       = {}
      + default_ip_address                      = "W.X.Y.Z"
      ~ guest_ip_addresses                      = [
          + "W.X.Y.Z",
          + "...",
          + "W.X.Y.Z",
          + "...",
          + "...",
        ]
        id                                      = "420f7af7-3420-daa9-2e44-a97972f85dd3"
        name                                    = "<cluster-id>-control-plane-0"
      + pci_device_id                           = []
      + tags                                    = []
      ~ vmware_tools_status                     = "guestToolsNotRunning" -> "guestToolsRunning"
        # (65 unchanged attributes hidden)



        # (3 unchanged blocks hidden)
    }
  # vsphere_folder.folder has been changed
  ~ resource "vsphere_folder" "folder" {
      + custom_attributes = {}
        id                = "group-v100239"
      + tags              = []
        # (3 unchanged attributes hidden)
    }
  # vsphere_resource_pool.resource_pool has been changed
  ~ resource "vsphere_resource_pool" "resource_pool" {
        id                       = "resgroup-100238"
        name                     = "<cluster-id>"
      + tags                     = []
        # (12 unchanged attributes hidden)
    }

Unless you have made equivalent changes to your configuration, or ignored the relevant attributes using ignore_changes, the following plan may include actions to undo or respond to these changes.

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  # vsphere_file.discovery_iso will be destroyed
  - resource "vsphere_file" "discovery_iso" {
      - create_directories = true -> null
      - datacenter         = "Datacenter-XYZ" -> null
      - datastore          = "vsanDatastore" -> null
      - destination_file   = "/iso/<cluster-id>-discovery.iso" -> null
      - id                 = "[vsanDatastore] Datacenter-XYZ//iso/<cluster-id>-discovery.iso" -> null
      - source_file        = "/local/path/to/discovery.iso" -> null
    }

  # vsphere_folder.folder will be destroyed
  - resource "vsphere_folder" "folder" {
      - custom_attributes = {} -> null
      - datacenter_id     = "datacenter-43066" -> null
      - id                = "group-v100239" -> null
      - path              = "<cluster-id>" -> null
      - tags              = [] -> null
      - type              = "vm" -> null
    }

  # vsphere_resource_pool.resource_pool will be destroyed
  - resource "vsphere_resource_pool" "resource_pool" {
      - cpu_expandable           = true -> null
      - cpu_limit                = -1 -> null
      - cpu_reservation          = 0 -> null
      - cpu_share_level          = "normal" -> null
      - cpu_shares               = 4000 -> null
      - id                       = "resgroup-100238" -> null
      - memory_expandable        = true -> null
      - memory_limit             = -1 -> null
      - memory_reservation       = 0 -> null
      - memory_share_level       = "normal" -> null
      - memory_shares            = 163840 -> null
      - name                     = "<cluster-id>" -> null
      - parent_resource_pool_id  = "resgroup-43072" -> null
      - scale_descendants_shares = "disabled" -> null
      - tags                     = [] -> null
    }

  # module.compute_vm[0].vsphere_virtual_machine.vm will be destroyed
  - resource "vsphere_virtual_machine" "vm" {
      - boot_delay                              = 0 -> null
      - boot_retry_delay                        = 10000 -> null
      - boot_retry_enabled                      = false -> null
      - change_version                          = "2023-11-23T13:33:38.04791Z" -> null
      - cpu_hot_add_enabled                     = false -> null
      - cpu_hot_remove_enabled                  = false -> null
      - cpu_limit                               = -1 -> null
      - cpu_performance_counters_enabled        = false -> null
      - cpu_reservation                         = 0 -> null
      - cpu_share_count                         = 16000 -> null
      - cpu_share_level                         = "normal" -> null
      - custom_attributes                       = {} -> null
      - datastore_id                            = "datastore-43331" -> null
      - default_ip_address                      = "W.X.Y.Z" -> null
      - efi_secure_boot_enabled                 = false -> null
      - enable_disk_uuid                        = true -> null
      - enable_logging                          = false -> null
      - ept_rvi_mode                            = "automatic" -> null
      - extra_config                            = {
          - "stealclock.enable" = "TRUE"
        } -> null
      - extra_config_reboot_required            = true -> null
      - firmware                                = "bios" -> null
      - folder                                  = "<cluster-id>" -> null
      - force_power_off                         = true -> null
      - guest_id                                = "rhel8_64Guest" -> null
      - guest_ip_addresses                      = [
          - "...",
          - "...",
          - "...",
          - "...",
          - "...",
        ] -> null
      - hardware_version                        = 19 -> null
      - host_system_id                          = "host-43384" -> null
      - hv_mode                                 = "hvAuto" -> null
      - id                                      = "420f4d74-0175-e45b-69e9-38e54b6fc2e3" -> null
      - ide_controller_count                    = 2 -> null
      - latency_sensitivity                     = "normal" -> null
      - memory                                  = 65536 -> null
      - memory_hot_add_enabled                  = false -> null
      - memory_limit                            = -1 -> null
      - memory_reservation                      = 0 -> null
      - memory_share_count                      = 655360 -> null
      - memory_share_level                      = "normal" -> null
      - migrate_wait_timeout                    = 30 -> null
      - moid                                    = "vm-100241" -> null
      - name                                    = "<cluster-id>-compute-0" -> null
      - nested_hv_enabled                       = true -> null
      - num_cores_per_socket                    = 1 -> null
      - num_cpus                                = 16 -> null
      - pci_device_id                           = [] -> null
      - power_state                             = "on" -> null
      - poweron_timeout                         = 300 -> null
      - reboot_required                         = false -> null
      - resource_pool_id                        = "resgroup-100238" -> null
      - run_tools_scripts_after_power_on        = true -> null
      - run_tools_scripts_after_resume          = true -> null
      - run_tools_scripts_before_guest_reboot   = false -> null
      - run_tools_scripts_before_guest_shutdown = true -> null
      - run_tools_scripts_before_guest_standby  = true -> null
      - sata_controller_count                   = 0 -> null
      - scsi_bus_sharing                        = "noSharing" -> null
      - scsi_controller_count                   = 1 -> null
      - scsi_type                               = "pvscsi" -> null
      - shutdown_wait_timeout                   = 3 -> null
      - storage_policy_id                       = "aa6d5a82-1c88-45da-85d3-3d74b91a5bad" -> null
      - swap_placement_policy                   = "inherit" -> null
      - sync_time_with_host                     = false -> null
      - sync_time_with_host_periodically        = false -> null
      - tags                                    = [] -> null
      - tools_upgrade_policy                    = "manual" -> null
      - uuid                                    = "420f4d74-0175-e45b-69e9-38e54b6fc2e3" -> null
      - vapp_transport                          = [] -> null
      - vbs_enabled                             = false -> null
      - vmware_tools_status                     = "guestToolsRunning" -> null
      - vmx_path                                = "a1545f65-5673-bf18-1f22-6805cacb483c/<cluster-id>-compute-0.vmx" -> null
      - vvtd_enabled                            = false -> null
      - wait_for_guest_ip_timeout               = 0 -> null
      - wait_for_guest_net_routable             = false -> null
      - wait_for_guest_net_timeout              = 0 -> null

      - cdrom {
          - client_device  = false -> null
          - datastore_id   = "datastore-43331" -> null
          - device_address = "ide:0:0" -> null
          - key            = 3000 -> null
          - path           = "eeb85c65-c0d4-593b-3830-6805cacb483c/<cluster-id>-discovery.iso" -> null
        }

      - disk {
          - attach            = false -> null
          - controller_type   = "scsi" -> null
          - datastore_id      = "datastore-43331" -> null
          - device_address    = "scsi:0:0" -> null
          - disk_mode         = "persistent" -> null
          - disk_sharing      = "sharingNone" -> null
          - eagerly_scrub     = false -> null
          - io_limit          = -1 -> null
          - io_reservation    = 0 -> null
          - io_share_count    = 1000 -> null
          - io_share_level    = "normal" -> null
          - keep_on_remove    = false -> null
          - key               = 2000 -> null
          - label             = "disk0" -> null
          - path              = "a1545f65-5673-bf18-1f22-6805cacb483c/<cluster-id>-compute-0.vmdk" -> null
          - size              = 120 -> null
          - storage_policy_id = "aa6d5a82-1c88-45da-85d3-3d74b91a5bad" -> null
          - thin_provisioned  = true -> null
          - unit_number       = 0 -> null
          - uuid              = "6000C292-23ef-4eb7-93cf-820f47ea421b" -> null
          - write_through     = false -> null
        }
      - disk {
          - attach            = false -> null
          - controller_type   = "scsi" -> null
          - datastore_id      = "datastore-43331" -> null
          - device_address    = "scsi:0:1" -> null
          - disk_mode         = "persistent" -> null
          - disk_sharing      = "sharingNone" -> null
          - eagerly_scrub     = false -> null
          - io_limit          = -1 -> null
          - io_reservation    = 0 -> null
          - io_share_count    = 1000 -> null
          - io_share_level    = "normal" -> null
          - keep_on_remove    = false -> null
          - key               = 2001 -> null
          - label             = "disk1" -> null
          - path              = "a1545f65-5673-bf18-1f22-6805cacb483c/<cluster-id>-compute-0_1.vmdk" -> null
          - size              = 256 -> null
          - storage_policy_id = "aa6d5a82-1c88-45da-85d3-3d74b91a5bad" -> null
          - thin_provisioned  = true -> null
          - unit_number       = 1 -> null
          - uuid              = "6000C29a-087e-b3ad-4c07-ecc82fbd4fd4" -> null
          - write_through     = false -> null
        }
      - disk {
          - attach            = false -> null
          - controller_type   = "scsi" -> null
          - datastore_id      = "datastore-43331" -> null
          - device_address    = "scsi:0:2" -> null
          - disk_mode         = "persistent" -> null
          - disk_sharing      = "sharingNone" -> null
          - eagerly_scrub     = false -> null
          - io_limit          = -1 -> null
          - io_reservation    = 0 -> null
          - io_share_count    = 1000 -> null
          - io_share_level    = "normal" -> null
          - keep_on_remove    = false -> null
          - key               = 2002 -> null
          - label             = "disk2" -> null
          - path              = "a1545f65-5673-bf18-1f22-6805cacb483c/<cluster-id>-compute-0_2.vmdk" -> null
          - size              = 256 -> null
          - storage_policy_id = "aa6d5a82-1c88-45da-85d3-3d74b91a5bad" -> null
          - thin_provisioned  = true -> null
          - unit_number       = 2 -> null
          - uuid              = "6000C294-b53c-863b-ef66-8d6471774b21" -> null
          - write_through     = false -> null
        }
      - disk {
          - attach            = false -> null
          - controller_type   = "scsi" -> null
          - datastore_id      = "datastore-43331" -> null
          - device_address    = "scsi:0:3" -> null
          - disk_mode         = "persistent" -> null
          - disk_sharing      = "sharingNone" -> null
          - eagerly_scrub     = false -> null
          - io_limit          = -1 -> null
          - io_reservation    = 0 -> null
          - io_share_count    = 1000 -> null
          - io_share_level    = "normal" -> null
          - keep_on_remove    = false -> null
          - key               = 2003 -> null
          - label             = "disk3" -> null
          - path              = "a1545f65-5673-bf18-1f22-6805cacb483c/<cluster-id>-compute-0_3.vmdk" -> null
          - size              = 256 -> null
          - storage_policy_id = "aa6d5a82-1c88-45da-85d3-3d74b91a5bad" -> null
          - thin_provisioned  = true -> null
          - unit_number       = 3 -> null
          - uuid              = "6000C295-fc17-5b37-2c6a-2cee1aafae46" -> null
          - write_through     = false -> null
        }

      - network_interface {
          - adapter_type          = "vmxnet3" -> null
          - bandwidth_limit       = -1 -> null
          - bandwidth_reservation = 0 -> null
          - bandwidth_share_count = 50 -> null
          - bandwidth_share_level = "normal" -> null
          - device_address        = "pci:0:7" -> null
          - key                   = 4000 -> null
          - mac_address           = "00:50:56:8f:7d:0b" -> null
          - network_id            = "network-43332" -> null
          - use_static_mac        = false -> null
        }
    }

  # module.control_plane_vm[0].vsphere_virtual_machine.vm will be destroyed
  - resource "vsphere_virtual_machine" "vm" {
      - boot_delay                              = 0 -> null
      - boot_retry_delay                        = 10000 -> null
      - boot_retry_enabled                      = false -> null
      - change_version                          = "2023-11-23T13:33:43.719778Z" -> null
      - cpu_hot_add_enabled                     = false -> null
      - cpu_hot_remove_enabled                  = false -> null
      - cpu_limit                               = -1 -> null
      - cpu_performance_counters_enabled        = false -> null
      - cpu_reservation                         = 0 -> null
      - cpu_share_count                         = 4000 -> null
      - cpu_share_level                         = "normal" -> null
      - custom_attributes                       = {} -> null
      - datastore_id                            = "datastore-43331" -> null
      - default_ip_address                      = "W.X.Y.Z" -> null
      - efi_secure_boot_enabled                 = false -> null
      - enable_disk_uuid                        = true -> null
      - enable_logging                          = false -> null
      - ept_rvi_mode                            = "automatic" -> null
      - extra_config                            = {
          - "stealclock.enable" = "TRUE"
        } -> null
      - extra_config_reboot_required            = true -> null
      - firmware                                = "bios" -> null
      - folder                                  = "<cluster-id>" -> null
      - force_power_off                         = true -> null
      - guest_id                                = "rhel8_64Guest" -> null
      - guest_ip_addresses                      = [
          - "...",
          - "...",
          - "...",
          - "...",
          - "...",
        ] -> null
      - hardware_version                        = 19 -> null
      - host_system_id                          = "host-43368" -> null
      - hv_mode                                 = "hvAuto" -> null
      - id                                      = "420f7af7-3420-daa9-2e44-a97972f85dd3" -> null
      - ide_controller_count                    = 2 -> null
      - latency_sensitivity                     = "normal" -> null
      - memory                                  = 16384 -> null
      - memory_hot_add_enabled                  = false -> null
      - memory_limit                            = -1 -> null
      - memory_reservation                      = 0 -> null
      - memory_share_count                      = 163840 -> null
      - memory_share_level                      = "normal" -> null
      - migrate_wait_timeout                    = 30 -> null
      - moid                                    = "vm-100240" -> null
      - name                                    = "<cluster-id>-control-plane-0" -> null
      - nested_hv_enabled                       = false -> null
      - num_cores_per_socket                    = 1 -> null
      - num_cpus                                = 4 -> null
      - pci_device_id                           = [] -> null
      - power_state                             = "on" -> null
      - poweron_timeout                         = 300 -> null
      - reboot_required                         = false -> null
      - resource_pool_id                        = "resgroup-100238" -> null
      - run_tools_scripts_after_power_on        = true -> null
      - run_tools_scripts_after_resume          = true -> null
      - run_tools_scripts_before_guest_reboot   = false -> null
      - run_tools_scripts_before_guest_shutdown = true -> null
      - run_tools_scripts_before_guest_standby  = true -> null
      - sata_controller_count                   = 0 -> null
      - scsi_bus_sharing                        = "noSharing" -> null
      - scsi_controller_count                   = 1 -> null
      - scsi_type                               = "pvscsi" -> null
      - shutdown_wait_timeout                   = 3 -> null
      - storage_policy_id                       = "aa6d5a82-1c88-45da-85d3-3d74b91a5bad" -> null
      - swap_placement_policy                   = "inherit" -> null
      - sync_time_with_host                     = false -> null
      - sync_time_with_host_periodically        = false -> null
      - tags                                    = [] -> null
      - tools_upgrade_policy                    = "manual" -> null
      - uuid                                    = "420f7af7-3420-daa9-2e44-a97972f85dd3" -> null
      - vapp_transport                          = [] -> null
      - vbs_enabled                             = false -> null
      - vmware_tools_status                     = "guestToolsRunning" -> null
      - vmx_path                                = "a1545f65-765f-40ac-7f95-6805cacb4bc0/<cluster-id>-control-plane-0.vmx" -> null
      - vvtd_enabled                            = false -> null
      - wait_for_guest_ip_timeout               = 0 -> null
      - wait_for_guest_net_routable             = false -> null
      - wait_for_guest_net_timeout              = 0 -> null

      - cdrom {
          - client_device  = false -> null
          - datastore_id   = "datastore-43331" -> null
          - device_address = "ide:0:0" -> null
          - key            = 3000 -> null
          - path           = "eeb85c65-c0d4-593b-3830-6805cacb483c/<cluster-id>-discovery.iso" -> null
        }

      - disk {
          - attach            = false -> null
          - controller_type   = "scsi" -> null
          - datastore_id      = "datastore-43331" -> null
          - device_address    = "scsi:0:0" -> null
          - disk_mode         = "persistent" -> null
          - disk_sharing      = "sharingNone" -> null
          - eagerly_scrub     = false -> null
          - io_limit          = -1 -> null
          - io_reservation    = 0 -> null
          - io_share_count    = 1000 -> null
          - io_share_level    = "normal" -> null
          - keep_on_remove    = false -> null
          - key               = 2000 -> null
          - label             = "disk0" -> null
          - path              = "a1545f65-765f-40ac-7f95-6805cacb4bc0/<cluster-id>-control-plane-0.vmdk" -> null
          - size              = 120 -> null
          - storage_policy_id = "aa6d5a82-1c88-45da-85d3-3d74b91a5bad" -> null
          - thin_provisioned  = true -> null
          - unit_number       = 0 -> null
          - uuid              = "6000C29d-4ed6-3eda-96d7-046039ee6125" -> null
          - write_through     = false -> null
        }

      - network_interface {
          - adapter_type          = "vmxnet3" -> null
          - bandwidth_limit       = -1 -> null
          - bandwidth_reservation = 0 -> null
          - bandwidth_share_count = 50 -> null
          - bandwidth_share_level = "normal" -> null
          - device_address        = "pci:0:7" -> null
          - key                   = 4000 -> null
          - mac_address           = "00:50:56:8f:da:fa" -> null
          - network_id            = "network-43332" -> null
          - use_static_mac        = false -> null
        }
    }

Plan: 0 to add, 0 to change, 5 to destroy.

Do you really want to destroy all resources?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

module.control_plane_vm[0].vsphere_virtual_machine.vm: Destroying... [id=420f7af7-3420-daa9-2e44-a97972f85dd3]
module.compute_vm[0].vsphere_virtual_machine.vm: Destroying... [id=420f4d74-0175-e45b-69e9-38e54b6fc2e3]
module.control_plane_vm[0].vsphere_virtual_machine.vm: Still destroying... [id=420f7af7-3420-daa9-2e44-a97972f85dd3, 10s elapsed]
module.compute_vm[0].vsphere_virtual_machine.vm: Still destroying... [id=420f4d74-0175-e45b-69e9-38e54b6fc2e3, 10s elapsed]
module.control_plane_vm[0].vsphere_virtual_machine.vm: Destruction complete after 14s
module.compute_vm[0].vsphere_virtual_machine.vm: Destruction complete after 15s
vsphere_folder.folder: Destroying... [id=group-v100239]
vsphere_resource_pool.resource_pool: Destroying... [id=resgroup-100238]
vsphere_file.discovery_iso: Destroying... [id=[vsanDatastore] Datacenter-XYZ//iso/<cluster-id>-discovery.iso]
vsphere_folder.folder: Destruction complete after 2s
vsphere_resource_pool.resource_pool: Destruction complete after 2s
vsphere_file.discovery_iso: Destruction complete after 2s

Destroy complete! Resources: 5 destroyed.

@dahorak dahorak added the Verified Mark when PR was verified and log provided label Nov 23, 2023
@dahorak dahorak force-pushed the hci-deployment-automation-on-vsphere branch from 13b90da to bcbd97b Compare November 23, 2023 14:50
vavuthu
vavuthu previously approved these changes Nov 24, 2023
@vavuthu
Copy link
Contributor

vavuthu commented Nov 24, 2023

@dahorak can we move whole terraform into separate folder like ai so that we are aware that all these terraform code belongs to ai

@dahorak
Copy link
Contributor Author

dahorak commented Nov 27, 2023

@dahorak can we move whole terraform into separate folder like ai so that we are aware that all these terraform code belongs to ai

My intention was opposite structure - so the deployment type is at the end:
terraform/<platform>/<deployment-type> (in this case terraform/vsphere/ai)
Not sure, if it would ever happen, but my intention was to have one place for any terraform scripts we will need in the future.

petr-balogh
petr-balogh previously approved these changes Nov 28, 2023
@petr-balogh
Copy link
Member

terraform/vsphere/ai

I am more for option terraform/ai/platform

@dahorak
Copy link
Contributor Author

dahorak commented Nov 28, 2023

terraform/vsphere/ai

I am more for option terraform/ai/platform

@vavuthu do you agree with Petr's suggestion?

@vavuthu
Copy link
Contributor

vavuthu commented Nov 28, 2023

terraform/vsphere/ai

I am more for option terraform/ai/platform

@vavuthu do you agree with Petr's suggestion?

ack

rename terraform/vsphere/ai to terraform/ai/vsphere

Signed-off-by: Daniel Horak <[email protected]>
@dahorak dahorak dismissed stale reviews from petr-balogh and vavuthu via 2073ec0 November 28, 2023 10:45
@openshift-ci openshift-ci bot removed the lgtm label Nov 28, 2023
@openshift-ci openshift-ci bot added the lgtm label Nov 29, 2023
Copy link

openshift-ci bot commented Nov 30, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dahorak, petr-balogh, vavuthu

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@dahorak dahorak merged commit 3afe420 into red-hat-storage:master Nov 30, 2023
4 checks passed
@dahorak dahorak deleted the hci-deployment-automation-on-vsphere branch November 30, 2023 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm size/L PR that changes 100-499 lines team/ecosystem Ecosystem team related issues/PRs Verified Mark when PR was verified and log provided
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants