resource "random_integer" "suffix" { min = 1000 max = 9999 } resource "openstack_compute_secgroup_v2" "test-sg1" { name = "test-sg-${random_integer.suffix.result}" description = "Allow all" rule { from_port = -1 to_port = -1 ip_protocol = "icmp" cidr = "0.0.0.0/0" } rule { from_port = 1 to_port = 65535 ip_protocol = "tcp" cidr = "0.0.0.0/0" } rule { from_port = 1 to_port = 65535 ip_protocol = "udp" cidr = "0.0.0.0/0" } } resource "openstack_compute_flavor_v2" "flavor-small" { name = "flavor-1.1.10" ram = "1024" vcpus = "1" disk = "10" } resource "openstack_compute_instance_v2" "tfvm1" { name = "tfvm-${random_integer.suffix.result}" flavor_id = openstack_compute_flavor_v2.flavor-small.id key_pair = "opc-key" security_groups = ["${openstack_compute_secgroup_v2.test-sg1.name}"] block_device { uuid = "871c021d-baef-4010-ba8e-2a900a48f41c" source_type = "image" volume_size = 10 boot_index = 0 destination_type = "volume" delete_on_termination = true } network { name = "shared" } tags = ["created-using-terraform"] }