Skip to content

Commit

Permalink
Updated Terraform Scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mackhendricks committed Jul 27, 2022
1 parent 99fed4a commit 9f35159
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 4 deletions.
46 changes: 46 additions & 0 deletions resources/terraform/do/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## Installing dSIPRouter Using Terraform on Digital Ocean

1. Generate an SSH key if you don't already have one

2. Configure the SSH key into your Digital Ocean Account

3. Obtain a Digital Ocean API key and store the key as an environment variable

```
```

4. Copy terraform.tfvars.sample to terraform.tfvars

```
cp terraform.tfvars.sample terraform.tfvars
```
5. Modify terraform.tfvars so that it overrides your variables, which is located in variables.tf. The pvt_key_path is the location of your private key. The pub_key_name is the name of the public key you defined when you uploaded your SSH key. The dsiprouter_prefix is the prefix that will be concatenated to the name of the droplet that will be created. The number_of_environments is used to specify how many instances will be crated.

```
pvt_key_path="/Users/mackhendricks/.ssh/dopensource-training"
dsiprouter_prefix="dev"
number_of_environments=1
pub_key_name="dopensource-training"
```

All of the variables and any default values can be found in variables.tf.

6. Create a new instance of dSIPRouter

The following command will create a new instance of dSIPRouter based on the master branch. The OS image will be Debian 11 and the dsiprouter_prefix will be overriden by demo.


```
terraform apply -var branch=master -var dsiprouter_prefix=demo -var image=debian-11-x64
```

7. Destroy your instance if you are done with it by using the terraform destory command

```
terraform destroy
```

## Need Help?

We offer paid support for this Terraform script! You can purchase 2 hours of support from [here](https://dopensource.com/product-category/prepaid-support/)
2 changes: 1 addition & 1 deletion resources/terraform/do/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ resource "digitalocean_droplet" "dsiprouter" {

provisioner "remote-exec" {
inline = [
"apt-get update -y && apt-get install -y git && cd /opt && git clone https://github.com/dOpensource/dsiprouter.git -b ${var.branch} && cd dsiprouter && ./dsiprouter.sh install -all"
"apt-get update -y && apt-get install -y git && cd /opt && git clone https://github.com/dOpensource/dsiprouter.git -b ${var.branch} && cd dsiprouter && ./dsiprouter.sh install -all && ${var.additional_commands}"
]
}
}
6 changes: 3 additions & 3 deletions resources/terraform/do/terraform.tfvars.sample
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pvt_key_path="/Users/mack/.ssh/dopensource-training"
pvt_key_path="/Users/mackhendricks/.ssh/dopensource-training"
dsiprouter_prefix="dev"
number_of_environments=1
pub_key_name="dopensource_training"

pub_key_name="dopensource-training"
additional_commands="echo"
5 changes: 5 additions & 0 deletions resources/terraform/do/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ variable "image" {
type=string
default="debian-10-x64"
}

variable "additional_commands" {
type=string
default="echo"
}

0 comments on commit 9f35159

Please sign in to comment.