GithubHelp home page GithubHelp logo

imaderaya / terraform-vcd-vapp-vm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from noris-network/terraform-vcd-vapp-vm

0.0 0.0 0.0 21 KB

Terraform module which manages vApp VM ressources on VMWare Cloud Director.

HCL 100.00%

terraform-vcd-vapp-vm's Introduction

terraform-vcd-vapp-vm

Terraform module which manages vApp VM ressources on VMWare Cloud Director.

It can be used to create, modify, and delete VMs within a vApp. It can also attach internal disks to a VM.

Requirements

Name Version
terraform >= 1.1.9
vcd >= 3.9.0

Providers

Name Version
vcd 3.11.0

Modules

No modules.

Resources

Name Type
vcd_vapp_vm.vapp_vm resource
vcd_vm_internal_disk.vm_internal_disk resource
vcd_catalog.catalog data source
vcd_catalog_vapp_template.catalog_vapp_template data source
vcd_vapp.vapp data source

Inputs

Name Description Type Default Required
cpus The number of virtual CPUs to allocate to the VM. Socket count is a result of: virtual logical processors/cores per socket. If cpu_hot_add_enabled is true, then cpus will be increased without VM power off. number n/a yes
memory The amount of RAM (in MB) to allocate to the VM. number n/a yes
name A name for the vApp VM. string n/a yes
storage_profile_name Name of Storage Profile. string n/a yes
vapp_name Name of vApp to put this VM into. string n/a yes
vdc_org_name The name of the organization to use. string n/a yes
accept_all_eulas Automatically accept EULA if OVA has it. bool true no
boot_image_id Media URN to mount as boot image. string null no
catalog_name Catalog where the vApp template is found. string null no
catalog_org_name Name of Org where the Catalog is found if it is not in a catalog created by the same Org. string null no
computer_name Computer name to assign to this virtual machine. string null no
cpu_cores The number of cores per socket. number null no
cpu_hot_add_enabled True if the virtual machine supports addition of virtual CPUs while powered on. bool false no
cpu_limit The limit (in MHz) for how much of CPU can be consumed on the underlying virtualization infrastructure. -1 value for unlimited. number null no
cpu_priority Pre-determined relative priorities according to which the non-reserved portion of this resource is made available to the virtualized workload. string null no
cpu_reservation The amount of MHz reservation on the underlying virtualization infrastructure. number null no
cpu_shares Custom priority for the resource in MHz. This is a read-only, unless the cpu_priority is 'CUSTOM'. number null no
customization A block to define for guest customization options. any null no
description The VM description. Note: for VM from Template description is read only. Currently, this field has the description of the OVA used to create the VM. string null no
disks List of disks per virtual machine.
list(object({
name = string
bus_number = number
unit_number = number
}))
[] no
expose_hardware_virtualization Boolean for exposing full CPU virtualization to the guest operating system so that applications that require hardware virtualization can run on virtual machines without binary translation or paravirtualization. Useful for hypervisor nesting provided underlying hardware supports it. bool false no
guest_properties Key value map of guest properties. map(any) null no
hardware_version Virtual Hardware Version (e.g.vmx-14, vmx-13, vmx-12, etc.). Required when creating empty VM. string null no
internal_disks A list of internal disks to add to this machine.
list(object({
size_in_mb = number
bus_type = optional(string)
bus_number = number
unit_number = number
storage_profile_name = optional(string)
}))
[] no
memory_hot_add_enabled True if the virtual machine supports addition of memory while powered on. bool false no
memory_limit The limit (in MB) for how much of memory can be consumed on the underlying virtualization infrastructure. -1 value for unlimited. number null no
memory_priority Pre-determined relative priorities according to which the non-reserved portion of this resource is made available to the virtualized workload. string null no
memory_reservation The amount of RAM (in MB) reservation on the underlying virtualization infrastructure. number null no
memory_shares Custom priority for the resource in MB. This is a read-only, unless the memory_priority is 'CUSTOM'. number null no
metadata_entry A set of metadata entries to assign. list(map(string)) [] no
network A block to define network interfaces. any [] no
network_dhcp_wait_seconds Number of seconds to try and wait for DHCP IP. number null no
os_type Operating System type. Possible values can be found in Os Types. Required when creating empty VM. string null no
override_template_disks A list of disks to override in the vApp template.
list(object({
bus_type = string
size_in_mb = number
bus_number = number
unit_number = number
iops = optional(number)
storage_profile = optional(string)
}))
[] no
placement_policy_id VM placement policy ID. To be used, it needs to be assigned to Org VDC using vcd_org_vdc.vm_placement_policy_ids (and optionally vcd_org_vdc.default_compute_policy_id to make it default). In this case, if the placement policy is not set, it will pick the VDC default on creation. It must be set explicitly if one wants to update it to another policy (the VM requires at least one Compute Policy), and needs to be set to '' to be removed. string null no
power_on A boolean value stating if this VM should be powered on. bool true no
prevent_update_power_off True if the virtual machine supports addition of virtual CPUs while powered on. bool false no
security_tags Set of security tags to be managed by the vcd_vapp_vm resource. set(string) null no
sizing_policy_id (vCD 10.0+) VM sizing policy ID. To be used, it needs to be assigned to Org VDC using vcd_org_vdc.vm_sizing_policy_ids (and vcd_org_vdc.default_compute_policy_id to make it default). In this case, if the sizing policy is not set, it will pick the VDC default on creation. It must be set explicitly if one wants to update it to another policy (the VM requires at least one Compute Policy), and needs to be set to '' to be removed. string null no
vapp_template_name vApp template for this maschine. string null no
vdc_name The name of VDC to use. string null no
vm_name_in_template The name of the VM in vApp Template to use. For cases when vApp template has more than one VM. string null no

Outputs

Name Description
id The ID of the vApp VM.
ip The IP's of the vApp VM.

Examples

module "vcd_vapp_vm" {
  source               = "git::https://github.com/noris-network/terraform-vcd-vapp-vm?ref=1.0.0"
  name                 = "web01.example.net"
  vdc_org_name         = "myORG"
  vdc_name             = "myDC01"
  vapp_name            = "webserver"
  cpus                 = 2
  catalog_name         = "myCatalog"
  vapp_template_name   = "debian12"
  memory               = (1024*4)
  storage_profile_name = "myDatastorePolicy"
  internal_disks       = [
    {
      size_in_mb  = (1024 * 16)
      bus_type    = "sas"
      bus_number  = 0
      unit_number = 1
    }
]
  network = {
    "TEST-NET" = {
      ip_allocation_mode = "MANUAL"
      ip                 = "192.168.0.10"
      is_primary         = true
    },
    "TEST-NET2" = {
      ip_allocation_mode = "POOL"
    }
  }
  guest_properties = {
    "user-data" = base64encode(templatefile("./templates/cloudinit.yaml", {
      hostname     = "web01.example.net"
      eth0_ip      = "192.168.0.10",
      eth0_netmask = "24"
      eth0_gateway = "192.168.0.1"
    }))
  }
  customization = { enabled = true }
}

Cloud Init Template

#cloud-config

hostname: ${hostname}
users:
  - name: testuser
    ssh-authorized-keys:
    - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEc7+easbd9qfpyP1qaAvuFVMGqiKmAulEHS/VDEK3LFrRYLC [email protected]
    sudo: ['ALL=(ALL) NOPASSWD:ALL']
    groups: sudo
    shell: /bin/bash
    lock_passwd: false
network:
  version: 2
  ethernets:
    eth0:
      addresses:
        - ${eth0_ip}/${eth0_netmask}
      gateway4: ${eth0_gateway}
      nameservers:
        search: []
        addresses: [8.8.8.8]

terraform-vcd-vapp-vm's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.