I am using Terraform with IBM Cloud and wanted to create a service to service authorization with ibm_iam_authorization_policy.
I know how to create the policy between cloud-object-storage
and kms
in general. But how do I scope it to a specific key ring? I can do it in the IBM Cloud console, but haven't seen anything in the provider.
resource "ibm_iam_authorization_policy" "testpolicy" {
source_resource_instance_id = data.ibm_resource_instance.cos_resource_instance.guid
source_service_name = "cloud-object-storage"
target_resource_instance_id = data.ibm_resource_instance.kms_resource_instance.guid
target_service_name = "kms"
roles = ["Reader"]
description = "TF-based test"
}
Performing some more tests with the Policy Management API and then Terraform, the following seems to work:
Using resource_attributes with the name attribute keyRing creates the right authorization policy.