Skip to content

Instantly share code, notes, and snippets.

@trodemaster
Created July 26, 2017 04:03
Show Gist options
  • Save trodemaster/ccae57225027eff52f8bcc809cfe59b5 to your computer and use it in GitHub Desktop.
Save trodemaster/ccae57225027eff52f8bcc809cfe59b5 to your computer and use it in GitHub Desktop.
# openstack_images_image_v2
data "openstack_images_image_v2" "ubuntu" {
name = "Ubuntu 16.04"
most_recent = true
}
# Boot From Volume
resource "openstack_compute_instance_v2" "boot-from-volume" {
name = "boot-from-volume"
flavor_id = "3"
key_pair = "my_key_pair_name"
security_groups = ["default"]
block_device {
uuid = ${data.openstack_images_image_v2.ubuntu.id}"
source_type = "image"
volume_size = 5
boot_index = 0
destination_type = "volume"
delete_on_termination = true
}
network {
name = "my_network"
}
}
# Every time I run this terraform forces a rebuild because the block device UUID shows as changed
# block_device.0.uuid: "f881fcaf-6540-4123-9792-00262769805a" => "${data.openstack_images_image_v2.centos6.id}" (forces new resource)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment