Skip to content

Instantly share code, notes, and snippets.

@c4milo
Created August 6, 2014 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c4milo/4af180581164ee42eb7a to your computer and use it in GitHub Desktop.
Save c4milo/4af180581164ee42eb7a to your computer and use it in GitHub Desktop.
variable "key_path" {
default = "/Users/camilo/.ssh/id_rsa"
}
variable "password" {
default: ""
}
provider "vix" {
product = "fusion"
verify_ssl = false
}
resource "vix_vswitch" "vmnet10" {
name = "vmnet10"
nat = true
dhcp = true
range = "192.168.1.0/24"
host_access = true
}
resource "vix_vnic" "bridged" {
type = "bridged"
driver = "vmxnet3"
}
resource "vix_vnic" "custom" {
type = "custom"
mac_address = "00:00:00:00:00"
mac_address_type = "static"
vswitch = ${vix_vswitch.vmnet10.name}
start_connected = true
driver = "vmxnet3"
wake_on_lan = false
}
resource "vix_sharedfolder" "myfolder" {
name = "Dev1"
enable = false
guest_path = "/home/camilo/dev"
host_path = "/Users/camilo/Development"
readonly = false
}
resource "vix_vm" "coreos" {
name = "core01"
description = "Terraform VMWARE VIX test"
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 = "1g"
networks = [
"${vix_vnic.custom.type}",
"${vix_vnic.bridged.type}",
]
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
connection {
# The default username for our Box image
user = "c4milo"
# The path to your keyfile
key_file = "${var.key_path}"
}
provisioner "remote-exec" {
inline = [
"sudo apt-get -y update",
"sudo apt-get -y install blah",
"sudo service blah start",
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment