Skip to content

Latest commit

 

History

History
168 lines (128 loc) · 5.25 KB

vsphere_instance.md

File metadata and controls

168 lines (128 loc) · 5.25 KB
page_title subcategory description
morpheus_vsphere_instance Resource - terraform-provider-morpheus
Provides a Morpheus instance resource.

morpheus_vsphere_instance

Provides a Morpheus instance resource.

Example Usage

data "morpheus_group" "morpheus_lab" {
  name = "MORPHEUS"
}

data "morpheus_cloud" "morpheus_vsphere" {
  name = "MORPHEUSVCENTER"
}

data "morpheus_resource_pool" "vsphere_resource_pool" {
  name     = "Morpheus-Cluster"
  cloud_id = data.morpheus_cloud.morpheus_vsphere.id
}

data "morpheus_instance_type" "ubuntu" {
  name = "Ubuntu"
}

data "morpheus_instance_layout" "ubuntu" {
  name    = "VMware VM"
  version = "22.04"
}

data "morpheus_network" "vmnetwork" {
  name = "VM Network"
}

data "morpheus_plan" "vmware" {
  name           = "1 CPU, 4GB Memory"
  provision_type = "vmware"
}

resource "morpheus_vsphere_instance" "tf_example_vsphere_instance" {
  name               = "tfvsphere"
  description        = "Terraform instance example"
  cloud_id           = data.morpheus_cloud.morpheus_vsphere.id
  group_id           = data.morpheus_group.morpheus_lab.id
  instance_type_id   = data.morpheus_instance_type.ubuntu.id
  instance_layout_id = data.morpheus_instance_layout.ubuntu.id
  plan_id            = data.morpheus_plan.vmware.id
  environment        = "dev"
  resource_pool_id   = data.morpheus_resource_pool.vsphere_resource_pool.id
  labels             = ["demo", "terraform"]

  interfaces {
    network_id = data.morpheus_network.vmnetwork.id
  }

  tags = {
    name = "ubuntutf"
  }

  evar {
    name   = "application"
    value  = "demo"
    export = true
    masked = true
  }

  custom_options = {
    vsphereDatacenter = "denver"
  }
}

Schema

Required

  • cloud_id (Number) The ID of the cloud associated with the instance
  • group_id (Number) The ID of the group associated with the instance
  • instance_layout_id (Number) The layout to provision the instance from
  • instance_type_id (Number) The type of instance to provision
  • plan_id (Number) The service plan associated with the instance

Optional

  • asset_tag (String) The asset tag associated with the instance
  • create_user (Boolean) Whether to create a user account on the instance that is associated with the provisioning user account
  • custom_options (Map of String) Custom options to pass to the instance
  • description (String) The user friendly description of the instance
  • domain_id (Number) The ID of the network domain to provision the instance to
  • environment (String) The environment to assign the instance to
  • evar (Block List) The environment variables to create (see below for nested schema)
  • interfaces (Block List) The instance network interfaces to create (see below for nested schema)
  • labels (List of String) The list of labels to add to the instance
  • name (String) The name of the instance
  • nested_virtualization (Boolean) Whether to skip configuration of nested virtualization
  • resource_pool_id (Number) The ID of the resource pool to provision the instance to
  • skip_agent_install (Boolean) Whether to skip installation of the Morpheus agent
  • tags (Map of String) Tags to assign to the instance
  • timeouts (Block, Optional) (see below for nested schema)
  • user_group_id (Number) The id of the user group associated with the instance
  • volumes (Block List) The instance volumes to create (see below for nested schema)
  • workflow_id (Number) The ID of the provisioning workflow to execute (workflow_name can be used alternatively, only one is needed)
  • workflow_name (String) The name of the provisioning workflow to execute (workflow_id can be used alternatively, only one is needed)

Read-Only

  • id (String) The ID of the instance

Nested Schema for evar

Optional:

  • export (Boolean) Whether the environment variable is exported as an instance tag
  • masked (Boolean) Whether the environment variable is masked for security purposes
  • name (String) The name of the environment variable
  • value (String) The value of the environment variable

Nested Schema for interfaces

Optional:

  • ip_address (String)
  • ip_mode (String)
  • network_group (Boolean) Whether the network id provided is for a network group or not
  • network_id (Number) The network to assign the network interface to
  • network_interface_type_id (Number) The network interface type

Nested Schema for timeouts

Optional:

  • create (String)
  • delete (String)
  • read (String)
  • update (String)

Nested Schema for volumes

Optional:

  • datastore_id (Number) The ID of the datastore
  • name (String) The name/type of the LV being created
  • root (Boolean) Whether the volume is the root volume of the instance
  • size (Number) The size of the LV being created
  • size_id (Number) The ID of an existing LV to assign to the instance
  • storage_type (Number) The ID of the LV type

Import

Import is supported using the following syntax:

terraform import morpheus_vsphere_instance.tf_example_vsphere_instance 1