Build dSIPRouter Using Terraform
IntroductionThe purpose of this article is to show you how to automate the deployment of dSIPRouter using HashiCorp Terraform. We ship a Terraform script with dSIPRouter because we do all of our development and testing against Digital Ocean. Also, we wanted to provide you with an example of how you could implement this for other cloud providers since Terraform has providers for all of the major public clouds and on-premise environments as well.
- You have a Digital Ocean API Key
- You have a SSH Key Pair uploaded to Digital Ocean and you know it’s name
Download Terraform and Setup EnvironmentFor congruency, we will be doing this from Windows, but doing so from Linux should be similar. Please download the following packages (uniformity between OS’s):
- GitBash – https://git-scm.com/download/win
- Terraform – https://www.terraform.io/downloads
—>advanced system settings
Get Repository and Setup Terraform VariablesOpen a terminal window / command prompt and type the following:
This will install the Digital Ocean provider since our terraform script is configured to work with Digital Ocean. Edit the terraform.tfvars file, which sets the values of variables needed by the terraform script.
export DIGITALOCEAN_TOKEN=<Digital Ocean token key> git clone https://github.com/dOpensource/dsiprouter cd dsiprouter/resources/terraform/do copy terraform.tfvars.sample terraform.tfvars terraform init
Once modified, you should have all you need to deploy an instance via Terraform.
pvt_key_path="C:/Users/alems/Working/andrew" (adjust using path format, andrew is actually the pvt key)
Build dSIPRouter Using TerraformExecute the following commands to build dSIPRouter from the master branch using terraform:
If you want to build from another branch you would pass in the branch variable with the value of the branch like this
This is what it will look like as it starts to build: This is what it will look like after it’s completed: You will now be able to login to dSIPRouter using the credentials generated.
terraform apply -var branch=v0.643