terraform-provider-kafka
terraform-provider-kafka copied to clipboard
Fix remove acls when not exist
Closes #237
When the ACL has already been removed from kafka, and terraform destroy is executed, the error occurs:
Error: There were no acls matching this filter
This suggestion is to avoid this error
@leonardobiffi Can you add a test?
As for the change, I think we should keep returning this error in the client, but just catch it, and do a d.SetId("")
in the read of the acl_resource...
Hi @Mongey,
if no ACL found, d.SetId("")
is already being defined in aclRead
https://github.com/Mongey/terraform-provider-kafka/blob/master/kafka/resource_kafka_acl.go#L154
Again taking the aws provider as an example, when the bucket does not exist the delete function returns nil
. So the idea would be the same:
https://github.com/hashicorp/terraform-provider-aws/blob/9f3fce2617489a9ec7f3486a51e2981a4410c085/internal/service/s3/bucket.go#L1417
@Mongey this PR can be accepted? what is missing?
@leonardobiffi can you add a test to demonstrate the behaviour that this is fixing?