2020-07-21 15:06:39 +08:00
|
|
|
resource "openstack_compute_secgroup_v2" "test-sg1" {
|
|
|
|
name = "test-sg1"
|
|
|
|
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"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-10 17:15:42 +08:00
|
|
|
resource "openstack_compute_instance_v2" "tfvm1" {
|
|
|
|
name = "tfvm1"
|
|
|
|
flavor_id = "b8159937-a5f9-46fb-97eb-2d59b67cfedd"
|
|
|
|
key_pair = "opc-key"
|
2020-07-21 15:06:39 +08:00
|
|
|
security_groups = ["${openstack_compute_secgroup_v2.test-sg1.name}"]
|
2020-07-10 17:15:42 +08:00
|
|
|
|
2020-07-10 17:28:14 +08:00
|
|
|
block_device {
|
|
|
|
uuid = "871c021d-baef-4010-ba8e-2a900a48f41c"
|
|
|
|
source_type = "image"
|
|
|
|
volume_size = 10
|
|
|
|
boot_index = 0
|
|
|
|
destination_type = "volume"
|
|
|
|
delete_on_termination = true
|
|
|
|
}
|
|
|
|
|
2020-07-10 17:15:42 +08:00
|
|
|
network {
|
|
|
|
name = "shared"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|