Open
Description
- We are using
ibm_iam_authorization_policy
here to create a service to a service auth policy between KMS <-> COS - Intermittently when attempting to create an encrypted COS bucket here using
ibm_cos_bucket
, it fails with the following error:
2023/04/01 00:11:58 Terraform apply | Error: ServiceNotAuthorized: The specified COS Service Instance does not have sufficient permissions to access the resource associated with the KMS key CRN.
2023/04/01 00:11:58 Terraform apply | status code: 401, request id: 71bc96a8-4cc5-445f-84a3-79d127630af1, host id:
2023/04/01 00:11:58 Terraform apply |
2023/04/01 00:11:58 Terraform apply | with module.landing_zone.ibm_cos_bucket.buckets["workload-bucket"],
2023/04/01 00:11:58 Terraform apply | on ../../cos.tf line 74, in resource "ibm_cos_bucket" "buckets":
2023/04/01 00:11:58 Terraform apply | 74: resource "ibm_cos_bucket" "buckets" {
2023/04/01 00:11:58 Terraform apply |
2023/04/01 00:11:58 Terraform apply |
2023/04/01 00:11:58 Terraform apply | Error: ServiceNotAuthorized: The specified COS Service Instance does not have sufficient permissions to access the resource associated with the KMS key CRN.
2023/04/01 00:11:58 Terraform apply | status code: 401, request id: 8d1bb913-06ed-40f3-a5bd-8067b76e5854, host id:
2023/04/01 00:11:58 Terraform apply |
2023/04/01 00:11:58 Terraform apply | with module.landing_zone.ibm_cos_bucket.buckets["management-bucket"],
2023/04/01 00:11:58 Terraform apply | on ../../cos.tf line 74, in resource "ibm_cos_bucket" "buckets":
2023/04/01 00:11:58 Terraform apply | 74: resource "ibm_cos_bucket" "buckets" {
2023/04/01 00:11:58 Terraform apply |
2023/04/01 00:11:58 Terraform apply |
2023/04/01 00:11:58 Terraform apply | Error: ServiceNotAuthorized: The specified COS Service Instance does not have sufficient permissions to access the resource associated with the KMS key CRN.
2023/04/01 00:11:58 Terraform apply | status code: 401, request id: 0ba8e3d4-787c-4a41-b89e-ecd9dcca4e2a, host id:
2023/04/01 00:11:58 Terraform apply |
2023/04/01 00:11:58 Terraform apply | with module.landing_zone.ibm_cos_bucket.buckets["atracker-bucket"],
2023/04/01 00:11:58 Terraform apply | on ../../cos.tf line 74, in resource "ibm_cos_bucket" "buckets":
2023/04/01 00:11:58 Terraform apply | 74: resource "ibm_cos_bucket" "buckets" {
- This failure seems to be because of a delay with IAM when creating the S2S auth policy because if I wait a little bit and retry, the bucket gets created successfully.
Is it possible to add some workaround to this delay in the provider code. Perhaps a retry, or some extra validation when creating an auth policy that indeed the policy is ready for use?
My suspicion is that this is an IAM database replication issue where the auth policy exists on one database node, but is not fully replicated to the other yet, as we have seen something similar occur for other use cases too.
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform CLI and Terraform IBM Provider Version
Affected Resource(s)
- ibm_iam_authorization_policy
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
# Copy-paste your Terraform configurations here - for large Terraform configs,
# please share a link to the ZIP file.
Debug Output
Panic Output
Expected Behavior
Actual Behavior
Steps to Reproduce
terraform apply
Important Factoids
References
- #0000