Home

Example Usage


 
 variable VCD_IP {
 type = "string"
 default = "XXXXXXXXXXXXXX"
 }

 variable VCD_USER {
 type = "string"
 default = "XXXXXXXXXXXXXX"
 }

 variable VCD_ORG {
 type = "string"
 default = "XXXXXXXXXXXXXX"
 }

 variable VCD_ALLOW_UNVERIFIED_SSL {
 type = "string"
 default = "XXXXXXXXXXXXXX"
 }

 variable VCD_USE_VCD_CLI_PROFILE {
 type = "string"
 default = "XXXXXXXXXXXXXX"
 }

 provider "vcloud-director" {
 allow_unverified_ssl = "${var.VCD_ALLOW_UNVERIFIED_SSL}"
 use_vcd_cli_profile = "${var.VCD_USE_VCD_CLI_PROFILE}"
 ip = "${var.VCD_IP}"
 user = "${var.VCD_USER}"
 org = "${var.VCD_ORG}"
 }
 
 

Argument Reference


The following arguments will be treated as Environment variables for Terraform Provider execution. These variables are required to be set before starting the Terraform Provider execution.

  • VCD_ALLOW_UNVERIFIED_SSL - ("true" / "false") Whether VCD should allow unverified SSL connection or not.
  • VCD_USE_VCD_CLI_PROFILE - ("true" / "false")
    If it is false then specify VCD Password in the Provider settings above.
    If it is true then use the below command to log in to VCD_CLI and do not include VCD_PASSWORD in the Provider settings above.
     
     vcd login --no-verify-ssl-certs "VCD_HOST_NAME" "VCD_ORG_NAME" "VCD_USER_NAME" -p "VCD_PASSWORD"
     
     
  • VCD_IP - (string) VCD IP Address
  • VCD_USER - (string) VCD User Name
  • VCD_ORG - (string) VCD Org Name
  • VCD_PASSWORD - (string) VCD Passowrd

Sample


Please take a look at sample main.tf

Example Usage


 
 resource "vcloud-director_catalog" "source_catalog" {
 name = "source_catalog"
 description = "source_catalog desc"
 shared = "true"
 }
 
 

Argument Reference


The following arguments are supported

  • name - (Required) Name of the catalog
  • description - (Optional) Description Text for the catalog
  • shared - (Optional) Controls if the catalog is published to external org

Example Usage


 
 resource "vcloud-director_catalog_item_ova" "item2" {
 item_name = "capturedItem"
 catalog_name = "catalog_ova"
 source_vdc_name ="catalog_vdc"
 source_vapp_name = "catalog_vapp"
 customize_on_instantiate = "true"
 }
 
 
 
 resource "vcloud-director_catalog_item_ova" "item2" {
 item_name = "uploadedova"
 catalog_name = "catalog_ova"
 source_file_path = "/home/catalog-media.iso"
 description = "iso upload"
 }
 
 

Argument Reference


The following arguments are supported

  • item_name - (Required) destination catalog item name
  • catalog_name - (Required) destination catalog name
  • source_file_path - (Optional) ova or media file path
  • source_vdc_name - (Optional) source vdc to capture a vapp from
  • source_vapp_name - (Optional) source vapp to capture a catalog item
  • customize_on_instantiate - (Optional) "true/false"
  • description - (Optional) description text for the ova item

Example Usage


 
 resource "vcloud-director_catalog_item_media" "item1" {
 item_name = "item1"
 catalog_name= "catalogname"
 source_file_path="/home/centos.iso"
 }
 
 

Argument Reference


The following arguments are supported

  • item_name - (Required) destination catalog item name
  • catalog_name - (Required) destination catalog name
  • source_file_path - (Required) media file path

Example Usage


 
 resource "vcloud-director_vapp" "vapp1" {
 name = "vcdvapp"
 template_name = "vcdlab"
 catalog_name = "source1"
 vdc = "vdcname"
 network = "ORGNET1"
 ip_allocation_mode = "static"
 cpu = "4"
 memory = "2000"
 storage_profile = "SP_PERFORMANCE_SDD"
 }
 
 

Argument Reference


The following arguments are supported

  • name - (Required) Vapp name
  • template_name - (Required) source catalog item name
  • catalog_name - (Required) source catalog name
  • vdc - (Required) Org Vdc where this VAPP gets created
  • network - (Optional) org network for the vapp
  • ip_allocation_mode -(Optional) "static"/"dynamic"
  • memory - (Optional) in MB
  • cpu - (Optional) number of CPU
  • storage_profile - (Optional) storage profile to use for the vapp
  • power_on - (Optional) "true" / "false"
  • accept_all_eulas - (Optional) "true" / "false"

Example Usage


 
 resource "vcloud-director_vapp_vm" "vm1" {
 target_vm_name = "vm_name"
 target_vapp = "vapp1"
 target_vdc = "vdc1"
 source_vapp = "vapp1"
 source_vm_name = "sourcevm1" 
 hostname = "vcdcell"
 password = "rootpass" 
 password_auto = "false"
 password_reset = "false"
 cust_script = "/home/setup.sh"
 network = "MGMT"
 storage_profile = "PERFORMACE_1"
 power_on = "true"
 all_eulas_accepted = "true"
 }
 
 
 
 resource "vcloud-director_vapp_vm" "vm1" {
 target_vm_name = "vm_name"
 target_vapp = "vapp1"
 target_vdc = "vdc1"
 source_catalog_name = "cata1"
 source_template_name = "template1"
 hostname = "vcdcell"
 password = "rootpass" 
 password_auto = "false"
 password_reset = "false"
 cust_script = "/home/setup.sh"
 network = "MGMT"
 storage_profile = "PERFORMACE_1"
 power_on = "true"
 all_eulas_accepted = "true"
 }
 
 

Argument Reference


The following arguments are supported

  • source_vapp - (Optional) source vApp name
  • source_vm_name - (Optional) source VM name
  • source_catalog_name - (Optional) source catalog name
  • source_template_name - (Optional) source template name
  • target_vapp - (Required) target vApp name
  • target_vm_name - (Required) target VM name
  • target_vdc - (Required) target VDC
  • hostname - (Optional) target guest hostname
  • password - (Required) set the administrator password for target machine
  • password_auto - (Required) "true"/"false", autogenerate administrator password
  • password_reset - (Rptional) "true" if the administrator password for this virtual machine must be reset after first use else "false"
  • cust_script - (Optional) script to run on guest customization
  • network - (Optional) Name of the vApp network to connect. If omitted, the VM won't be connected to any network
  • storage_profile - (Optional) the name of the storage profile to be used for this VM
  • power_on - (Optional) "true" / "false"
  • all_eulas_accepted - (Optional) "true" / "false"
  • ip_allocation_mode - (Optional) "dhcp"
  • virtual_cpus - (Optional) Number of virtual cpus
  • cores_per_socket- (Optional) Number of cores per socket
  • memory- (Optional) memory size in MB

Example Usage


 
 resource "vcloud-director_independent_disk" "IndependentDisk1" {
 name = "DISK_NAME"
 size = "100"
 vdc = "OVD4"
 }
 
 

Argument Reference


The following arguments are supported

  • name - (Required) Disk Name
  • size - (Required) Disk Size in MB
  • vdc - (Required) ORG VDC where disk needs to be created
  • description - (Optional) Disk Description
  • storage_profile - (Optional) Storage Profile for Disk
  • disk_id - (Optional) Disk ID

Example Usage


 
 resource "vcloud-director_org" "org1" {
 name = "ORG_NAME"
 full_name = "ORG_FULL_NAME"
 is_enabled = "true"
 force = "true"
 recursive = "true"
 }
 
 

Argument Reference


The following arguments are supported

  • name - (Required) The name of the organization
  • full_name - (Required) The fullname of the organization
  • is_enabled - (Required) true if enable the organization else false
  • force - (Required) "true" / "false"
  • recursive - (Required) "true" / "false"

Example Usage


 
 resource "vcloud-director_org_vdc" "ovdc1" {
 org_name = "ORG_NAME"
 vdc_name = "VDC_NAME"
 provider_vdc_name = "PVDC_NAME"
 description = "DESCRIPTION"
 allocation_model = "AllocationVApp"
 cpu_units = "MHz"
 cpu_allocated = "0"
 cpu_limit = "0"
 mem_units = "MB"
 mem_allocated = "0"
 mem_limit = "0"
 nic_quota = "0"
 network_quota = "0"
 vm_quota = "0"
 storage_profiles = "PF1,PF1"
 resource_guaranteed_memory = "None"
 resource_guaranteed_cpu = "None"
 vcpu_in_mhz = "None"
 is_thin_provision = "None"
 network_pool_name = "None"
 uses_fast_provisioning = "None"
 over_commit_allowed = "None"
 vm_discovery_enabled = "None"
 is_enabled = "true"
 }
 
 

Argument Reference


The following arguments are supported

  • org_name - (Required) The name of the new org
  • vdc_name - (Required) The name of the new org vdc
  • provider_vdc_name - (Required) The name of an existing provider vdc
  • description - (Required) The description of the new org vdc
  • allocation_model - (Required) The allocation model used by this vDC. One of AllocationVApp, AllocationPool or ReservationPool
  • cpu_units - (Required) The cpu units compute capacity allocated to this vDC. One of MHz or GHz
  • cpu_allocated - (Required) Capacity that is committed to be available
  • cpu_limit - (Required) Capacity limit relative to the value specified for Allocation
  • mem_units - (Required) The memory units compute capacity allocated to this vDC. One of MB or GB
  • mem_allocated - (Required) Memory capacity that is committed to be available
  • mem_limit - (Required) Memory capacity limit relative to the value specified for Allocation
  • nic_quota - (Required) Maximum number of virtual NICs allowed in this vDC. Defaults to 0, which specifies an unlimited number
  • network_quota - (Required) Maximum number of network objects that can be deployed in this vDC. Defaults to 0, which means no networks can be deployed
  • vm_quota - (Required) The maximum number of VMs that can be created in this vDC. Defaults to 0, which specifies an unlimited number
  • storage_profiles - (Optional) List of provider vDC storage profiles to add to this vDC. Each item is a dictionary that should include the following elements,
    • name - (string) name of the PVDC storage profile
    • enabled - (bool) True if the storage profile is enabled for this vDC else false
    • units - (string) Units used to define limit. One of MB or GB
    • limit - (int) Max number of units allocated for this storage profile
    • default - (bool) True if this is default storage profile for this vDC
  • resource_guaranteed_memory - (Required) Percentage of allocated CPU resources guaranteed to vApps deployed in this vDC. Value defaults to 1.0 if the element is empty
  • resource_guaranteed_cpu - (Required) Percentage of allocated memory resources guaranteed to vApps deployed in this vDC. Value defaults to 1.0 if the element is empty
  • vcpu_in_mhz - (Required) Specifies the clock frequency, in Megahertz, for any virtual CPU that is allocated to a VM
  • is_thin_provision - (Required) Boolean to request thin provisioning
  • network_pool_name - (Required) Reference to a network pool in the Provider vDC
  • uses_fast_provisioning - (Required) Boolean to request fast provisioning
  • over_commit_allowed - (Required) Set to false to disallow creation of the VDC if the AllocationModel is AllocationPool or ReservationPool and the ComputeCapacity you specified is greater than what the backing Provider VDC can supply. Defaults to true if empty or missing
  • vm_discovery_enabled - (Required) True if discovery of vCenter VMs is enabled for resource pools backing this vDC
  • is_enabled - (Required) True if this vDC is enabled for use by the organization users

Example Usage


 
 resource "vcloud-director_user" "source_user"{
 name = "pcp_pcp_google_4"
 password = "123456"
 role_name = "Organization Administrator"
 full_name = "USER_FULL_NAME"
 description = "USER_DESCRIPTION"
 email = "USER_EMAIL"
 telephone = "12345678"
 im = "i_m_val"
 alert_email = "ALERT_EMAIL"
 alert_email_prefix = "ALERT_EMAIL_PREFIX"
 stored_vm_quota = 0
 deployed_vm_quota = 0
 is_group_role = "false"
 is_default_cached = "false"
 is_external = "false"
 is_alert_enabled = "true"
 is_enabled = "true"
 }
 
 

Argument Reference


The following arguments are supported

  • name - (Required) The username of the user
  • password - (Required) The password of the user
  • role_name - (Required) The role of the user
  • full_name - (Required) The full name of the user
  • description - (Optional) The description for the User
  • email - (Optional) The email of the user
  • telephone - (Optional) The telephone of the user
  • im - (Optional) The im address of the user
  • alert_email - (Optional) The alert email address
  • alert_email_prefix - (Optional) The string to prepend to the alert message subject line
  • stored_vm_quota - (Optional) The quota of vApps that this user can store
  • deployed_vm_quota - (Optional) The quota of vApps that this user can deploy concurrently
  • is_group_role - (Optional) Indicates if the user has a group role
  • is_default_cached - (Optional) Indicates if user should be cached
  • is_external - (Optional) Indicates if user is imported from an external source
  • is_alert_enabled - (Optional) The alert email address
  • s_enabled - (Required) Enable user