-
Notifications
You must be signed in to change notification settings - Fork 719
Description
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_pi_host_group (PowerVS)
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
terraform-provider-ibm: v 1.88.2
I also attempted 1.88.1, 1.88.0, and 1.75.2 (which was before update to the source file), all resulted in the same error.
# Minimal repro (redacted)
resource "ibm_pi_host_group" "example" {
pi_cloud_instance_id = var.pi_cloud_instance_id
# Host group name
pi_name = "test-host-group"
# (A) Hosts in the group
pi_hosts = [
{
display_name = "host-1"
sys_type = "s922"
}
]
# (B) Share with a secondary workspace β toggling this triggers Update
pi_secondaries = [
{
name = "test-host-group-secondary"
workspace = var.secondary_workspace_id
}
]
}Debug Output
https://gist.github.com/jreeves-lus/b9f3330a4d3e5bea4a63001ddf86fde0
Panic Output
https://gist.github.com/jreeves-lus/fe6f648d09031c4f3ad8cfb76b52eded
Expected Behavior
Provider should handle the update of nested list attributes (pi_hosts, pi_secondaries) without crashing.
Actual Behavior
Terraform fails with a provider panic during update.
Steps to Reproduce
Steps to reproduce:
- Apply the configuration above to create a host group.
- Change one of the nested list values - 3.g. remove/add an entry in pi_secondaries or pi_hosts
- Run terraform apply
- Provider crashes during Update
module.powervs_workspace.ibm_pi_host_group.dedicated_hosts: Modifying... [id=<redacted>]
β Error: Request cancelled
β The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
Stack trace from the terraform-provider-ibm_v1.88.2 plugin:
panic: interface conversion: interface {} is *schema.Set, not []interface {}
goroutine 46 [running]:
github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/power.resourceIBMPIHostGroupUpdate({0x6e1f108, 0xc0004a17a0}, 0xc0043483f0, {0x628c940, 0xc000307c08})
github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/power/resource_ibm_pi_host_group.go:237 +0xab1
...
Error: The terraform-provider-ibm_v1.88.2 plugin crashed!
Important Factoids
Panic suggests an interface type assertion mismatch in the update handler (treats a *schema.Set as []interface{}. The resource and its implementation are in the PowerVS package (ResourceIBMPIHostGroup.
References
Documentation shows that pi_hosts and pi_secondaries are a List type:
https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/pi_host_group
Location of Update handler:
https://github.com/IBM-Cloud/terraform-provider-ibm/blob/master/ibm/service/power/resource_ibm_pi_host_group.go
- #0000