Skip to content

fix: Fix S3 Bucket Notification Configuration Validation Error OBSSD-612#87

Merged
obs-gh-justindaines merged 1 commit into
mainfrom
jdaines/add_aws_lambda_permission_dependency
May 7, 2025
Merged

fix: Fix S3 Bucket Notification Configuration Validation Error OBSSD-612#87
obs-gh-justindaines merged 1 commit into
mainfrom
jdaines/add_aws_lambda_permission_dependency

Conversation

@obs-gh-justindaines

Copy link
Copy Markdown
Contributor

What does this PR do?

This pull request addresses InvalidArgument encountered creating the S3 bucket notification configuration. The error:

Error: creating S3 Bucket (<BUCKET>) Notification: operation error S3: PutBucketNotificationConfiguration, https response error StatusCode: 400, RequestID: <ID>, HostID: <HOST>, api error InvalidArgument: Unable to
validate the following destination configurations

  with module.<MODULE>.module.observe_lambda_s3_subscription.aws_s3_bucket_notification.notification[0],
  on .terraform/modules/<MODULE>.observe_lambda_s3_subscription/modules/s3_bucket_subscription/main.tf line 20, in
  resource "aws_s3_bucket_notification" "notification":
  20: resource "aws_s3_bucket_notification" "notification" {

The error occurred because aws_lambda_permission and aws_s3_bucket_notification were being created dynamically using count, without guaranteeing the correct creation order. S3 requires that the Lambda invoke permission (lambda:InvokeFunction) already exist and be fully propagated before the PutBucketNotificationConfiguration API call is made. Without this sequencing, AWS fails to validate the destination configuration, resulting in an InvalidArgument error during apply.

This update ensures that the S3 bucket notification is explicitly dependent on the Lambda permission using depends_on, enforcing the correct provisioning order.

Testing

Validated deploying new Lambda and ensuring InvalidArgument was not encountered.

Fix S3 Bucket Notification Configuration Validation Error OBSSD-612 to resolve

Error: creating S3 Bucket (<BUCKET>) Notification: operation error S3:
PutBucketNotificationConfiguration, https response error StatusCode: 400, RequestID: <ID>, HostID:
<HOST>, api error InvalidArgument: Unable to
validate the following destination configurations

  with module.<MODULE>.module.observe_lambda_s3_subscription.aws_s3_bucket_notification.notification[0],
  on .terraform/modules/<MODULE>.observe_lambda_s3_subscription/modules/s3_bucket_subscription/main.tf line 20, in
  resource "aws_s3_bucket_notification" "notification":
  20: resource "aws_s3_bucket_notification" "notification" {
@obs-gh-justindaines obs-gh-justindaines requested a review from a team May 7, 2025 13:50

@obs-gh-austinnixon obs-gh-austinnixon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good. very good explanation of the change and the purpose

@obs-gh-justindaines obs-gh-justindaines merged commit 1a4b6a2 into main May 7, 2025
16 checks passed
@obs-gh-justindaines obs-gh-justindaines deleted the jdaines/add_aws_lambda_permission_dependency branch February 23, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants