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

Expanding aws_lambda_event_source_mapping cannot apply new event_source_arn string #20092

Closed
mdenobrega-eb opened this issue Jul 7, 2021 · 2 comments · Fixed by #27664
Closed
Labels
bug Addresses a defect in current functionality. service/dynamodb Issues and PRs that pertain to the dynamodb service. service/lambda Issues and PRs that pertain to the lambda service.
Milestone

Comments

@mdenobrega-eb
Copy link

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.11
hashicorp/aws v3.48.0

Affected Resource(s)

  • aws_lambda_event_source_mapping

Terraform Configuration Files

data "archive_file" "my_function_file" {
  type             = "zip"
  source_file      = "my_function.js"
  output_file_mode = "0666"
  output_path      = "my_function.zip"
}

resource "aws_dynamodb_table" "my_table" {
  name             = "MyTable"
  hash_key         = "MyTableId"
  billing_mode     = "PAY_PER_REQUEST"
  stream_enabled   = true
  stream_view_type = "NEW_AND_OLD_IMAGES"

  attribute {
    name = "MyTableId"
    type = "S"
  }
}

resource "aws_lambda_function" "my_function" {
  filename         = data.archive_file.my_function_file.output_path
  function_name    = "my_function"
  role             = aws_iam_role.iam_for_lambda.arn
  handler          = "index.handler"
  runtime          = "nodejs12.x"
  source_code_hash = data.archive_file.my_function_file.output_base64sha256
}

resource "aws_lambda_event_source_mapping" "events_source_for_lambda" {
  event_source_arn  = aws_dynamodb_table.my_table.stream_arn
  function_name     = aws_lambda_function.my_function.arn
  starting_position = "LATEST"
}

Debug Output

Expected Behavior

Should create a DynamoDB table with streams enabled and a Lambda function which source data is the DynamoDB stream

Actual Behavior

I get the following message:

When expanding the plan for
module.lambda.aws_lambda_event_source_mapping.events_source_for_lambda to
include new values learned so far during apply, provider
"registry.terraform.io/hashicorp/aws" produced an invalid new value for
.event_source_arn: was
cty.StringVal("arn:aws:dynamodb:us-east-1:063955995565:table/MyTable/stream/2021-07-07T10:13:31.769"),
but now
cty.StringVal("arn:aws:dynamodb:us-east-1:063955995565:table/MyTable/stream/2021-07-07T10:37:52.930").

This is a bug in the provider, which should be reported in the provider's own
issue tracker.

Steps to Reproduce

  1. terraform apply

Important Factoids

I was able to apply this code during the next (second) run w/o any issues. Seems Lambda is published during the first run and event_source_arn is not, on the second run event_source_arn is able to be set and everything is fine.

Plan operation is ok during both runs.

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. bug Addresses a defect in current functionality. service/dynamodb Issues and PRs that pertain to the dynamodb service. service/lambda Issues and PRs that pertain to the lambda service. labels Jul 7, 2021
@gdavison gdavison removed the needs-triage Waiting for first response or review from a maintainer. label Jul 9, 2021
@ewbankkit ewbankkit added service/dynamodb Issues and PRs that pertain to the dynamodb service. and removed service/dynamodb Issues and PRs that pertain to the dynamodb service. labels Sep 1, 2022
@github-actions github-actions bot added this to the v4.39.0 milestone Nov 7, 2022
@github-actions
Copy link

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

@github-actions
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 Dec 11, 2022
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. service/dynamodb Issues and PRs that pertain to the dynamodb service. service/lambda Issues and PRs that pertain to the lambda service.
Projects
None yet
3 participants