Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Terraform Openstack
Manage
Activity
Members
Labels
Plan
Issues
10
Issue boards
Milestones
Wiki
Code
Merge requests
6
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
rc
Terraform Openstack
Commits
f95edfaf
Commit
f95edfaf
authored
1 year ago
by
Ravi Tripathi
Browse files
Options
Downloads
Patches
Plain Diff
Use already existing networks to build terraform
parent
b4bc023f
No related branches found
Branches containing commit
No related tags found
3 merge requests
!6
Add CD feature to the repo
,
!5
Use already existing networks to build terraform
,
!1
wip: test-keypair without file
Pipeline
#8342
failed with stages
Stage: validate
Stage: build
Stage: cleanup
in 8 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+0
-2
0 additions, 2 deletions
.gitlab-ci.yml
main.tf
+5
-33
5 additions, 33 deletions
main.tf
with
5 additions
and
35 deletions
.gitlab-ci.yml
+
0
−
2
View file @
f95edfaf
...
...
@@ -46,8 +46,6 @@ tf-apply:
script
:
-
export BUILD_DATE=$(TZ=America/Chicago date +%Y%m%d%H%M%S)
-
export TF_VAR_internal_network="tf-clusternet-$BUILD_DATE"
-
export TF_VAR_external_network="tf-dmznet-$BUILD_DATE"
-
export TF_VAR_keypair_name="os-gen-keypair-$BUILD_DATE"
-
XDMOD_IMAGES=($(openstack image list --sort-column Name --sort-descending -f value -c Name -c ID | grep -P ' xdmod-\d{14}$' | awk '{print $2}'))
-
export TF_VAR_image_ohpc="${XDMOD_IMAGES[0]}"
# - export TF_VAR_image_ohpc="xdmod-20230629191611"
...
...
This diff is collapsed.
Click to expand it.
main.tf
+
5
−
33
View file @
f95edfaf
...
...
@@ -14,37 +14,6 @@ provider "openstack" {
}
}
# runs the external-network module
module
"dmz-network"
{
source
=
"./external-network"
# Default name var is in the module main file
name
=
var
.
external_network
admin_state_up
=
var
.
admin_state_up
enable_dhcp
=
var
.
enable_dhcp
public_network_name
=
var
.
public_network_name
}
# calls the outputs defined in the external-network module
output
"external_network_id"
{
value
=
module
.
dmz-network
.
id
}
output
"router_id"
{
value
=
module
.
dmz-network
.
router_id
}
# runs the internal-network module
module
"cluster-network"
{
source
=
"./internal-network"
# Default name var is in the module main file
name
=
var
.
internal_network
admin_state_up
=
var
.
admin_state_up
enable_dhcp
=
var
.
enable_dhcp
}
# calls the outputs defined in the internal-network module
output
"internal_network_id"
{
value
=
module
.
cluster-network
.
id
}
# runs the floating-ip module - uses public network name defined above
module
"floating-ip-address"
{
source
=
"./floating-ip"
...
...
@@ -72,6 +41,9 @@ output "keypair_name" {
value
=
module
.
import-keypair
.
keypair_name
}
data
"openstack_networking_network_v2"
"external_net"
{
name
=
var
.
external_network
}
data
"openstack_networking_network_v2"
"internal_net"
{
name
=
var
.
internal_network
}
# 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
module
"create-ohpc-instance"
{
...
...
@@ -81,8 +53,8 @@ module "create-ohpc-instance" {
image_ohpc
=
var
.
image_ohpc
flavor
=
var
.
flavor
key_pair
=
module
.
import-keypair
.
keypair_name
external_network
=
module
.
dmz-network
.
id
internal_network
=
module
.
cluster-network
.
id
external_network
=
data
.
external_net
.
id
internal_network
=
data
.
internal_net
.
id
internal_ip
=
var
.
ohpc_private_ip
floating_ip_ohpc
=
module
.
floating-ip-address
.
ohpc_address
ohpc_user
=
var
.
ohpc_user
...
...
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