integrations / terraform-provider-github

Terraform GitHub provider
https://www.terraform.io/docs/providers/github/
MIT License
905 stars 746 forks source link

[BUG]: github_release resource creates drift, leading to provider error #2062

Closed simpl-sam closed 1 month ago

simpl-sam commented 10 months ago

Expected Behavior

When applying the github_release resource with the argument generate_release_notes set to true, the release would be created and subsequent plans to terraform plan would show the body value to now contain the generated release notes and the generate_release_notes flag is set to false.

Setting the body and generate_release_notes arguments in the Terraform template to match the delta, will cause a subsequent plan to report "no changes"

Actual Behavior

The delta is still being seen as a change, but not presenting what is different (might be tabs vs spaces or something like that)

Applying the changes produces a provider error

Terraform Version

v1.6.3

Affected Resource(s)

Terraform Configuration Files

No response

Steps to Reproduce

Debug Output

No response

Panic Output

╷
│ Error: Plugin did not respond
│ 
│   with module.repository.github_release.v1_0_0,
│   on modules/repository/releases.tf line 21, in resource "github_release" "v1_0_0":
│   21: resource "github_release" "v1_0_0" {
│ 
│ The plugin encountered an error, and failed to respond to the
│ plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may
│ contain more details.
╵
╷
│ Error: Plugin did not respond
│ 
│   with module.repository.github_release.v1_1_0,
│   on modules/repository/releases.tf line 4, in resource "github_release" "v1_1_0":
│    4: resource "github_release" "v1_1_0" {
│ 
│ The plugin encountered an error, and failed to respond to the
│ plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may
│ contain more details.
╵

Stack trace from the terraform-provider-github_v5.42.0 plugin:

panic: interface conversion: interface {} is nil, not int64

goroutine 85 [running]:
github.com/integrations/terraform-provider-github/v5/github.resourceGithubReleaseCreateUpdate(0xc00054e2a0, {0x10c4100?, 0xc000786580?})
        github.com/integrations/terraform-provider-github/v5/github/resource_github_release.go:134 +0xafa
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc0005b6960, 0xc0008d20f0, 0xc0008d8680, {0x10c4100, 0xc000786580})
        github.com/hashicorp/terraform-plugin-sdk@v1.17.2/helper/schema/resource.go:326 +0x5e3
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc00058a400, 0xc0009078e8, 0x136789d?, 0xf?)
        github.com/hashicorp/terraform-plugin-sdk@v1.17.2/helper/schema/provider.go:294 +0x6a
github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc00008b238, {0xc0006843f0?, 0x4c3b06?}, 0xc0006843f0)
        github.com/hashicorp/terraform-plugin-sdk@v1.17.2/internal/helper/plugin/grpc_provider.go:895 +0x7c5
github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1309dc0?, 0xc00008b238}, {0x17246d0, 0xc0008b7470}, 0xc000684380, 0x0)
        github.com/hashicorp/terraform-plugin-sdk@v1.17.2/internal/tfplugin5/tfplugin5.pb.go:3305 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0005d0000, {0x1729e10, 0xc0001de000}, 0xc0008c67e0, 0xc0005cb020, 0x2041d60, 0x0)
        google.golang.org/grpc@v1.56.3/server.go:1335 +0xde7
google.golang.org/grpc.(*Server).handleStream(0xc0005d0000, {0x1729e10, 0xc0001de000}, 0xc0008c67e0, 0x0)
        google.golang.org/grpc@v1.56.3/server.go:1712 +0x9e7
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        google.golang.org/grpc@v1.56.3/server.go:947 +0xbb
created by google.golang.org/grpc.(*Server).serveStreams.func1 in goroutine 25
        google.golang.org/grpc@v1.56.3/server.go:958 +0x145

Error: The terraform-provider-github_v5.42.0 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.

Operation failed: failed running terraform apply (exit 1)

Code of Conduct

github-actions[bot] commented 1 month ago

👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!