-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathex1.tf
79 lines (63 loc) · 1.89 KB
/
ex1.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
variable myimage {
default = "5f8794fe-c140-4bda-9280-e8f6ca3774ba"
}
variable myflavor {
default = "0"
}
resource "openstack_compute_instance_v2" "test" {
name = "test"
image_id = "${var.myimage}"
flavor_id = "${var.myflavor}"
security_groups = ["default"]
network {
uuid = "e38b7dbd-758d-40eb-9069-39c869f470a9"
}
}
resource "openstack_networking_floatingip_v2" "fip_1" {
pool = "public1"
}
resource "openstack_compute_floatingip_associate_v2" "fip_1" {
floating_ip = "${openstack_networking_floatingip_v2.fip_1.address}"
instance_id = "${openstack_compute_instance_v2.test.id}"
}
output "vm-name" {
value = "${openstack_compute_instance_v2.test.name}"
}
output "vm-id" {
value = "${openstack_compute_instance_v2.test.id}"
}
output "vm-ip" {
value = "${openstack_compute_instance_v2.test.network.0.fixed_ip_v4}"
}
root@openwhisk:/home/ubuntu/ex1# cat ex1.tf
variable myimage {
default = "5f8794fe-c140-4bda-9280-e8f6ca3774ba"
}
variable myflavor {
default = "0"
}
resource "openstack_compute_instance_v2" "test" {
name = "test"
image_id = "${var.myimage}"
flavor_id = "${var.myflavor}"
security_groups = ["default"]
network {
uuid = "e38b7dbd-758d-40eb-9069-39c869f470a9"
}
}
resource "openstack_networking_floatingip_v2" "fip_1" {
pool = "public1"
}
resource "openstack_compute_floatingip_associate_v2" "fip_1" {
floating_ip = "${openstack_networking_floatingip_v2.fip_1.address}"
instance_id = "${openstack_compute_instance_v2.test.id}"
}
output "vm-name" {
value = "${openstack_compute_instance_v2.test.name}"
}
output "vm-id" {
value = "${openstack_compute_instance_v2.test.id}"
}
output "vm-ip" {
value = "${openstack_compute_instance_v2.test.network.0.fixed_ip_v4}"
}