Skip to content
Snippets Groups Projects
Forked from rc / Terraform Openstack
18 commits behind the upstream repository.
Eesaan Atluri's avatar
Eesaan Atluri authored
Workaround the issue of having duplicate names for snapshot failing the TF deploy pipelines

See merge request !36
f591667d

Terraform Openstack

This will create:

  • dmznet and dmzsubnet

  • borderrouter that connects dmznet to bright-external-flat-externalnet

  • a floating ip address, and an instance coming off of dmznet

  • clusternet off of dmznet instance

  • clustersubnet will connect instance to ood through ohpc and download software

Make a new directory for Terraform:

  • $mkdir terraform-first-instance

Install Terraform:

Install terraform from your systems package manager or directly from HashiCorp. Terraform is a single binary so it's easy to maintain the latest release version from the distributed zip files.

On a Mac (using brew package manager):

  • $brew install terraform

On a linux box (using the upstream package installed to personal ~/bin already in the $PATH):

wget https://releases.hashicorp.com/terraform/0.12.3/terraform_0.12.3_linux_amd64.zip
unzip terraform_0.12.3_linux_amd64.zip -d ~/bin

Unzip the file and make a path to your new directory using:

  • $export TERRAFORM_DIR="$(pwd)/terraform-first-instance

  • $cp $HOME/Downloads/terraform_0.6.16_linux_amd64/terraform $TERRAFORM_DIR

Create a new application credintial in Openstack:

  • In Openstack, go to Identity -> Application Credentials

  • Click "Create Application Credential"

  • Name the credential, add a description, and check the box making it unrestricted (Leave the rest blank. It is important not to add an expiration date.)

  • Download the credentials as an RC file.

  • Save credentials RC file in your terraform-first-instance directory.

Clone this repo into your terraform-first-instance directory using:

  • $git clone --recursive https://gitlab.rc.uab.edu/rrand11/terraform-openstack.git

Source the RC file and initialize terraform:

  • $source CREDENTIALRCFILENAME

  • $cd terraform-openstack

  • $terraform init

Write Terraform Plan to your terraform-first-instance directory and run that plan:

  • $terraform plan -out $HOME/terraform-first-instance/terraform-plan.tf

(Note) $terraform plan -out writes the plan to a file and then terraform apply runs that plan.

  • $terraform apply "$HOME/terraform-first-instance/terraform-plan.tf"

There's a target parameter that will let you specify just one module as defined in the root main file. Run it via plan like so:

  • $terraform plan -out $HOME/terraform-first-instance/name-of-plan.tf -target=module.name-of-module-to-run

(Note) You can also target multiple modules.

  • $terraform plan -out $HOME/terraform-first-instance/name-of-plan.tf -target=module.name-of-module -target=module.name-of-other-module

Destroy Terraform Instance:

  • $terraform destroy