Skip to content

Latest commit

 

History

History
82 lines (61 loc) · 2.72 KB

Using_Terraform.md

File metadata and controls

82 lines (61 loc) · 2.72 KB

Running examples using local Terraform client

Requirements

To run locally, these examples have the following dependencies:

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_*

Executing the examples

  1. Move into the directory of the desired Cloud Pak to install, for example:

    cd <example subdirectory>
  2. 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 = "bob@email.com"
    entitled_registry_key        = "xxxxxxxxxxxxxxxxxxxxx"
    cluster_id                   = "xxxxxxxxxxxxxxxxxxxxx"
    ibmcloud_api_key             = "xxxxxxxxxxxxxxxxxxxxx"
    ...
  3. 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
  4. 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.

  5. To get the output parameters again or validate them, execute:

    terraform output
  6. Finally, when you finish using the infrastructure, cleanup everything you created with the execution of:

    terraform destroy