Create a ~/.terraformrc
file that points to the Terraform binary. For example if you installed the binary to /usr/local/bin/terraform-provider-ibm
the ~/.terraformrc
would look like this:
providers {
ibm = "/usr/local/bin/terraform-provider-ibm"
}
To provide your credentials as environment variables, you can use the following code in your provider.tf
file. Please Note: for the Kubernetes example you also need to add the region to the provider.tf
file.
provider "ibm" {
bluemix_api_key = "${var.ibm_bx_api_key}"
softlayer_username = "${var.ibm_sl_username}"
softlayer_api_key = "${var.ibm_sl_api_key}"
}
Be sure to also define the following variables in your var.tf
files:
variable ibm_bx_api_key {}
variable ibm_sl_username {}
variable ibm_sl_api_key {}
variable ibm_account_guid {}
variable ibm_org_guid {}
variable ibm_space_guid {}
If you do not know your IBM Account/Org/Space GUID you can run the following commands to obtain them:
# Get account guid
$ ibmcloud iam accounts
# Get Org guid
$ ibmcloud iam orgs --guid
# Get Space guid
$ ibmcloud iam space <SPACE NAME> --guid
With those gathered you can now export your environmental variables for use with Terraform.
export TF_VAR_ibm_bx_api_key="$VALUE"
export TF_VAR_ibm_sl_username="$VALUE"
export TF_VAR_ibm_sl_api_key="$VALUE"
export TF_VAR_ibm_account_guid="$VALUE"
export TF_VAR_ibm_org_guid="$VALUE"
export TF_VAR_ibm_space_guid="$VALUE"
- Log Analysis service deployed and configured on a VSI
- Monitoring service deployed and configured on a VSI
- Cloud Object storage deployed and configured to automatically backup VSI
- Deploying a Mult-zone Kubernetes cluster
- Deploying a Bare Metal server with RAID
- Distributed Minio Cluster fronted by Cloud Load Balancer
- and many more...