Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: GRPCProvider error when creating a aws_lightsail_instance #32430

Closed
zoenglinghou opened this issue Jul 9, 2023 · 9 comments · Fixed by #37587
Closed

[Bug]: GRPCProvider error when creating a aws_lightsail_instance #32430

zoenglinghou opened this issue Jul 9, 2023 · 9 comments · Fixed by #37587
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/lightsail Issues and PRs that pertain to the lightsail service.
Milestone

Comments

@zoenglinghou
Copy link

zoenglinghou commented Jul 9, 2023

Terraform Core Version

1.5.2

AWS Provider Version

5.7.0

Affected Resource(s)

  • aws_lightsail_instance

Expected Behavior

Instance would be created and Terraform would receive the correct feedback

Actual Behavior

Instance created, but Terraform raises an error and the new instance is not recorded in the terraform state.

Relevant Error/Panic Output Snippet

╷
│ Error: Request cancelled
│ 
│   with aws_lightsail_instance.nodes[0],
│   on lightsail.tf line 12, in resource "aws_lightsail_instance" "nodes":
│   12: resource "aws_lightsail_instance" "nodes" {
│ 
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

Stack trace from the terraform-provider-aws_v5.7.0_x5 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xf863ba]

goroutine 31 [running]:
github.com/hashicorp/terraform-provider-aws/internal/tags.(*TagData).ValueString(...)
        github.com/hashicorp/terraform-provider-aws/internal/tags/key_value_tags.go:671
github.com/hashicorp/terraform-provider-aws/internal/tags.KeyValueTags.ResolveDuplicates(0xc00084e2a0?, {0xf354260, 0xc00280ee40}, 0x0, 0xcc?, {0x7f098e7c4098, 0xc001d96b00})
        github.com/hashicorp/terraform-provider-aws/internal/tags/key_value_tags.go:780 +0x19a
github.com/hashicorp/terraform-provider-aws/internal/provider.tagsInterceptor.run({0xc0017d7960?, 0xe330458?, 0xe330450?}, {0xf354260, 0xc00280ee40}, {0xf35f588, 0xc001d96b00}, {0xe03eea0?, 0
xc001c7e340?}, 0x2, ...)
        github.com/hashicorp/terraform-provider-aws/internal/provider/intercept.go:353 +0x9c9
github.com/hashicorp/terraform-provider-aws/internal/provider.interceptedHandler[...].func1(0x0?, {0xe03eea0?, 0xc001c7e340?})
        github.com/hashicorp/terraform-provider-aws/internal/provider/intercept.go:120 +0x428
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xf354260?, {0xf354260?, 0xc0025ed650?}, 0xd?, {0xe03eea0?, 0xc001c7e340?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.27.0/helper/schema/resource.go:728 +0x87
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc001864fc0, {0xf354260, 0xc0025ed650}, 0xc002e55930, 0xc001d96980, {0xe03eea0, 0xc001c7e340})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.27.0/helper/schema/resource.go:864 +0xa7e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000551bd8, {0xf354260?, 0xc0025ed530?}, 0xc002d3e3c0)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.27.0/helper/schema/grpc_provider.go:1024 +0xe8d
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.muxServer.ApplyResourceChange({0xc001c633b0, 0xc00577b090, 0xc001c633e0, 0xc001c63410, {0xc002a27a80, 0x2, 0x2}}, {0xf354260?, 0xc0025ed
200?}, 0xc002d3e3c0)
        github.com/hashicorp/terraform-plugin-mux@v0.11.1/tf5muxserver/mux_server_ApplyResourceChange.go:30 +0x139
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc001c4fea0, {0xf354260?, 0xc0025ec810?}, 0xc000a791f0)
        github.com/hashicorp/terraform-plugin-go@v0.17.0/tfprotov5/tf5server/server.go:821 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xdd205a0?, 0xc001c4fea0}, {0xf354260, 0xc0025ec810}, 0xc000a790a0, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.17.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:422 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000a26000, {0xf361020, 0xc001d1c680}, 0xc0025aa900, 0xc001d17230, 0x16211480, 0x0)
        google.golang.org/grpc@v1.56.1/server.go:1337 +0xdf3
google.golang.org/grpc.(*Server).handleStream(0xc000a26000, {0xf361020, 0xc001d1c680}, 0xc0025aa900, 0x0)
        google.golang.org/grpc@v1.56.1/server.go:1714 +0xa36
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        google.golang.org/grpc@v1.56.1/server.go:959 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.56.1/server.go:957 +0x18c

Error: The terraform-provider-aws_v5.7.0_x5 plugin crashed!

Terraform Configuration Files

This is a snippet of the relevant resources:

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "5.6.2"
    }
  }
}

terraform {
  backend "s3" {
    bucket         = "***"
    key            = "***"
    region         = "eu-central-1"
    encrypt        = true
    dynamodb_table = "***"
  }
}

locals {
  node_count = 1
  aws_region = "ap-northeast-1"
  region_bundle_map = {
    ap-northeast-1 = "2_0"
    ap-southeast-1 = "2_0"
    eu-central-1   = "2_0"
    us-west-2      = "2_0"
  }
}

provider "aws" {
  # Configuration options
  region = local.aws_region
}

resource "aws_lightsail_key_pair" "key" {
  name       = "main"
  public_key = file("~/.ssh/id_ed25519.pub")
}

resource "aws_lightsail_instance" "nodes" {
  count             = local.node_count
  name              = "node_${count.index}"
  availability_zone = "${local.aws_region}d"
  blueprint_id      = "debian_11"
  bundle_id         = "nano_${local.region_bundle_map[local.aws_region]}"
  key_pair_name     = aws_lightsail_key_pair.key.id
  tags = {
    gost = ""
  }
}

Steps to Reproduce

  1. terraform init
  2. terraform apply -> yes
  3. terraform waits 40 seconds before the error is shown, while the instance is created on lightsail:
aws_lightsail_instance.nodes[0]: Creating...
aws_lightsail_instance.nodes[0]: Still creating... [10s elapsed]
aws_lightsail_instance.nodes[0]: Still creating... [20s elapsed]
aws_lightsail_instance.nodes[0]: Still creating... [30s elapsed]
aws_lightsail_instance.nodes[0]: Still creating... [40s elapsed]
  1. Same error when trying the import the created instance
  2. Same error for 5.6.2

Debug Output

stderr.gpg.log
stdout.gpg.log

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

@zoenglinghou zoenglinghou added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Jul 9, 2023
@github-actions
Copy link

github-actions bot commented Jul 9, 2023

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added crash Results from or addresses a Terraform crash or kernel panic. service/lightsail Issues and PRs that pertain to the lightsail service. labels Jul 9, 2023
@jainamshah102
Copy link

I am fairly new to open source contribution, can I pick up this issue?

@zoenglinghou
Copy link
Author

I am fairly new to open source contribution, can I pick up this issue?

I mean you can follow the issue, or if you have a fix...?

@jainamshah102
Copy link

I am debugging this issue and finding some probable fix.

@jar-b jar-b removed the needs-triage Waiting for first response or review from a maintainer. label Jul 10, 2023
@zoenglinghou
Copy link
Author

zoenglinghou commented Aug 20, 2023

The issue still persists for version 1.13.1

Is it something to do with error handling of timeout/retries?

@GertBurger
Copy link

I ran into the same error when attempting to import a lightsail database and I got around the issue by removing the tags it had, which were key-only tags.

Terraform v1.6.5
on linux_amd64

  • provider registry.terraform.io/hashicorp/aws v5.31.0

Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

Copy link

This functionality has been released in v5.52.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

github-actions bot commented Jul 1, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/lightsail Issues and PRs that pertain to the lightsail service.
Projects
None yet
4 participants