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

Crash when importing aws_lambda_function with container #17565

Closed
marcosdiez opened this issue Feb 11, 2021 · 4 comments
Closed

Crash when importing aws_lambda_function with container #17565

marcosdiez opened this issue Feb 11, 2021 · 4 comments
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/lambda Issues and PRs that pertain to the lambda service.

Comments

@marcosdiez
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • 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
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v0.14.6
+ provider registry.terraform.io/hashicorp/aws v3.27.0

Affected Resource(s)

  • aws_lambda_function

Terraform Configuration Files

provider "aws" {
  region = "us-east-1"
}

resource "aws_lambda_function" "userapi" {
  filename      = "lambda_function_payload.zip"
  function_name = "lambda_function_name"
  role          = "xpto"
  handler       = "exports.test"

  source_code_hash = "aaa"

  runtime = "nodejs12.x"
}

Debug Output

PLEASE NOTICE THE ISSUE IS WITH TERRAFORM IMPORT
https://gist.github.com/marcosdiez/fa6b88af92aaba21e3876b2b4490ad99

Panic Output

https://gist.github.com/marcosdiez/fa6b88af92aaba21e3876b2b4490ad99

Expected Behavior

it should have imported my resource

Actual Behavior

it crashed

Steps to Reproduce

  1. terraform14 import aws_lambda_function.userapi arn:aws:lambda:us-east-1:123456789012:function:my-lambda-function

Important Factoids

this lambda function uses containers. Here is it's arn:

{
    "Configuration": {
        "FunctionName": "my-lambda-function",
        "FunctionArn": "arn:aws:lambda:us-east-1:123456789012:function:my-lambda-function",
        "Role": "arn:aws:iam::123456789012:role/service-role/my-lambda-function-role-24axnoc8",
        "CodeSize": 0,
        "Description": "",
        "Timeout": 3,
        "MemorySize": 128,
        "LastModified": "2021-02-11T12:44:30.667+0000",
        "CodeSha256": "4166daa2a43b1e714b1998791000e837bc7222d400116ee79e7627eb213c6db3",
        "Version": "$LATEST",
        "TracingConfig": {
            "Mode": "PassThrough"
        },
        "RevisionId": "8d90c560-3b72-4417-af38-fadd472e131d",
        "State": "Active",
        "LastUpdateStatus": "Successful"
    },
    "Code": {
        "RepositoryType": "ECR"
    }
}
@ghost ghost added the service/lambda Issues and PRs that pertain to the lambda service. label Feb 11, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Feb 11, 2021
@marcosdiez
Copy link
Contributor Author

It seems this is the fix: #17082

@ewbankkit
Copy link
Contributor

Relevant portion of crash log:

2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5: panic: runtime error: invalid memory address or nil pointer dereference
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4877a02]
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5:
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5: goroutine 102 [running]:
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5: github.com/terraform-providers/terraform-provider-aws/aws.flattenLambdaImageConfig(...)
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-aws/aws/resource_aws_lambda_function.go:1322
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5: github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsLambdaFunctionRead(0xc001eb6d00, 0x5b279a0, 0xc001298580, 0xa6eecc0, 0x6955b08)
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-aws/aws/resource_aws_lambda_function.go:724 +0x2f62
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc0006946c0, 0x727d600, 0xc0015cce80, 0xc001eb6d00, 0x5b279a0, 0xc001298580, 0x0, 0x0, 0x0)
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5:  /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.4.2/helper/schema/resource.go:290 +0x88
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc0006946c0, 0x727d600, 0xc0015cce80, 0xc000a98930, 0x5b279a0, 0xc001298580, 0xc0018a8928, 0x0, 0x0, 0x0)
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5:  /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.4.2/helper/schema/resource.go:564 +0x1cb
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc000f486c0, 0x727d600, 0xc0015cce80, 0xc0015ccec0, 0xc0015cce80, 0x637dde0, 0x661d2c0)
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5:  /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.4.2/helper/schema/grpc_provider.go:575 +0x43b
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5: github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ReadResource(0xc000b852c0, 0x727d600, 0xc0015cce80, 0xc001d81c80, 0xc000b852c0, 0xc001edf470, 0xc00106cba0)
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5:  /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.2.1/tfprotov5/server/server.go:298 +0x105
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5: github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler(0x661d2c0, 0xc000b852c0, 0x727d6c0, 0xc001edf470, 0xc001d81c20, 0x0, 0x727d6c0, 0xc001edf470, 0xc001ef4600, 0x2ef)
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5:  /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.2.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:344 +0x214
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5: google.golang.org/grpc.(*Server).processUnaryRPC(0xc00029ee00, 0x72a0660, 0xc0010d1b00, 0xc001e9e200, 0xc0005de4e0, 0xa6ad570, 0x0, 0x0, 0x0)
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5:  /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:1194 +0x522
2021-02-11T10:04:32.520-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5: google.golang.org/grpc.(*Server).handleStream(0xc00029ee00, 0x72a0660, 0xc0010d1b00, 0xc001e9e200, 0x0)
2021-02-11T10:04:32.521-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5:  /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:1517 +0xd05
2021-02-11T10:04:32.521-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5: google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000b82b40, 0xc00029ee00, 0x72a0660, 0xc0010d1b00, 0xc001e9e200)
2021-02-11T10:04:32.521-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5:  /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:859 +0xa5
2021-02-11T10:04:32.521-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5: created by google.golang.org/grpc.(*Server).serveStreams.func1
2021-02-11T10:04:32.521-0300 [DEBUG] plugin.terraform-provider-aws_v3.27.0_x5:  /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:857 +0x1fd

@ewbankkit ewbankkit added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. and removed needs-triage Waiting for first response or review from a maintainer. labels Feb 11, 2021
@ewbankkit
Copy link
Contributor

@marcosdiez Thanks for raising this issue.
It has already been noticed in #17081. I'm going to close this one as a duplicate so that we can concentrate discussion in the linked issue.
Please add any additional comments there.

@ghost
Copy link

ghost commented Mar 13, 2021

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Mar 13, 2021
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/lambda Issues and PRs that pertain to the lambda service.
Projects
None yet
Development

No branches or pull requests

2 participants