IBM Cloud: How to create HMAC credentials for COS using Terraform?

691 views Asked by At

I am using IBM Cloud Object Storage (COS) to store files on IBM Cloud. I have used Terraform to provision the service and to create the storage bucket. How can I create credentials including the HMAC portion using Terraform?

This is how to create the resource key (credentials):

# service access key for COS
resource "ibm_resource_key" "MyCos" {
  name                 = "my-accKey-cos"
  role                 = "Writer"
  resource_instance_id = ibm_resource_instance.cos.id
}
1

There are 1 answers

0
data_henrik On BEST ANSWER

The key to creating HMAC credentials is to have the right parameters for ibm_resource_key.

# service access key for COS
resource "ibm_resource_key" "MyCos" {
  name                 = "my-accKey-cos"
  role                 = "Writer"
  resource_instance_id = ibm_resource_instance.cos.id
  parameters           = { HMAC = true }
}

With the added parameter for HMAC it works.

In that sense it is similar to using the CLI.