Problem
When using version 5.32.0 of the Terraform AWS provider, a terraform plan or terraform apply that includes an aws_mq_broker resource may fail with a plugin crash error.
The following panic appears in the output:
Error: The terraform-provider-aws_v5.32.0_x5 plugin crashed!
panic: interface conversion: interface {} is *schema.Set, not []string
goroutine 892 [running]:
github.com/hashicorp/terraform-provider-aws/internal/service/mq.resourceUserHash({0xe26bac0?, 0xc001e2fef0})...
terraform-providers/terraform-provider-aws/internal/service/mq/broker.go:749 +0x325Prerequisites
- Terraform configuration using the HashiCorp AWS provider version
5.32.0.
Cause
This error is caused by a known issue in version 5.32.0 of the hashicorp/aws provider, which was resolved in a subsequent patch release.
Solutions
You can resolve this issue by either downgrading to the last stable version or upgrading to the fixed version. Upgrading is the recommended approach.
For more details, refer to the documentation on provider version constraints.
Solution 1: Downgrade the AWS Provider
You can avoid the issue by pinning the AWS provider to the last known working version, 5.31.0.
Update your Terraform configuration to set an exact version constraint.
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.31.0"
}
}
}After updating the configuration, run $ terraform init -upgrade to apply the change.
Solution 2: Upgrade the AWS Provider (Recommended)
The permanent solution is to upgrade the AWS provider to version 5.32.1 or higher, where the bug is fixed.
Update your Terraform configuration to require at least version 5.32.1.
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.32.1"
}
}
}After updating the configuration, run $ terraform init -upgrade to download the newer provider version.
Outcome
After applying one of the solutions, Terraform can successfully plan and apply changes to the aws_mq_broker resource without the plugin crashing.