README.md 1.83 KB
Newer Older
Ryan Randles Jones's avatar
Ryan Randles Jones committed
1
# Terraform Openstack
Ryan Randles Jones's avatar
Ryan Randles Jones committed
2

3
### This will create:
Ryan Randles Jones's avatar
Ryan Randles Jones committed
4

5
- dmznet and dmzsubnet
Ryan Randles Jones's avatar
Ryan Randles Jones committed
6

7
- borderrouter that connects dmznet to bright-external-flat-externalnet
Ryan Randles Jones's avatar
Ryan Randles Jones committed
8

9
- a floating ip address, and an instance coming off of dmznet
Ryan Randles Jones's avatar
Ryan Randles Jones committed
10

11
- clusternet off of dmznet instance
Ryan Randles Jones's avatar
Ryan Randles Jones committed
12

13
14
- clustersubnet
will connect instance to ood through ohpc and download software
Ryan Randles Jones's avatar
Ryan Randles Jones committed
15

16
### Make a new directory for Terraform:
Ryan Randles Jones's avatar
Ryan Randles Jones committed
17

18
- `$mkdir terraform-first-instance`
Ryan Randles Jones's avatar
Ryan Randles Jones committed
19

20
### Install Terraform:
Ryan Randles Jones's avatar
Ryan Randles Jones committed
21

22
- `$brew install terraform`
Ryan Randles Jones's avatar
Ryan Randles Jones committed
23

24
### Unzip the file and make a path to your new directory using:
Ryan Randles Jones's avatar
Ryan Randles Jones committed
25

26
- `$export TERRAFORM_DIR="$(pwd)/terraform-first-instance`
Ryan Randles Jones's avatar
Ryan Randles Jones committed
27

28
- `$cp $HOME/Downloads/terraform_0.6.16_linux_amd64/terraform $TERRAFORM_DIR`
Ryan Randles Jones's avatar
Ryan Randles Jones committed
29

30
### Create a new application credintial in Openstack:
31

32
- In Openstack, go to **Identity** -> **Application Credentials**
33

34
- Click "**Create Application Credential**"
35

Ishan Patel's avatar
Ishan Patel committed
36
- 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.)
37

Ishan Patel's avatar
Ishan Patel committed
38
- Download the credentials as an RC file.
39

Ryan Randles Jones's avatar
Ryan Randles Jones committed
40
- Edit variables in credentials RC file to TF_ from OS_. Everything else stays the same.
Ryan Randles Jones's avatar
Ryan Randles Jones committed
41

Ryan Randles Jones's avatar
Ryan Randles Jones committed
42
- Save credentials RC file in your terraform-first-instance directory.
Ryan Randles Jones's avatar
Ryan Randles Jones committed
43

Ryan Randles Jones's avatar
Ryan Randles Jones committed
44

Ryan Randles Jones's avatar
Ryan Randles Jones committed
45
### Clone this repo into your terraform-first-instance directory using:
Ryan Randles Jones's avatar
Ryan Randles Jones committed
46

Ryan Randles Jones's avatar
Ryan Randles Jones committed
47
- `$git clone --recursive https://gitlab.rc.uab.edu/rrand11/terraform-openstack.git`
Ryan Randles Jones's avatar
Ryan Randles Jones committed
48

Ryan Randles Jones's avatar
Ryan Randles Jones committed
49
### Source the RC file and initialize terraform:
Ryan Randles Jones's avatar
Ryan Randles Jones committed
50

51
- `$source CREDENTIALRCFILENAME`
Ryan Randles Jones's avatar
Ryan Randles Jones committed
52

53
- `$cd terraform-openstack`
Ryan Jones's avatar
Ryan Jones committed
54

55
- `$terraform init`
Ryan Randles Jones's avatar
Ryan Randles Jones committed
56

57
### Write Terraform Plan to your terraform-first-instance directory and run that plan:
Ryan Randles Jones's avatar
Ryan Randles Jones committed
58

59
- `$terraform plan -out $HOME/terraform-first-instance/terraform-plan.tf`
Ryan Jones's avatar
Ryan Jones committed
60

61
**_(Note)_** `$terraform plan -out` writes the plan to a file and then `terraform apply` runs that plan.
Ryan Randles Jones's avatar
Ryan Randles Jones committed
62

63
- `$terraform apply "$HOME/terraform-first-instance/terraform-plan.tf"`
Ryan Jones's avatar
Ryan Jones committed
64

65
### Destroy Terraform Instance:
Ryan Jones's avatar
Ryan Jones committed
66

67
- `$terraform destroy`