-
Notifications
You must be signed in to change notification settings - Fork 4
/
openstack_example.tf
77 lines (62 loc) · 2.46 KB
/
openstack_example.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
module "openstack_app" {
source = "github.com/kzap/terraform-modules//providers/openstack/app-server"
# Custom Config
prefix = "${var.env}-app"
public_key = "${file("${var.public_key_file}")}"
key_file_path = "${var.private_key_file}"
servers = "${var.openstack_app_servers}"
user_login = "${var.openstack_app_user_login}"
image_id = "${var.openstack_app_image}"
flavor_id = "${var.openstack_app_flavor}"
# OpenStack config
username = "${var.openstack_username}"
tenant_name = "${var.openstack_tenant_name}"
password = "${var.openstack_password}"
region = "${var.openstack_region}"
auth_url = "${var.openstack_auth_url}"
pub_net_id = "${var.openstack_pub_net_id}"
}
module "centos_app_provisioner" {
source = "github.com/kzap/terraform-modules//provisioners/bash/centos-7/app-server"
# Server Info
servers = "${var.openstack_app_servers}"
server_ips = ["${module.openstack_app.nodes_floating_ips}"]
# Login Information
user_login = "${var.openstack_app_user_login}"
public_key = "${file("${var.public_key_file}")}"
key_file_path = "${var.private_key_file}"
}
output "openstack_app_ips" {
value = ["${module.openstack_app.nodes_floating_ips}"]
}
module "openstack_db" {
source = "github.com/kzap/terraform-modules//providers/openstack/app-server"
# Custom Config
prefix = "${var.env}-db"
public_key = "${file("${var.public_key_file}")}"
key_file_path = "${var.private_key_file}"
servers = "${var.openstack_db_servers}"
user_login = "${var.openstack_db_user_login}"
image_id = "${var.openstack_db_image}"
flavor_id = "${var.openstack_db_flavor}"
# OpenStack config
username = "${var.openstack_username}"
tenant_name = "${var.openstack_tenant_name}"
password = "${var.openstack_password}"
region = "${var.openstack_region}"
auth_url = "${var.openstack_auth_url}"
pub_net_id = "${var.openstack_pub_net_id}"
}
module "centos_db_provisioner" {
source = "github.com/kzap/terraform-modules//provisioners/bash/centos-7/db-server"
# Server Info
servers = "${var.openstack_db_servers}"
server_ips = ["${module.openstack_db.nodes_floating_ips}"]
# Login Information
user_login = "${var.openstack_db_user_login}"
public_key = "${file("${var.public_key_file}")}"
key_file_path = "${var.private_key_file}"
}
output "openstack_db_ips" {
value = ["${module.openstack_db.nodes_floating_ips}"]
}