This folder contains a set of Terraform configuration files (sometimes informally referred to as a "manifest") that serve as examples for how you can use this module to define multiple Openstack virtual machines.
This example follows the Standard Module Structure as defined by Hashicorp and uses the recommended filenames of:
main.tf
- primary entrypoint containing severalvirtual_machine
module definitionsvariables.tf
- defines thevirtual_machine
object used to configure the moduleterraform.tfvars
- defines the default values for thevirtual_machine
object used to configure the moduleoutputs.tf
- optional file that can be used to output useful information about the managed virtual machines.
To deploy multiple Openstack virtual machines:
- Copy this example directory to a new location
- Modify
terraform.tfvars
to contain the values common to all virtual machines you'd like to create.NOTE The
virtual_machine
configuration object requires all attributes to be defined. As such, you will need to use anull
value for attributes you do not want to set. - Modify
main.tf
to contain module definitions for each virtual machine you'd like to create.TIP By using the merge function you can override any value defined in the
terraform.tfvars
file for a specific virtual machine instance. - Run
terraform init
.This command initializes a working directory containing Terraform configuration files and ensures the working directory is up to date with changes in your configuration files should you run it multiple times.
- Run [
terraform plan
]https://developer.hashicorp.com/terraform/cli/commands/plan).This command creates an execution plan, which lets you preview the changes that Terraform plans to make to your infrastructure.
- Run
terraform apply
.This command executes the actions proposed in the
terraform plan
ssh
into one of the virtual machines to validate connectivity- Run
terraform destroy
.This command destroys all remote virtual machines managed by the Terraform configuration.