sebastianmarines / terraform-provider-twitter

Terraform provider for Twitter
https://registry.terraform.io/providers/sebastianmarines/twitter/latest
Mozilla Public License 2.0
6 stars 1 forks source link

Error: panic: runtime error: invalid memory address or nil pointer dereference #11

Open saurbhc opened 1 year ago

saurbhc commented 1 year ago

main.tf file:

$ cat main.tf
terraform {
  required_providers {
    twitter = {
      source = "sebastianmarines/twitter"
      version = "0.1.3"
    }
  }
}

provider "twitter" {
  # Configuration options
  api_key             = "*"
  api_secret_key          = "*"
  # bearer_token        = "*"
  access_token        = "*"
  access_token_secret = "*"
}

resource "twitter_tweet" "tweet" {
  text = "Hello from my Terraform provider!"
}

Error stacktrace:

$ terraform apply

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # twitter_tweet.tweet will be created
  + resource "twitter_tweet" "tweet" {
      + favorite_count        = (known after apply)
      + id                    = (known after apply)
      + in_reply_to_status_id = (known after apply)
      + in_reply_to_user_id   = (known after apply)
      + lang                  = (known after apply)
      + possibly_sensitive    = (known after apply)
      + quote_count           = (known after apply)
      + quoted_status_id      = (known after apply)
      + reply_count           = (known after apply)
      + retweet_count         = (known after apply)
      + source                = (known after apply)
      + text                  = "Hello from my Terraform provider!"
      + user_id               = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

twitter_tweet.tweet: Creating...
╷
│ Error: Plugin did not respond
│
│ The plugin encountered an error, and failed to respond to the plugin6.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-twitter_v0.1.3 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x70 pc=0x104cf5928]

goroutine 16 [running]:
github.com/sebastianmarines/terraform-provider-twitter/internal/provider.tweetResource.Create({{{0x140000b60e0, 0x1400000e008, 0x14000030150, 0x1400000e018, 0x1400000e028, 0x1400000e030, 0x1400000e038, 0x1400000e040, 0x1400000e048, 0x1400000e050, ...}, ...}}, ...)
    github.com/sebastianmarines/terraform-provider-twitter/internal/provider/tweet_resource.go:162 +0x238
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).CreateResource(0x1400035cc60, {0x104f6e760, 0x1400031f830}, 0x14000159380, 0x140001592c8)
    github.com/hashicorp/terraform-plugin-framework@v0.9.0/internal/fwserver/server_createresource.go:79 +0x478
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ApplyResourceChange(0x104f6e760?, {0x104f6e760, 0x1400031f830}, 0x140002d1830, 0x14000159560)
    github.com/hashicorp/terraform-plugin-framework@v0.9.0/internal/fwserver/server_applyresourcechange.go:51 +0x408
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ApplyResourceChange(0x1400035cc60, {0x104f6e760?, 0x1400031f740?}, 0x14000140960)
    github.com/hashicorp/terraform-plugin-framework@v0.9.0/internal/proto6server/server_applyresourcechange.go:52 +0x184
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0x14000322640, {0x104f6e760?, 0x1400031f020?}, 0x140003a0a80)
    github.com/hashicorp/terraform-plugin-go@v0.11.0/tfprotov6/tf6server/server.go:811 +0x370
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x104f41560?, 0x14000322640}, {0x104f6e760, 0x1400031f020}, 0x1400019fa40, 0x0)
    github.com/hashicorp/terraform-plugin-go@v0.11.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:385 +0x174
google.golang.org/grpc.(*Server).processUnaryRPC(0x140003788c0, {0x104f71398, 0x1400029e1a0}, 0x140002ce7e0, 0x140003ddcb0, 0x105362900, 0x0)
    google.golang.org/grpc@v1.47.0/server.go:1283 +0xb64
google.golang.org/grpc.(*Server).handleStream(0x140003788c0, {0x104f71398, 0x1400029e1a0}, 0x140002ce7e0, 0x0)
    google.golang.org/grpc@v1.47.0/server.go:1620 +0x840
google.golang.org/grpc.(*Server).serveStreams.func1.2()
    google.golang.org/grpc@v1.47.0/server.go:922 +0x88
created by google.golang.org/grpc.(*Server).serveStreams.func1
    google.golang.org/grpc@v1.47.0/server.go:920 +0x298

Error: The terraform-provider-twitter_v0.1.3 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.
sebastianmarines commented 1 year ago

Hi @saurbhc, I'm not able to reproduce this bug. Can you run TF_LOG=TRACE terraform apply and provide me with the logs? Can you also provide me with the Terraform version you are using?

saurbhc commented 1 year ago

Hi @sebastianmarines, Thanks for the reply

Version is v1.3.1

$ terraform version
Terraform v1.3.1
on darwin_arm64
+ provider registry.terraform.io/sebastianmarines/twitter v0.1.3

Your version of Terraform is out of date! The latest version
is 1.3.2. You can update by downloading from https://www.terraform.io/downloads.html

Logs are here: https://raw.githubusercontent.com/saurbhc/terraform-provider-twitter/saurabh/logs/tf_logs.log