Giter Club home page Giter Club logo

terraform-provider-vix's Introduction

VMware VIX provider for Terraform

Gitter Build Status

Allows you to define infrastructure for VMware Fusion, Workstation, Server and Player.

Mailing list

Google groups: https://groups.google.com/group/terraform-provider-vix

Requirements

  • VMware Fusion or Workstation installed
  • Govix: The library used to interface with VMware
  • Godep: Dependency manager
  • Terraform

The exact list of dependencies can be found in the Godeps file. To install dependencies run: godep get

Development workflow

Make sure you exported DYLD_LIBRARY_PATH or LD_LIBRARY_PATH with a path pointing to vendor/libvix

  1. Make changes in your local fork of terraform-provider-vix
  2. Test your changes running TF_LOG=1 terraform plan or TF_LOG=1 terraform apply inside a directory that contains *.tf files declaring VIX resources.

Provider configurations

Minimal configuration

resource "vix_vm" "core02" {
	name = "core02"
	gui = true
	image {
        url = "https://github.com/c4milo/dobby-boxes/releases/download/stable/coreos-stable-vmware.box"
        checksum = "545fec52ef3f35eee6e906fae8665abbad62d2007c7655ffa2ff4133ea3038b8"
        checksum_type = "sha256"
    }
}

A more advanced configuration

variable "password" {
     default: ""
}

provider "vix" {
    # valid options are: "fusion", "workstation", "serverv1", "serverv2", "player"
    # and "workstation_shared"
    product = "fusion"
    verify_ssl = false

    # clone_type can be "full" or "linked". Advantages of one over the other are described here:
    # https://www.vmware.com/support/ws5/doc/ws_clone_typeofclone.html
    clone_type = "linked"
}

resource "vix_vswitch" "vmnet10" {
    name = "vmnet10"
    nat = true
    dhcp = true
    range = "192.168.1.0/24"
    host_access = true
}

resource "vix_vm" "core01" {
    name = "core01"
    description = "Terraform VMWARE VIX test"

    # The provider will download, verify, decompress and untar the image. 
    # Ideally you will provide images that have VMware Tools installed already,
    # otherwise the provider will be considerably limited for what it can do.
    image {
        url = "https://github.com/c4milo/dobby-boxes/releases/download/stable/coreos-stable-vmware.box"
        checksum = "545fec52ef3f35eee6e906fae8665abbad62d2007c7655ffa2ff4133ea3038b8"
        checksum_type = "sha256"

        # If image is encrypted we need to provide a password
        password = "${var.password}"
    }

    cpus = 1
    # Memory sizes must be provided using IEC sizes such as: kib, ki, mib, mi, gib or gi.
    memory = "1.0gib"
    count = 1
    upgrade_vhardware = false
    tools_init_timeout = 30s

    # Be aware that GUI does not work if VM is encrypted
    gui = true

    # Whether to enable or disable all shared folders for this VM
    sharedfolders = true

    # Advanced configuration
    network_adapter {
        # type can be either "custom", "nat", "bridged" or "hostonly"
	    type = "custom"
	    mac_address = "00:50:56:aa:bb:cc"

	    # mac address type can be "static", "generated" or "vpx"
	    mac_address_type = "static"

	    # vswitch is only required when network type is "custom"
	    vswitch = ${vix_vswitch.vmnet10.name}
	    start_connected = true
	    driver = "vmxnet3"
	    wake_on_lan = false
    }

    # Minimal required
    network_adapter {
	    type = "bridged"
    }
    
    network_adapter {
        type = "nat"
        mac_address = "00:50:56:aa:bb:cc"
        mac_address_type = "static"
    }

    network_adapter {
        type = "hostonly"
    }

    shared_folder {
        enable = false
        name = "Dev1"
        guest_path = "/home/camilo/dev"
        host_path = "/Users/camilo/Development"
        readonly = false
    }
}

Known issues

  • When launching multiple VM resources, make sure all of them have the same GUI setting, otherwise a race condition will kick in and terraform apply will fail. This issue is being tracked here hooklift#10

  • Terraform count attribute does not work with vix_vm resources as Terraform does not provide a way to get the resource index, causing the provider to fail. This issue is being tracked here hashicorp/terraform#141

terraform-provider-vix's People

Contributors

c4milo avatar doertedev-instana avatar gitter-badger avatar

Watchers

 avatar  avatar

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.