Skip to content

Instantly share code, notes, and snippets.

@vmorris
Created May 31, 2016 15:15
Show Gist options
  • Save vmorris/39a38f8b76ea569cb51f68f781de2c43 to your computer and use it in GitHub Desktop.
Save vmorris/39a38f8b76ea569cb51f68f781de2c43 to your computer and use it in GitHub Desktop.
provider "openstack" {
user_name = "${var.user_name}"
tenant_name = "${var.tenant_name}"
password = "${var.password}"
auth_url = "${var.auth_url}"
}
resource "openstack_compute_instance_v2" "vm1" {
name = "${var.name}"
region = "${var.region}"
flavor_name = "${var.flavor_name}"
key_pair = "${var.key_pair}"
security_groups = [ "${var.security_group}" ]
floating_ip = "${openstack_compute_floatingip_v2.floating_ip_vm1.address}"
network {
name = "${var.tenant_network}"
}
block_device {
uuid = "${var.image_id}"
source_type = "image"
destination_type = "volume"
boot_index = 0
volume_size = 10
delete_on_termination = true
}
provisioner "remote-exec" {
script = "../bootstrap_chef.sh"
connection {
user = "${var.ssh_user_name}"
key_file = "${var.ssh_key_file}"
}
}
}
resource "openstack_compute_floatingip_v2" "floating_ip_vm1" {
region = "${var.region}"
pool = "${var.floating_pool}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment