terraform-provider-aws: [Bug]: d/aws_lambda_function issue in aws provider 5.23.0

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

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Reactions: 32
  • Comments: 16 (2 by maintainers)

Most upvoted comments

Relates https://github.com/hashicorp/terraform-provider-aws/pull/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/v2@v2.29.0/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/v2@v2.29.0/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/v2@v2.29.0/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/v2@v2.29.0/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/terraform-plugin-mux@v0.12.0/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/terraform-plugin-go@v0.19.0/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/terraform-plugin-go@v0.19.0/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/grpc@v1.58.2/server.go:1376 +0xdd2
google.golang.org/grpc.(*Server).handleStream(0xc0026903c0, {0x1000ab20, 0xc00656c340}, 0xc001ef4ea0, 0x0)
        /Users/ewbankkit/go/pkg/mod/google.golang.org/grpc@v1.58.2/server.go:1753 +0xa36
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        /Users/ewbankkit/go/pkg/mod/google.golang.org/grpc@v1.58.2/server.go:998 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        /Users/ewbankkit/go/pkg/mod/google.golang.org/grpc@v1.58.2/server.go:996 +0x18c
FAIL    github.com/hashicorp/terraform-provider-aws/internal/service/lambda     214.807s
FAIL
make: *** [testacc] Error 1

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