Open abeluck opened 1 year ago
Voting for Prioritization
Volunteering to Work on This Issue
Just hit this same issue, whats worse is my infra is stuck in a half deployed state and im going to need to make some Open State Surgery just to get Terraform to work as both Apply/Destroy Fail with this error
To add some context;
My issue occurred because in the Launch Template
I had provided both a network_interface
and a vpc_security_group_ids
which resulted in a failure in resource aws_gamelift_game_server_group example
which uses the Launch Template
Upon removing the network_Interface
my state now shows the resource resource aws_gamelift_game_server_group example
but terraform destroy
or comment the resource out then terraform apply
does not fix it and results in the above mentioned panic. The next logical step to unjam my state was to try removing it directly from the state terraform state rm module.gamelift_fleet_iq.aws_gamelift_game_server_group.example
which did allow me to get back to developing.
In the interim I will probably use a local to create the game server group via an api/cli call or potentially create it via a golang application, will update here if I get any success.
As a way to deal with these symptoms I recommend including this block of code in the game_server_group
resource.
it does 2 things.
This combination prevents the scenarios where the Game Server Group Resource causes a panic
Yes I used the term Thermonuclear
lifecycle {
replace_triggered_by = [aws_launch_template.gamelift_server_group.id]
precondition {
condition = contains([aws_launch_template.gamelift_server_group.id],"lt-") ? false : true
error_message = "Launch Template was not created, failing to prevent Game Server Group going thermonuclear"
}
}
As additional context I had run into this error and it was because the version I had provided in the launch template was $latest instead of $Latest
Invalid launch template version: either '$Default', '$Latest', or a numeric version are allowed.
Just needed to set log level to debug in tf to see the issue unfortunately
It's been a little over a year and we still have this problem:
Stack trace from the terraform-provider-aws_v5.45.0_x5 plugin:
panic: interface conversion: interface {} is nil, not string
goroutine 1616 [running]:
github.com/hashicorp/terraform-provider-aws/internal/service/gamelift.resourceGameServerGroupCreate({0x137d2248?, 0xc002a0cd20}, 0xc003021700, {0x11c26640?, 0xc002b62340})
github.com/hashicorp/terraform-provider-aws/internal/service/gamelift/game_server_group.go:248 +0xf92
github.com/hashicorp/terraform-provider-aws/internal/provider.New.(*wrappedResource).Create.interceptedHandler[...].func8(0x0?, {0x11c26640?, 0xc002b62340?})
github.com/hashicorp/terraform-provider-aws/internal/provider/intercept.go:113 +0x283
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x137d2248?, {0x137d2248?, 0xc002ea21b0?}, 0xd?, {0x11c26640?, 0xc002b62340?})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:773 +0x7a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0016596c0, {0x137d2248, 0xc002ea21b0}, 0xc002b62a90, 0xc003021580, {0x11c26640, 0xc002b62340})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:909 +0xa89
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc002b660d8, {0x137d2248?, 0xc002ea20c0?}, 0xc0002bdea0)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/grpc_provider.go:1078 +0xdbc
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0x137d2280?, {0x137d2248?, 0xc002689da0?}, 0xc0002bdea0)
github.com/hashicorp/terraform-plugin-mux@v0.15.0/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc000b3d360, {0x137d2248?, 0xc002689560?}, 0xc001fb9dc0)
github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov5/tf5server/server.go:846 +0x3d0
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x119c4220?, 0xc000b3d360}, {0x137d2248, 0xc002689560}, 0xc003021180, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc001638a00, {0x137d2248, 0xc0026894d0}, {0x13811438, 0xc002c8a1a0}, 0xc002300b40, 0xc002c063f0, 0x1bc77798, 0x0)
google.golang.org/grpc@v1.62.1/server.go:1386 +0xe23
google.golang.org/grpc.(*Server).handleStream(0xc001638a00, {0x13811438, 0xc002c8a1a0}, 0xc002300b40)
google.golang.org/grpc@v1.62.1/server.go:1797 +0x100c
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/grpc@v1.62.1/server.go:1027 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 52
google.golang.org/grpc@v1.62.1/server.go:1038 +0x135
Error: The terraform-provider-aws_v5.45.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.
This crash isn't just annoying, it can totally corrupt your state file because resources will be created but not recorded in the state, leading to the need for massive state surgery.
(and FWIW @kurtislamb's workaround is applied, but now there is another crash)
Terraform Core Version
1.3.8
AWS Provider Version
4.56.0
Affected Resource(s)
Expected Behavior
The game lift game server group should be created.
Actual Behavior
It crashed
Relevant Error/Panic Output Snippet
Terraform Configuration Files
Steps to Reproduce
Debug Output
Full log: log.asc.txt
Panic Output
No response
Important Factoids
No response
References
This is possibly related to https://github.com/hashicorp/terraform-provider-aws/issues/29758
Would you like to implement a fix?
No