Create a new VMware Compute Cluster and attach a single or list of server(s)

published

Overview

Cisco Intersight Service for HashiCorp Terraform (IST) addresses the challenge of securely connecting and configuring on-premises and hybrid environments to work with Terraform Cloud Business Tier. Leveraging Intersight Assist, users can integrate Terraform Cloud Business with Cisco Intersight, enabling secure communication between on-premises data centers and edge locations with the IaC platform. This means users can spend less time managing the end-to-end lifecycle of Terraform Cloud Agents, benefiting from native integration directly within Intersight, including upgrades and the ability to scale as demand grows.

In this example, we cover a simple use case to create a new compute cluster in existing data center and assign a new host (or a list of groups) to the given cluster. This use case will walk the user thought the following steps:

  1. Adding your Terraform Cloud for Business Tier Credentials
  2. Adding your Terraform Cloud Agent
  3. Executing Terraform Code to create

The list of host is passed as a Map like in the example below:

servers = {
  host1 = {
    hostname            = "192.168.100.146"
    license             = "LICENSE_KEY_HER"
    thumbprint          = "AA:BB:CC:CC:DD:EE:A1:A2:A3:A4:B1:B2:B3:B4:12:34:56:1D:1E:EE"
    maintenance_mode    = true
  }
  host2 = {
    hostname            = "192.168.100.8"
    license             = "LICENSE_KEY_HER"
    thumbprint          = "FF:BB:CC:CC:DD:EE:A1:A2:A3:A4:B1:B2:B3:B4:12:34:56:1D:1E:FF"
    maintenance_mode    = false
  }
}

Requirements

  1. Intersight SaaS platform account with Advantage licenses
  2. An Intersight Assist appliance that is connected to your Intersight environment
  3. Terraform Cloud Business Tier Account
  4. An exhisting DataCenter
  5. vCenter Server Access: username, password and host
  6. GitHub account to host your Terraform code
  7. A workspace in Terraform Cloud
  8. A valid license(s) key that will be applied to the hosts

Steps to Deploy Use Case

Setup Terraform Cloud Business Tier Account

To add your Terraform Cloud credentials in Intersight you will need the following:

  1. Terraform Cloud Username
  2. Terraform Cloud API Token
  3. Terraform Cloud Organization

Login to Intersight and claim your Terraform Cloud target.

Claim Terraform Agent

Once the target is created, the agent can be added assist.

Create GitHub Repo

  1. Go to https://github.com/CiscoDevNet/ist-vmware-compute-cluster
  2. Fork it into your own GitHub account

Create Workspace in Terraform Cloud

  1. Create a new workspace and choose a version control provider (setup in the previous step) that hosts the Terraform configuration for this workspace.
  2. Go to the Variables section and add the following variables with the value specific to your environment (the values provided below are examples)
Key Value Type
vsphere_server 192.168.x.x String
vsphere_user administrator@vsphere.local String
vsphere_password ******** String, Sensitive
datacenter RMLAB String
dc_cluster_name RMLAB - zTF_Test String
h_username root String
h_password ******* String, Sensitive

Variables

Input Requirements

servers = {
  host1 = {
    hostname            = "192.168.100.146"
    license             = "LICENSE_KEY_HER"
    thumbprint          = "AA:BB:CC:CC:DD:EE:A1:A2:A3:A4:B1:B2:B3:B4:12:34:56:1D:1E:EE"
    maintenance_mode    = true
  }
  host2 = {
    hostname            = "192.168.100.8"
    license             = "LICENSE_KEY_HER"
    thumbprint          = "FF:BB:CC:CC:DD:EE:A1:A2:A3:A4:B1:B2:B3:B4:12:34:56:1D:1E:FF"
    maintenance_mode    = false
  }
}

Execute Deployment

To execute the Terraform code in your datacenter click on the Queue Plan Manually button

Queue Terraform Plan

Results

You will see one new compute cluster created and an host as part of thre cluster
The following output will be generated:
Queue Terraform Plan

Related Sandbox

Get hands on experience with Intersight Service for Terraform in DevNet's Sandbox environment.

Cisco Intersight Service for HashiCorp Terraform

Links to DevNet Learning Labs

Learn how to provision virtual machines in vSphere using Intersight Service for Terraform.

Introduction to Intersight Service for Hashicorp Terraform
Provisioning VMs using Intersight Terraform Service for Hashicorp

Use Case

Create a new VMware Compute Cluster and attach a single or list of server(s)

Overview

Cisco Intersight Service for HashiCorp Terraform (IST) addresses the challenge of securely connecting and configuring on-premises and hybrid environments to work with Terraform Cloud Business Tier. Leveraging Intersight Assist, users can integrate Terraform Cloud Business with Cisco Intersight, enabling secure communication between on-premises data centers and edge locations with the IaC platform. This means users can spend less time managing the end-to-end lifecycle of Terraform Cloud Agents, benefiting from native integration directly within Intersight, including upgrades and the ability to scale as demand grows.

In this example, we cover a simple use case to create a new compute cluster in existing data center and assign a new host (or a list of groups) to the given cluster. This use case will walk the user thought the following steps: 1. Adding your Terraform Cloud for Business Tier Credentials 2. Adding your Terraform Cloud Agent 3. Executing Terraform Code to create

The list of host is passed as a Map like in the example below:

servers = {
  host1 = {
    hostname            = "192.168.100.146"
    license             = "LICENSE_KEY_HER"
    thumbprint          = "AA:BB:CC:CC:DD:EE:A1:A2:A3:A4:B1:B2:B3:B4:12:34:56:1D:1E:EE"
    maintenance_mode    = true
  }
  host2 = {
    hostname            = "192.168.100.8"
    license             = "LICENSE_KEY_HER"
    thumbprint          = "FF:BB:CC:CC:DD:EE:A1:A2:A3:A4:B1:B2:B3:B4:12:34:56:1D:1E:FF"
    maintenance_mode    = false
  }
}

Note thumbprint is optional, but you will need it in case the Certificate Authority that signed the host certificate is not trusted.

Requirements

  1. Intersight SaaS platform account with Advantage licenses
  2. An Intersight Assist appliance that is connected to your Intersight environment
  3. Terraform Cloud Business Tier Account
  4. An exhisting DataCenter
  5. vCenter Server Access: username, password and host
  6. GitHub account to host your Terraform code
  7. A workspace in Terraform Cloud
  8. A valid license(s) key that will be applied to the hosts

Steps to Deploy Use Case

Setup Terraform Cloud Business Tier Account

To add your Terraform Cloud credentials in Intersight you will need the following:

  1. Terraform Cloud Username
  2. Terraform Cloud API Token
  3. Terraform Cloud Organization

Login to Intersight and claim your Terraform Cloud target.

Claim Terraform Agent

Once the target is created, the agent can be added assist.

Create GitHub Repo

  1. Go to https://github.com/CiscoDevNet/ist-vmware-compute-cluster
  2. Fork it into your own GitHub account

Create Workspace in Terraform Cloud

  1. Create a new workspace and choose a version control provider (setup in the previous step) that hosts the Terraform configuration for this workspace.
  2. Go to the Variables section and add the following variables with the value specific to your environment (the values provided below are examples)
Key Value Type
vsphere_server 192.168.x.x String
vsphere_user administrator@vsphere.local String
vsphere_password ******** String, Sensitive
datacenter RMLAB String
dc_cluster_name RMLAB - zTF_Test String
h_username root String
h_password ******* String, Sensitive

Variables

Input Requirements

Input Type Description
hostname Mandatory The FQDN or IP address of the host
license Optional A valid license key. Must be present in vSphere
thumbprint Optional The SHA-1 host's thumbprint. You will need to specify in case the Certificate Authority that signed the host certificate is not trusted
maintenance_mode Optional Default is true.

Sample input:

servers = {
  host1 = {
    hostname            = "192.168.100.146"
    license             = "LICENSE_KEY_HER"
    thumbprint          = "AA:BB:CC:CC:DD:EE:A1:A2:A3:A4:B1:B2:B3:B4:12:34:56:1D:1E:EE"
    maintenance_mode    = true
  }
  host2 = {
    hostname            = "192.168.100.8"
    license             = "LICENSE_KEY_HER"
    thumbprint          = "FF:BB:CC:CC:DD:EE:A1:A2:A3:A4:B1:B2:B3:B4:12:34:56:1D:1E:FF"
    maintenance_mode    = false
  }
}

Execute Deployment

To execute the Terraform code in your datacenter click on the Queue Plan Manually button

Queue Terraform Plan

Results

You will see one new compute cluster created and an host as part of thre cluster The following output will be generated: Queue Terraform Plan

Get hands on experience with Intersight Service for Terraform in DevNet's Sandbox environment.

Cisco Intersight Service for HashiCorp Terraform

Learn how to provision virtual machines in vSphere using Intersight Service for Terraform.

Introduction to Intersight Service for Hashicorp Terraform Provisioning VMs using Intersight Terraform Service for Hashicorp

Create a new VMware Compute Cluster and attach a single or list of server(s)

Overview

Cisco Intersight Service for HashiCorp Terraform (IST) addresses the challenge of securely connecting and configuring on-premises and hybrid environments to work with Terraform Cloud Business Tier. Leveraging Intersight Assist, users can integrate Terraform Cloud Business with Cisco Intersight, enabling secure communication between on-premises data centers and edge locations with the IaC platform. This means users can spend less time managing the end-to-end lifecycle of Terraform Cloud Agents, benefiting from native integration directly within Intersight, including upgrades and the ability to scale as demand grows.

In this example, we cover a simple use case to create a new compute cluster in existing data center and assign a new host (or a list of groups) to the given cluster. This use case will walk the user thought the following steps: 1. Adding your Terraform Cloud for Business Tier Credentials 2. Adding your Terraform Cloud Agent 3. Executing Terraform Code to create

The list of host is passed as a Map like in the example below:

servers = {
  host1 = {
    hostname            = "192.168.100.146"
    license             = "LICENSE_KEY_HER"
    thumbprint          = "AA:BB:CC:CC:DD:EE:A1:A2:A3:A4:B1:B2:B3:B4:12:34:56:1D:1E:EE"
    maintenance_mode    = true
  }
  host2 = {
    hostname            = "192.168.100.8"
    license             = "LICENSE_KEY_HER"
    thumbprint          = "FF:BB:CC:CC:DD:EE:A1:A2:A3:A4:B1:B2:B3:B4:12:34:56:1D:1E:FF"
    maintenance_mode    = false
  }
}

Note thumbprint is optional, but you will need it in case the Certificate Authority that signed the host certificate is not trusted.

Requirements

  1. Intersight SaaS platform account with Advantage licenses
  2. An Intersight Assist appliance that is connected to your Intersight environment
  3. Terraform Cloud Business Tier Account
  4. An exhisting DataCenter
  5. vCenter Server Access: username, password and host
  6. GitHub account to host your Terraform code
  7. A workspace in Terraform Cloud
  8. A valid license(s) key that will be applied to the hosts

Steps to Deploy Use Case

Setup Terraform Cloud Business Tier Account

To add your Terraform Cloud credentials in Intersight you will need the following:

  1. Terraform Cloud Username
  2. Terraform Cloud API Token
  3. Terraform Cloud Organization

Login to Intersight and claim your Terraform Cloud target.

Claim Terraform Agent

Once the target is created, the agent can be added assist.

Create GitHub Repo

  1. Go to https://github.com/CiscoDevNet/ist-vmware-compute-cluster
  2. Fork it into your own GitHub account

Create Workspace in Terraform Cloud

  1. Create a new workspace and choose a version control provider (setup in the previous step) that hosts the Terraform configuration for this workspace.
  2. Go to the Variables section and add the following variables with the value specific to your environment (the values provided below are examples)
Key Value Type
vsphere_server 192.168.x.x String
vsphere_user administrator@vsphere.local String
vsphere_password ******** String, Sensitive
datacenter RMLAB String
dc_cluster_name RMLAB - zTF_Test String
h_username root String
h_password ******* String, Sensitive

Variables

Input Requirements

Input Type Description
hostname Mandatory The FQDN or IP address of the host
license Optional A valid license key. Must be present in vSphere
thumbprint Optional The SHA-1 host's thumbprint. You will need to specify in case the Certificate Authority that signed the host certificate is not trusted
maintenance_mode Optional Default is true.

Sample input:

servers = {
  host1 = {
    hostname            = "192.168.100.146"
    license             = "LICENSE_KEY_HER"
    thumbprint          = "AA:BB:CC:CC:DD:EE:A1:A2:A3:A4:B1:B2:B3:B4:12:34:56:1D:1E:EE"
    maintenance_mode    = true
  }
  host2 = {
    hostname            = "192.168.100.8"
    license             = "LICENSE_KEY_HER"
    thumbprint          = "FF:BB:CC:CC:DD:EE:A1:A2:A3:A4:B1:B2:B3:B4:12:34:56:1D:1E:FF"
    maintenance_mode    = false
  }
}

Execute Deployment

To execute the Terraform code in your datacenter click on the Queue Plan Manually button

Queue Terraform Plan

Results

You will see one new compute cluster created and an host as part of thre cluster The following output will be generated: Queue Terraform Plan

Get hands on experience with Intersight Service for Terraform in DevNet's Sandbox environment.

Cisco Intersight Service for HashiCorp Terraform

Learn how to provision virtual machines in vSphere using Intersight Service for Terraform.

Introduction to Intersight Service for Hashicorp Terraform Provisioning VMs using Intersight Terraform Service for Hashicorp

View code on GitHub
  • Owner

  • Contributors

    +1Github contributor
  • Categories

  • Products

    Intersight
  • Programming Languages

    HCL
  • License

    BSD 3-Clause "New" or "Revised" License

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.