aminueza / terraform-provider-minio

Terraform provider for managing MinIO S3 buckets and IAM Users.
https://registry.terraform.io/providers/aminueza/minio
GNU Affero General Public License v3.0
233 stars 69 forks source link

[FATAL] unable to read policy: The canned policy does not exist #550

Closed thedulus closed 2 months ago

thedulus commented 9 months ago

Prerequisites

Description

We use terraform-provider-minio to provision MinIO policies using the minio_iam_policy resource. Whenever the policy gets manually deleted on the MinIO server and another terraform apply is issued, terraform-provider-minio fails with the error message:

❯ terraform plan
Acquiring state lock. This may take a few moments...
data.local_file.tenants: Reading...
minio_iam_policy.policy1: Refreshing state... [id=policy1]
minio_iam_policy.policy2: Refreshing state... [id=policy2]
minio_iam_policy.policy3: Refreshing state... [id=policy3]
minio_iam_policy.policy4: Refreshing state... [id=policy4]
data.local_file.tenants: Read complete after 0s [id=97d170e1550eee4afc0af065b78cda302a97674c]

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: [FATAL] unable to read policy (policy4): The canned policy does not exist. (Specified canned policy does not exist)
│ 
│   with minio_iam_policy.policy4,
│   on policies.tf line 11, in resource "minio_iam_policy" "policy4":
│   11: resource "minio_iam_policy" "policy4" {
│ 
╵
Releasing state lock. This may take a few moments...

Steps to Reproduce

  1. Create a policy using the minio_iam_policy resource
  2. Delete the created policy on the MinIO server
  3. Rerun a terraform plan or terraform apply

Expected behavior: terraform-provider-minio recreates the policy unless it wasn't deleted from the terraform definition as well

Actual behavior: terraform-provider-minio fails with the above described error message instead of recreating the policy

Reproduces how often: 100%

Versions

terraform-provider-minio v2.0.1

Additional Information

Let me know if you need any additional information.