This provides a template for attaching, formating, and mounting a Block Storage Volume to an Instance.
Download and install Terraform:
wget -P /tmp/ https://releases.hashicorp.com/terraform/0.12.9/terraform_0.12.9_linux_amd64.zip
unzip /tmp/terraform_0.12.9_linux_amd64.zip
sudo mv terraform /usr/local/bin/
terraform --versionLog in to the OpenStack dashboard, choose the project for which you want to download the OpenStack RC file, and run the following commands:
source ~/Downloads/PROJECT-openrc.sh
Please enter your OpenStack Password for project PROJECT as user username:terraform initterraform plan
# or with specific variables
terraform plan -var 'pool=gateway' \
-var 'flavor=m02.c02.d20' \
-var 'volume_size=3' \
-var 'network_name=my-network' \
-var 'ssh_key_file=./id_rsa_os'terraform apply -auto-approve
# or with specific variables
terraform apply -auto-approve \
-var 'pool=gateway' \
-var 'flavor=m02.c02.d20' \
-var 'volume_size=3' \
-var 'network_name=my-network' \
-var 'ssh_key_file=./id_rsa_os'Upon completion,the instances floating IP can be viewed in instance_ip.txt.
watch the
-forcewill not ask for any confirmation.
terraform destroy -force
# or with specific variables
terraform destroy -force \
-var 'pool=gateway' \
-var 'flavor=m02.c02.d20' \
-var 'volume_size=3' \
-var 'network_name=my-network' \
-var 'ssh_key_file=./id_rsa_os'