DevOps automation with IBM Cloud, IBM Power Systems, and Terraform

DevOps, IBM Power Systems, and IBM Cloud – the perfect combination

Cloud computing has fundamentally changed how infrastructure is consumed. With a few simple clicks, you can get endless access to any resource, such as virtual machines (VMs), storage volumes, Kubernetes clusters, and more. With IBM® Power Systems™ in IBM Cloud® getting immediate access to IBM AIX® and IBM i in IBM Cloud is easier than ever.

While immediate point-and-click style access (that is, using a GUI) is convenient, in the world of DevOps automation, more is expected—people are looking to codify infrastructure. That’s where technologies like HashiCorp Terraform come in. Terraform’s motto is all about Infrastructure as Code (IaC) and provisioning any cloud resource in a simple and automated fashion. And the good news is that this ability is fully enabled for IBM Power Systems in IBM Cloud (in addition to the rest of the IBM Cloud resources). To that end, consider the following high-level use cases.

Automatically provision a virtual machine and install some software

What happens when someone on your team needs a new application environment? It is still commonplace that the compute, storage and network resources are independently provisioned. When that’s done, a software expert is engaged to perform the software installation — and hours, days or sometimes even weeks later, the end user can finally start using the application.

With Terraform, all of this can be automated — the entire cloud infrastructure (that is, the VM, its storage, and its networking resources) can be automatically provisioned, and the software installation can be automatically done atop all that for a complete end-to-end solution.

Quickly provision an entire QA infrastructure

Taking the previous example one step further. Imagine the QA team needs an entire infrastructure and application created for test purposes. This setup process can take weeks for infrastructure and software teams. What happens if the QA team encounters a problem and things need to be rebuilt? Potentially weeks of delays.

Terraform can define the landscape as code so that IT administrators can simply run [terraform apply] and go work on something else while Terraform does the heavy lifting and provisions the entire estate. When it is done (total time is a function of the number of IT resources Terraform needs to provision), IT administrators can turn the environment over to the QA team.

As you can probably tell, this technology can introduce tremendous benefit to any organization, as it can automate everything from the simplest VM deployment to the most complex hybrid cloud environment.


Let’s walk through a simple scenario that will create an AIX VM in IBM Cloud and provision some software atop the freshly deployed VM:

  1. Download and install Terraform and the IBM Cloud Terraform provider
    As of this writing, the IBM Cloud Terraform provider requires Terraform 11.x to be used. Visit the HashiCorp download site to download and extract the Terraform binary for the appropriate platform. You can run Terraform from any Linux® or Microsoft® Windows® operating system. Note that HashiCorp does not currently provide ppc64le binaries, so if you want to run Terraform on Linux on Power, build the binary from source. You should also download the latest official version of the IBM Cloud Terraform provider from the IBM download site. After extracting the binary, place it in your ~/.terraform.d/plugins directory.
  2. Create your IBM Cloud account and configure a Power Systems Virtual Server instance
    To run the example against IBM Cloud, you need to create a billed IBM Cloud account and provision a Power Systems Virtual Server instance under the Compute Infrastructure section. As part of this process, it is recommended to provision a VM manually through the IBM Cloud interface to become familiar with the networking, Secure Shell (SSH) keys, and so on. Once you can provision VMs manually, then you are ready to move on to the automated steps.
  3. Install the IBM Cloud and Power Virtual Server CLIs
    To run the Terraform example, we will need to create a public-VLAN network that our VMs can attach to so that we can access the VMs over the Internet. Note that this step is only necessary if you don’t have network connectivity between the system on which Terraform is installed and the Power Virtual Server VM. To create the public-VLAN network, you first need to install the IBM Cloud CLI by following these steps. Next you need to install the Power Virtual Server CLI utility by running [ibmcloud plugin install power-iaas].
  4. Create a public-VLAN network
    Create a public-facing network named public-net by running [ibmcloud pi network-create-public public-net --dns-servers ""]. Note that you will use the public-net value in the fifth step when you’re populating the network section of the file.
  5. Download and run the Terraform example
    To make things easy, we’ve provided a sample Terraform script on GitHub. Use Git to clone this repository on the same system on which you configured Terraform in the first step. Update the file with values that coincide with your IBM Cloud configuration. For starters, you will need to create an IBM Cloud API key and feed that into the file. The API key should be kept secret as it allows IBM Cloud resources to be created and assigned to your user account (that is, you will be paying for them). You will also need to create an SSH key and upload it to the IBM Power Virtual Server interface. The file will also require you to input the base64-encoded form of the private key (you can generate this by running [base64 -i path-to-private-key-file] so that the Terraform SSH provisioner can connect to the AIX VM and perform the software installation. After you have the file filled out, you can run the example by following the instructions in the file. And that’s it—you just automated the deployment of an AIX VM and performed automated software installation in IBM Cloud! You can customize this example to suit your specific needs. When Terraform is done, you will see output that looks like:

    ibm_pi_instance.pvminstance: Still creating… (4m30s elapsed)
    ibm_pi_instance.pvminstance: Still creating… (4m40s elapsed)
    ibm_pi_instance.pvminstance: Creation complete after 4m45s (ID: 468318ac-2dec-45ac-b797-79780c5a6c61)
    Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
    health_status = WARNING
    ip_address = [
    externalip = a.b.c.d,
    ip = a.b.c.d,
    macaddress = fa:a2:3b:aa:75:20,
    networkid = 4808df8f-36da-474d-aae7-f2e2cd887833,
    networkname = public-net,
    type = fixed
    ] min_proc = 0.5
    progress = 0
    status = ACTIVE
  6. Clean up your cloud resources
    Don’t forget to run [terraform destroy] when you’re done to clean up the cloud resources so that you don’t incur unwanted charges.

More examples

You can look at several more examples in our GitHub repository. Every directory name that starts with ibm-pi contains IBM Power Virtual Server on IBM Cloud Terraform examples.


While the example we showcased was fairly straightforward, this can be used as a framework to automatically provision much more complex environments. Terraform is a technology that will continue fueling innovations. So, check it out today to see how it can help you!

Connect with the the IBM i community

Connect, learn, share, and engage with other IBM i users as you follow what’s trending and join the discussion. Join now