Skip to content
Snippets Groups Projects
Commit 1bd0fe8d authored by Ravi Tripathi's avatar Ravi Tripathi
Browse files

Merge branch 'feat-attach-vol' into 'master'

Feat attach vol

See merge request rc/terraform-openstack!8
parents b74ba02c 6176393e
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ variables:
TF_ROOT: ${CI_PROJECT_DIR}/
TF_VAR_external_network: "xdmod-packer-dmznet"
TF_VAR_flavor: "m1.medium"
TF_VAR_data_volume: "xdmod-mysql-db-migration"
GIT_SUBMODULE_STRATEGY: "recursive"
GIT_SUBMODULE_UPDATE_FLAGS: "--force"
......
......@@ -55,6 +55,7 @@ output "keypair_name" {
}
data "openstack_networking_network_v2" "external_net" {name = var.external_network}
data "openstack_blockstorage_volume_v2" "disk" {name = var.data_volume}
# runs the ohpc-instance module - creates ohpc instance using variables defined above
# calls functions from dmz-network, import-keypair, and floating-ip-address modules to get values created there for use
......@@ -70,6 +71,7 @@ module "create-ohpc-instance" {
floating_ip_ohpc = module.floating-ip-address.ohpc_address
ohpc_user = var.ohpc_user
ssh_private_key = var.ssh_private_key
vol_id = data.openstack_blockstorage_volume_v2.disk.id
}
# runs the ood-instance module - creates ood instance using variables defined above
......
......@@ -26,7 +26,7 @@ variable "floating_ip_ohpc" {type = string}
variable "ohpc_user" {}
variable "ssh_private_key" {}
variable "vol_id" {}
# creates details for the OHPC instance
resource "openstack_compute_instance_v2" "ohpc" {
......@@ -61,6 +61,12 @@ resource "openstack_compute_floatingip_associate_v2" "ohpc" {
instance_id = openstack_compute_instance_v2.ohpc.id
}
# Attach a volume
resource "openstack_compute_volume_attach_v2" "volume_attach" {
instance_id = openstack_compute_instance_v2.ohpc.id
volume_id = var.vol_id
}
output "id" {
value = openstack_compute_instance_v2.ohpc.id
}
......
......@@ -25,7 +25,7 @@ variable "external_network" {default = "dmznet"}
variable "ohpc_user" {default = "centos"}
variable "ood_user" {default = "centos"}
variable "ssh_private_key" {default = "~/.ssh/id_rsa"}
variable "data_volume" {default = ""}
# variables for node creation module
variable "image_compute" {default = "compute-v1"}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment