A Terraform configuration for deploying a app on multi zone cluster
This configuration template is tested for IBM Cloud Provider version v0.11.2
You will need to setup up IBM Cloud provider credentials on your local machine.
- Download Terraform binary. Unzip it and keep the binary in path ex- /usr/local/bin.
- Download IBM Cloud Provider Plugin. Unzip it and keep the binary in path in the same directory where you placed Terraform binary in previous step. You can also build the binary yourself. Please look into documentation.
- You can override default values that are in your variables.tf file.
- Alternatively these values can be supplied via the command line or environment variables, see https://www.terraform.io/intro/getting-started/variables.html.
terraform plan
: this will perform a dry run to show what infrastructure terraform intends to create
terraform apply
: this will create actual infrastructureterraform destroy
: this will destroy all infrastructure which has been created
To setup the IBM Cloud provider to work with this example there are a few options for managing credentials safely; here we'll cover the preferred method using environment variables. Other methods can be used, please see the Terraform Getting Started Variable documentation for further details.
You'll need to export the following environment variables:
TF_VAR_bluemix_api_key
- your Bluemix api keyTF_VAR_private_vlan_id
- provide private vlan idTF_VAR_public_vlan_id
- provide public vlan id
On OS X this is achieved by entering the following into your terminal, replacing the <value>
characters with the actual values (remove the <>
:
export TF_VAR_bluemix_api_key=<value>
export TF_VAR_private_vlan_id=<value>
export TF_VAR_public_vlan_id=<value>
Variable Name | Description | Default Value |
---|---|---|
region | eu-de | |
datacenter | ams03 | |
machine_type | u2c.2x4 | |
isolation | public | |
private_vlan_id | ||
public_vlan_id |
Upon completion, terraform will output the url of the application, e.g.:
app_url_1 = "<url>"
app_url_2 = "<url>"
Use this url to access your application