Provisioning IBM Cloud Services Using Terraform
The last time I looked up, the IBM Cloud catalog had more than 170+ services, available under different categories — AI, Analytics, Databases, Developer Tools, Integration, IoT, Web & Mobile, Security & Identity, and so on.
I was able to use the IBM Cloud Terraform provider and provision the IBM Cloud Services / Resources, using the service-instance resources as illustrated here:
resource "ibm_service_instance" "service-instance" {
name = "test"
space_guid = "${data.ibm_space.spacedata.id}"
service = "compose-for-etcd"
plan = "Standard"
parameters = {
"db_version" = "3.2.18"
}
}However, when I tried to do the same for internet-svcs, it failed.
Get Harini Reddy’s stories in your inbox
Join Medium for free to get updates from this writer.
After some investigation, I discovered that the difference lies in how Cloud Identity & Access Management treats your Cloud Services or Resources.
- A set of IBM Cloud services are enabled to use Cloud IAM for access control and are organized into resource groups within your account to enable giving users quick and easy access to more than one resource at a time. Cloud IAM access policies are used to assign users and service IDs access to the resources within your account. You can group a set of users and service IDs into an access group to easily give all entities within the group the same level access.
- The access to the remaining set of IBM Cloud services & resources are governed using the Cloud Foundry roles; wherein Users are added to the org and space to which the instance belongs with a Cloud Foundry role assigned.
Now, “how do I find whether my Cloud Services / Resource can be accessed using Cloud IAM roles or Cloud Foundry roles ?”
This cute Service Info application can be used to find the answers. It lists all the IBM Cloud services and its corresponding details like Description, Plans, Region, Terraform Type — resource-instance (Cloud IAM roles) or service-instance (Cloud Foundry roles).
resource "ibm_resource_instance" "resource_instance" {
name = "test"
service = "internet-svcs"
plan = "free"
location = "global"
}Another, challenge that you will face, while using the resource-instance or service-instance resource in the IBM Cloud Terraform provider is — “how do I know the list of parameters required to provision the resource?” For example, I wanted to provision a compose-for-mongodb database using the service_instance, but I could not find the relevant documentation that tells me, “what parameters does it accept ? And, how to specify the required mongodb ‘version’ as the parameter?”
Here again, the same Service Info application enlists the params (and potential values) that can be passed to the Terraform configuration tf file, as shown below.
resource "ibm_service_instance" "service-instance" {
name = "test"
space_guid = "${data.ibm_space.spacedata.id}"
service = "compose-for-mongodb"
plan = "Standard"
parameters = {
"db_version" = "3.4.10"
}
}You can find more information about IBM Cloud Terraform provider resources here. Please give it a try and let us know your comments!!!





