DevOps, POWER 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. To that end, we recently announced IBM Power Systems in the IBM Cloud. Now getting immediate access to AIX and IBM i in the IBM Cloud is easier than ever.
While immediate point-and-click style access (i.e., 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 Power Systems in the 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â€™s 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 (i.e., 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â€™s 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 Dig In!
Letâ€™s walk through a simple scenario that will create an AIX VM in the IBM Cloud and provision some software atop the freshly deployed VM:
- 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 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
- Create your IBM Cloud account and configure a Power 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â€™s recommended to provision a VM manually through the IBM Cloud interface to become familiar with the networking, SSH keys, etc. Once you can provision VMs manually, then you are ready to move on to the automated steps.
- 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].
- Create a public-vlan network
Create a public-facing network named â€śpublic-netâ€ť by running
[ibmcloud pi network-create-public public-net --dns-servers "184.108.40.206"]. Note that you will use the â€śpublic-netâ€ť value in the fifth step when youâ€™re populating the network section of the
- 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
variables.tffile 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
variables.tffileâ€”the API key should be kept secret as it allows IBM Cloud resources to be created and assigned to your user account (i.e., 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
variables.tffile 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
variables.tffile filled out, you can run the example by following the instructions in the README.md file. And thatâ€™s itâ€”you just automated the deployment of an AIX VM and performed automated software installation in the 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
- 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.
Want to check out more examples? No problem, weâ€™ve got you covered. 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!