Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Terraform Openstack
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Krish Moodbidri
Terraform Openstack
Commits
4e2c5d3e
Commit
4e2c5d3e
authored
5 years ago
by
Ryan Randles Jones
Browse files
Options
Downloads
Patches
Plain Diff
added documentation
parent
a3ceacd2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.tf
+22
-6
22 additions, 6 deletions
main.tf
with
22 additions
and
6 deletions
main.tf
+
22
−
6
View file @
4e2c5d3e
# These are the defined variables used in all the modules. They are referenced in the modules, and defined here.
# This is where you would change any variable values.
# variables for networks and router
# variables for networks and router
variable
"admin_state_up"
{
default
=
true
}
variable
"admin_state_up"
{
default
=
true
}
variable
"enable_dhcp"
{
default
=
true
}
variable
"enable_dhcp"
{
default
=
true
}
...
@@ -28,7 +31,7 @@ variable "image_compute" {default = "CentOS-7-x86_64-GenericCloud-1905"}
...
@@ -28,7 +31,7 @@ variable "image_compute" {default = "CentOS-7-x86_64-GenericCloud-1905"}
variable
"compute_node_count"
{
default
=
2
}
variable
"compute_node_count"
{
default
=
2
}
# runs the external-network module
module
"dmz-network"
{
module
"dmz-network"
{
source
=
"./external-network"
source
=
"./external-network"
# Default name var is in the module main file
# Default name var is in the module main file
...
@@ -36,7 +39,7 @@ module "dmz-network" {
...
@@ -36,7 +39,7 @@ module "dmz-network" {
enable_dhcp
=
var
.
enable_dhcp
enable_dhcp
=
var
.
enable_dhcp
public_network_name
=
var
.
public_network_name
public_network_name
=
var
.
public_network_name
}
}
# calls the outputs defined in the external-network module
output
"external_network_id"
{
output
"external_network_id"
{
value
=
"
${module
.
dmz-network
.
external_network_id
}
"
value
=
"
${module
.
dmz-network
.
external_network_id
}
"
}
}
...
@@ -45,22 +48,25 @@ output "router_id" {
...
@@ -45,22 +48,25 @@ output "router_id" {
value
=
"
${module
.
dmz-network
.
router_id
}
"
value
=
"
${module
.
dmz-network
.
router_id
}
"
}
}
# runs the internal-network module
module
"cluster-network"
{
module
"cluster-network"
{
source
=
"./internal-network"
source
=
"./internal-network"
# Default name var is in the module main file
# Default name var is in the module main file
admin_state_up
=
var
.
admin_state_up
admin_state_up
=
var
.
admin_state_up
enable_dhcp
=
var
.
enable_dhcp
enable_dhcp
=
var
.
enable_dhcp
}
}
# calls the outputs defined in the internal-network module
output
"internal_network_id"
{
output
"internal_network_id"
{
value
=
"
${module
.
cluster-network
.
internal_network_id
}
"
value
=
"
${module
.
cluster-network
.
internal_network_id
}
"
}
}
# runs the floating-ip module - uses public network name defined above
module
"floating-ip"
{
module
"floating-ip"
{
source
=
"./floating-ip"
source
=
"./floating-ip"
public_network_name
=
var
.
public_network_name
public_network_name
=
var
.
public_network_name
}
}
# calls the outputs defined in the floating-ip module
output
"floating_ip_ohpc"
{
output
"floating_ip_ohpc"
{
value
=
"
${module
.
floating-ip
.
ohpc_address
}
"
value
=
"
${module
.
floating-ip
.
ohpc_address
}
"
}
}
...
@@ -69,19 +75,23 @@ output "floating_ip_ood" {
...
@@ -69,19 +75,23 @@ output "floating_ip_ood" {
value
=
"
${module
.
floating-ip
.
ood_address
}
"
value
=
"
${module
.
floating-ip
.
ood_address
}
"
}
}
# runs the key-pair module - imports local public key into openstack and give it the name defined above in the variables
module
"keypair"
{
module
"keypair"
{
source
=
"./key-pair"
source
=
"./key-pair"
keypair_name
=
var
.
keypair_name
keypair_name
=
var
.
keypair_name
ssh_public_key
=
var
.
ssh_public_key
ssh_public_key
=
var
.
ssh_public_key
}
}
# calls the outputs defined in the key-pair module
output
"keypair_name"
{
output
"keypair_name"
{
value
=
"
${module
.
keypair
.
keypair_name
}
"
value
=
"
${module
.
keypair
.
keypair_name
}
"
}
}
# runs the ohpc-instance module - creates ohpc instance using variables defined above
# calls functions from dmz-network, floating-ip, and keypair modules to get values created there for use
module
"ohpc-instance"
{
module
"ohpc-instance"
{
external_subnet_id
=
"
${module
.
dmz-network
.
external_subnet_id
}
"
source
=
"./ohpc-instance"
source
=
"./ohpc-instance"
external_subnet_id
=
"
${module
.
dmz-network
.
external_subnet_id
}
"
floating_ip_ohpc
=
"
${module
.
floating-ip
.
ohpc_address
}
"
floating_ip_ohpc
=
"
${module
.
floating-ip
.
ohpc_address
}
"
ohpc_instance_name
=
var
.
ohpc_instance_name
ohpc_instance_name
=
var
.
ohpc_instance_name
image_ohpc
=
var
.
image_ohpc
image_ohpc
=
var
.
image_ohpc
...
@@ -93,10 +103,12 @@ module "ohpc-instance" {
...
@@ -93,10 +103,12 @@ module "ohpc-instance" {
ohpc_user
=
var
.
ohpc_user
ohpc_user
=
var
.
ohpc_user
ssh_private_key
=
var
.
ssh_private_key
ssh_private_key
=
var
.
ssh_private_key
}
}
# runs the ood-instance module - creates ood instance using variables defined above
# calls functions from cluster-network, floating-ip, and keypair modules to get values created there for use
module
"ood-instance"
{
module
"ood-instance"
{
internal_subnet_id
=
"
${module
.
cluster-network
.
internal_subnet_id
}
"
source
=
"./ood-instance"
source
=
"./ood-instance"
internal_subnet_id
=
"
${module
.
cluster-network
.
internal_subnet_id
}
"
floating_ip_ood
=
"
${module
.
floating-ip
.
ood_address
}
"
floating_ip_ood
=
"
${module
.
floating-ip
.
ood_address
}
"
flavor
=
var
.
flavor
flavor
=
var
.
flavor
host_prefix
=
var
.
host_prefix
host_prefix
=
var
.
host_prefix
...
@@ -109,6 +121,8 @@ module "ood-instance" {
...
@@ -109,6 +121,8 @@ module "ood-instance" {
ssh_private_key
=
var
.
ssh_private_key
ssh_private_key
=
var
.
ssh_private_key
}
}
# runs the nodes module - creates nodes using variables defined above
# calls functions from cluster-network and keypair modules to get values created there for use
module
"nodes"
{
module
"nodes"
{
source
=
"./nodes"
source
=
"./nodes"
internal_subnet_id
=
"
${module
.
cluster-network
.
internal_subnet_id
}
"
internal_subnet_id
=
"
${module
.
cluster-network
.
internal_subnet_id
}
"
...
@@ -119,10 +133,12 @@ module "nodes" {
...
@@ -119,10 +133,12 @@ module "nodes" {
compute_node_count
=
var
.
compute_node_count
compute_node_count
=
var
.
compute_node_count
}
}
# calls the outputs defined in the ohpc-instance module
output
"ohpc-ssh_host"
{
output
"ohpc-ssh_host"
{
value
=
"
${module
.
ohpc-instance
.
ssh_host
}
"
value
=
"
${module
.
ohpc-instance
.
ssh_host
}
"
}
}
# calls the outputs defined in the ood-instance module
output
"ood-ssh_host"
{
output
"ood-ssh_host"
{
value
=
"
${module
.
ood-instance
.
ssh_host
}
"
value
=
"
${module
.
ood-instance
.
ssh_host
}
"
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment