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]: d/aws_lambda_function issue in aws provider 5.23.0 #34131

Closed
jendave opened this issue Oct 27, 2023 · 16 comments · Fixed by #34134
Closed

[Bug]: d/aws_lambda_function issue in aws provider 5.23.0 #34131

jendave opened this issue Oct 27, 2023 · 16 comments · Fixed by #34134
Labels
bug Addresses a defect in current functionality. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/lambda Issues and PRs that pertain to the lambda service.
Milestone

Comments

@jendave
Copy link

jendave commented Oct 27, 2023

Terraform Core Version

1.5.5

AWS Provider Version

5.23.0

Affected Resource(s)

  • aws_lambda_function

Expected Behavior

Created lambda function. worked under 5.22.0

Actual Behavior

got error

Error: setting vpc_config: Invalid address to set: []string{"vpc_config", "0", "ipv6_allowed_for_dual_stack"}

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_lambda_function" "lambda" {
  function_name = var.function_name
  description   = var.description
  role          = aws_iam_role.lambda.arn
  image_uri     = var.image_uri
  timeout       = var.timeout
  memory_size   = var.memory_size
  package_type  = var.package_type
  tags          = merge(var.tags, local.tags, { Custodian_Lambda_Error_Exclude = "YES PLEASE" })
  environment {
    variables = merge(var.environment_variables, {
      CLOUDWATCH_LOG_GROUP_NAME = aws_cloudwatch_log_group.lambda.name
      ENVIRONMENT               = var.environment
      REGION                    = var.region
    })
  }

  vpc_config {
    subnet_ids                  = var.subnet_ids
    security_group_ids          = var.security_group_ids
  }
}

Steps to Reproduce

Ran the terraform code using AWS provider 5.22.0. It runs fine.
Under AWS provider 5.23.0 I get the error.

Reverting back to 5.22.0 resolves the issue

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@jendave jendave added the bug Addresses a defect in current functionality. label Oct 27, 2023
@github-actions github-actions bot added the service/lambda Issues and PRs that pertain to the lambda service. label Oct 27, 2023
@github-actions
Copy link

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.

@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Oct 27, 2023
@tb102122
Copy link

I get the same error when using

│ Error: setting vpc_config: Invalid address to set: []string{"vpc_config", "0", "ipv6_allowed_for_dual_stack"}

data "aws_lambda_function" "setup" {
  function_name = var.function_name
}

@jendave
Copy link
Author

jendave commented Oct 27, 2023

Yes. Thanks. I made a mistake in my original report. I created the lambda as above, then get the error when I used it as a data resource

data "aws_lambda_function" "lambda" {
  function_name = "${var.name}-${var.environment}-lambda"
}

@tb102122
Copy link

even after running the create lambda step with the provider 5.23 the error remains so my assumption is that the problem is in the data provider itself.

@watarukura
Copy link
Contributor

Me, too.
This error occurs data of lambda_function with VPC Lambda.
Regular Lambda, this error does not occur.

@grammeaway
Copy link

grammeaway commented Oct 27, 2023

To make matters more confusing, I'm experiencing this error, but without any patterns related to whether it's a VPC Lambda or not. Some VPC Lambdas deploy without any issues, some of them get this error.

@razvanonet
Copy link

razvanonet commented Oct 27, 2023

same for me, we're using data to get a lambda function and we get the same error

Error: setting vpc_config: Invalid address to set: []string{"vpc_config", "0", "ipv6_allowed_for_dual_stack"}

code:

data "aws_lambda_function" "target_lambda_function" {
  for_each = toset(local.lambda_function_needed)

  function_name = each.key
}

@felipem1210
Copy link

Same here with lambda with VPC config

@bechampion
Copy link

bechampion commented Oct 27, 2023

https://github.com/hashicorp/terraform-provider-aws/compare/v5.22.0..v5.23.0#diff-f133cf8f49371b1c6012c91c42f0d578f772c7d399b5a8a46ce941f55ae97424R414

if d.HasChanges("vpc_config.0.security_group_ids", "vpc_config.0.subnet_ids", "vpc_config.0.ipv6_allowed_for_dual_stack") {

@bechampion
Copy link

if you drop to 5.22.0 no issues , i guess I'll pin that version for now

@SebasAnasco1517
Copy link

Same for me, but in our case it shows the error when a lambda with a kafka trigger is created.

@ewbankkit ewbankkit added regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 27, 2023
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Oct 27, 2023
@ewbankkit
Copy link
Contributor

ewbankkit commented Oct 27, 2023

Relates #34045.

% make testacc TESTARGS='-run=TestAccLambdaFunctionDataSource_vpc$$' PKG=lambda
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/lambda/... -v -count 1 -parallel 20  -run=TestAccLambdaFunctionDataSource_vpc$ -timeout 360m
=== RUN   TestAccLambdaFunctionDataSource_vpc
=== PAUSE TestAccLambdaFunctionDataSource_vpc
=== CONT  TestAccLambdaFunctionDataSource_vpc
panic: Invalid address to set: []string{"vpc_config", "0", "ipv6_allowed_for_dual_stack"}

goroutine 1934 [running]:
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Set(0xc0001f0880, {0xec203cf, 0xa}, {0xc5c7ea0, 0xc002115470})
        /Users/ewbankkit/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:233 +0x291
github.com/hashicorp/terraform-provider-aws/internal/service/lambda.dataSourceFunctionRead({0xfffcee0, 0xc0018224e0}, 0xc0001f0880, {0xeba7520?, 0xc004692690})
        /Users/ewbankkit/altsrc.1/github.com/terraform-providers/terraform-provider-aws/internal/service/lambda/function_data_source.go:321 +0x1cd2
github.com/hashicorp/terraform-provider-aws/internal/provider.interceptedHandler[...].func1(0x0?, {0xeba7520?, 0xc004692690?})
        /Users/ewbankkit/altsrc.1/github.com/terraform-providers/terraform-provider-aws/internal/provider/intercept.go:111 +0x34b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xfffcee0?, {0xfffcee0?, 0xc000ff6d20?}, 0xd?, {0xeba7520?, 0xc004692690?})
        /Users/ewbankkit/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:790 +0x87
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).ReadDataApply(0xc004dc77a0, {0xfffcee0, 0xc000ff6d20}, 0xc0001f0480, {0xeba7520, 0xc004692690})
        /Users/ewbankkit/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:1015 +0x150
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadDataSource(0xc0067c5ef0, {0xfffcee0?, 0xc000be5e90?}, 0xc0052f2080)
        /Users/ewbankkit/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1237 +0x38f
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ReadDataSource(0xfffce38?, {0xfffcee0?, 0xc000be5bc0?}, 0xc0052f2080)
        /Users/ewbankkit/go/pkg/mod/github.com/hashicorp/[email protected]/tf5muxserver/mux_server_ReadDataSource.go:36 +0x1b5
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadDataSource(0xc004bd83c0, {0xfffcee0?, 0xc000be5410?}, 0xc0001bc320)
        /Users/ewbankkit/go/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:699 +0x403
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler({0xe926400?, 0xc004bd83c0}, {0xfffcee0, 0xc000be5410}, 0xc0004fc070, 0x0)
        /Users/ewbankkit/go/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:503 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0026903c0, {0x1000ab20, 0xc00656c340}, 0xc001ef4ea0, 0xc00654e4e0, 0x16642f68, 0x0)
        /Users/ewbankkit/go/pkg/mod/google.golang.org/[email protected]/server.go:1376 +0xdd2
google.golang.org/grpc.(*Server).handleStream(0xc0026903c0, {0x1000ab20, 0xc00656c340}, 0xc001ef4ea0, 0x0)
        /Users/ewbankkit/go/pkg/mod/google.golang.org/[email protected]/server.go:1753 +0xa36
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        /Users/ewbankkit/go/pkg/mod/google.golang.org/[email protected]/server.go:998 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        /Users/ewbankkit/go/pkg/mod/google.golang.org/[email protected]/server.go:996 +0x18c
FAIL    github.com/hashicorp/terraform-provider-aws/internal/service/lambda     214.807s
FAIL
make: *** [testacc] Error 1

@ewbankkit ewbankkit changed the title [Bug]: aws_lambda_function issue in aws provider 5.23.0 [Bug]: d/aws_lambda_function issue in aws provider 5.23.0 Oct 27, 2023
@prowlaiii
Copy link

prowlaiii commented Oct 27, 2023

Me too!
It's happening in several stacks.
I'll pin the provider version.

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

@github-actions github-actions bot added this to the v5.23.1 milestone Oct 27, 2023
@github-actions
Copy link

This functionality has been released in v5.23.1 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!

@github-actions github-actions bot removed the bug Addresses a defect in current functionality. label Oct 27, 2023
@ccassany
Copy link

Documents deployed on release 2023.43.0: Migration K8S to ECS

Copy link

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 Nov 30, 2023
@justinretzolk justinretzolk added the bug Addresses a defect in current functionality. label Feb 10, 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. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/lambda Issues and PRs that pertain to the lambda service.
Projects
None yet