hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.77k stars 9.12k forks source link

[Bug]: Cannot update VIRTUAL_HOST on aws_lambda_event_source_mapping #38288

Open PauloJMF opened 3 months ago

PauloJMF commented 3 months ago

Terraform Core Version

1.5.3

AWS Provider Version

5.49.0

Affected Resource(s)

aws_lambda_event_source_mapping

Expected Behavior

While updating the VIRTUAL_HOST property on a aws_lambda_event_source_mapping, the provider should destroy and then create replacement since the VIRTUAL_HOST property cannot be updated on a UpdateEventSourceMapping API call.

Actual Behavior

While updating the VIRTUAL_HOST property on a aws_lambda_event_source_mapping. Terraform plan runs successfully but fails to apply while trying to do a update in place

Relevant Error/Panic Output Snippet

Error: updating Lambda Event Source Mapping (xx-xx): operation error Lambda: UpdateEventSourceMapping, https response error StatusCode: 400, RequestID: yy-yy, InvalidParameterValueException: Invalid parameters: VIRTUAL_HOST

Terraform Configuration Files

resource "aws_lambda_event_source_mapping" "rabbitmq_sync_customer_source_mapping" {
  event_source_arn = data.aws_mq_broker.rabbitmq.arn
  queues = [
    "queue.name"
  ]
  batch_size    = "1"
  function_name = "lambda-name"
  enabled       = true

  source_access_configuration {
    type = "VIRTUAL_HOST"
    uri  = "/example"
  }

  source_access_configuration {
    type = "BASIC_AUTH"
    uri  = rabbitmq_basic_auth_secret_manager.aws_secret_manager_arn
  }
}

Steps to Reproduce

  1. Create a aws_lambda_event_source_mapping using RabbitMQ
  2. Change the VIRTUAL_HOST uri value in source_access_configuration

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

https://docs.aws.amazon.com/cli/latest/reference/lambda/update-event-source-mapping.html

Would you like to implement a fix?

None

github-actions[bot] commented 3 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue