To run locally, these examples have the following dependencies:
- Have an IBM Cloud account with required privileges
- Install IBM Cloud CLI
- Install the IBM Cloud CLI Plugins
schematics
andkubernetes-service
. - Login to IBM Cloud with the CLI
- Install Terraform version 1.0 or higher
- Configure Access to IBM Cloud
- Utility tools such as:
Execute these commands to validate some of these requirements:
ibmcloud --version
ibmcloud plugin show schematics | head -3
ibmcloud plugin show kubernetes-service | head -3
ibmcloud target
terraform version
ls ~/.terraform.d/plugins/terraform-provider-ibm_*
-
Move into the directory of the desired Cloud Pak to install, for example:
cd <example subdirectory>
-
Create the file
terraform.tfvars
with the following Terraform input variables using your own specific values. Refer to each example README for the specific variables to override:owner = "bob" project_name = "cloud-pak-app" entitled_registry_user_email = "[email protected]" entitled_registry_key = "xxxxxxxxxxxxxxxxxxxxx" cluster_id = "xxxxxxxxxxxxxxxxxxxxx" ibmcloud_api_key = "xxxxxxxxxxxxxxxxxxxxx" ...
-
Issue the following commands to prime the Terraform code:
terraform init
If you modified the code, execute the following commands to validate and format the code:
terraform fmt -recursive terraform validate terraform plan
-
Issue the following command to execute the Terraform code:
terraform apply -auto-approve
At the end of the execution you'll see the output parameters.
If something fails, it should be safe to execute the
terraform apply
command again. -
To get the output parameters again or validate them, execute:
terraform output
-
Finally, when you finish using the infrastructure, cleanup everything you created with the execution of:
terraform destroy