Open
Description
Terraform and AWS Provider Version
Terraform v1.12.2
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.100.0
Affected Resource(s) or Data Source(s)
aws_autoscaling_group
Expected Behavior
Empty capacity_reservation_target
block is added to capacity_reservation_specification
as per plan:
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# module.instance.aws_autoscaling_group.asg will be updated in-place
~ resource "aws_autoscaling_group" "asg" {
id = "my-asg"
name = "my-asg"
# (31 unchanged attributes hidden)
~ capacity_reservation_specification {
# (1 unchanged attribute hidden)
+ capacity_reservation_target {}
}
# (14 unchanged blocks hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
Actual Behavior
Unable to apply - provider crashes. See output.
Relevant Error/Panic Output
╷
│ Error: Request cancelled
│
│ with module.instance.aws_autoscaling_group.asg,
│ on instance/main.tf line 233, in resource "aws_autoscaling_group" "asg":
│ 233: resource "aws_autoscaling_group" "asg" {
│
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵
Stack trace from the terraform-provider-aws_v5.100.0_x5 plugin:
panic: interface conversion: interface {} is nil, not map[string]interface {}
goroutine 31 [running]:
github.com/hashicorp/terraform-provider-aws/internal/service/autoscaling.expandCapacityReservationSpecification(0x1400355c9f0)
github.com/hashicorp/terraform-provider-aws/internal/service/autoscaling/group.go:3484 +0x17c
github.com/hashicorp/terraform-provider-aws/internal/service/autoscaling.resourceGroupUpdate({0x11b3dac28, 0x1400355c630}, 0x1400287b380, {0x11b04e5c0, 0x140017f6d00})
github.com/hashicorp/terraform-provider-aws/internal/service/autoscaling/group.go:1469 +0x5f8
github.com/hashicorp/terraform-provider-aws/internal/provider.wrapResource.(*wrappedResource).update.interceptedHandler[...].func5(0x1400287b380, {0x11b04e5c0, 0x140017f6d00})
github.com/hashicorp/terraform-provider-aws/internal/provider/intercept.go:114 +0x2d8
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0x11b3dac28?, {0x11b3dac28?, 0x1400287ca20?}, 0xd?, {0x11b04e5c0?, 0x140017f6d00?})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:867 +0x64
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x14000406e00, {0x11b3dac28, 0x1400287ca20}, 0x14003180820, 0x1400287ae00, {0x11b04e5c0, 0x140017f6d00})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:979 +0x660
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x14003502eb8, {0x11b3dac28?, 0x1400287c960?}, 0x14002876230)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1188 +0xaa4
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0x140033e2c80, {0x11b3dac28?, 0x1400287c690?}, 0x14002876230)
github.com/hashicorp/[email protected]/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x184
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x14001d3d900, {0x11b3dac28?, 0x1400284db90?}, 0x14000e5c620)
github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:866 +0x2a8
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x11ae92560, 0x14001d3d900}, {0x11b3dac28, 0x1400284db90}, 0x14004e09500, 0x0)
github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:611 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x14001165600, {0x11b3dac28, 0x1400315d170}, 0x14002f070e0, 0x14001bc0330, 0x127605df8, 0x0)
google.golang.org/[email protected]/server.go:1405 +0xca8
google.golang.org/grpc.(*Server).handleStream(0x14001165600, {0x11b4131d8, 0x1400308a820}, 0x14002f070e0)
google.golang.org/[email protected]/server.go:1815 +0x910
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/[email protected]/server.go:1035 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 53
google.golang.org/[email protected]/server.go:1046 +0x13c
Error: The terraform-provider-aws_v5.100.0_x5 plugin crashed!
This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.
exit status 1
Sample Terraform Configuration
dynamic `capacity_reservation_specification` block within `aws_autoscaling_group`, where `capacity_reservation_target` defaults to`{}` if not specified.
Click to expand configuration
dynamic "capacity_reservation_specification" {
for_each = length(var.instance.capacity_reservation_specification) > 0 ? [1] : []
content {
capacity_reservation_preference = try(var.instance.capacity_reservation_specification.capacity_reservation_preference, null)
capacity_reservation_target {
capacity_reservation_ids = try(var.instance.capacity_reservation_specification.capacity_reservation_ids, null)
capacity_reservation_resource_group_arns = try(var.instance.capacity_reservation_specification.capacity_reservation_resource_group_arns, null)
}
}
}
Steps to Reproduce
- Create
aws_autoscaling_group
resource without specifyingcapacity_reservation_specification
. - Add dynamic
capacity_reservation_specification
block to return+ capacity_reservation_target {}
in plan. - Apply changes
Debug Logging
Click to expand log output
GenAI / LLM Assisted Development
n/a
Important Facts and References
No response
Would you like to implement a fix?
No