Estimated duration: 60 mins
These Terraform scripts will provision the following Cloud Services in IBM Cloud:
- a Resource Group to host resources
- a VPC with 3 subnets across a MZR (Multi Zone Region)
- a managed OpenShift cluster (ROKS)
- a managed Postgres Database
You can then ssh into the newly created VSI.
Terraform | Estimation Duration |
---|---|
Apply | ~60 mins |
Destroy | ~5-10 mins |
This lab requires the following command lines:
Unless you are Administrator of the Cloud Account, you need permissions to be able to provision VPC Resources. Ask the Administrator run the Terraform in
iam
folder.
-
Clone this repository
git clone https://github.com/lionelmace/learn-ibm-terraform
-
Login to IBM Cloud
ibmcloud login
-
Create and store the value of an API KEY as environment variable
export IBMCLOUD_API_KEY=$(ibmcloud iam api-key-create my-api-key --output json | jq -r .apikey)
If the variable "ibmcloud_api_key" is set in your provider, you can initialize it using the following command export TF_VAR_ibmcloud_api_key="Your IBM Cloud API Key"
-
Terraform must initialize the provider before it can be used.
terraform init
-
Review the plan
terraform plan
-
Start provisioning.
Estimated duration: 45-60 mins
terraform apply --var-file="odm.auto.tfvars"
-
Clean up the resources to avoid cost
terraform destroy