2023-07-05 13:46:44 +00:00
|
|
|
data "openstack_compute_flavor_v2" "m1_small" {
|
|
|
|
name = "m1.small"
|
|
|
|
}
|
|
|
|
|
2023-07-05 12:47:14 +00:00
|
|
|
resource "openstack_compute_instance_v2" "test_server_01" {
|
|
|
|
name = "test_server_01"
|
2023-07-05 13:46:44 +00:00
|
|
|
flavor_id = data.openstack_compute_flavor_v2.m1_small.id
|
2023-07-05 12:47:14 +00:00
|
|
|
key_pair = openstack_compute_keypair_v2.arif-key.name
|
2023-07-05 15:56:19 +00:00
|
|
|
security_groups = [
|
|
|
|
"default",
|
|
|
|
openstack_compute_secgroup_v2.allow_ssh.name,
|
|
|
|
openstack_compute_secgroup_v2.allow_ping.name,
|
|
|
|
]
|
2023-07-05 12:47:14 +00:00
|
|
|
|
|
|
|
block_device {
|
2023-07-05 14:58:06 +00:00
|
|
|
uuid = openstack_images_image_v2.bionic-raw.id
|
2023-07-05 12:47:14 +00:00
|
|
|
source_type = "image"
|
|
|
|
volume_size = 10
|
|
|
|
boot_index = 0
|
|
|
|
destination_type = "volume"
|
|
|
|
delete_on_termination = true
|
|
|
|
}
|
|
|
|
|
|
|
|
network {
|
|
|
|
name = "private"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-05 15:56:19 +00:00
|
|
|
resource "openstack_networking_floatingip_v2" "fip" {
|
|
|
|
pool = "ext_net"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "openstack_compute_floatingip_associate_v2" "fip" {
|
|
|
|
floating_ip = openstack_networking_floatingip_v2.fip.address
|
|
|
|
instance_id = openstack_compute_instance_v2.test_server_01.id
|
|
|
|
}
|
|
|
|
|