fix: Fix S3 Bucket Notification Configuration Validation Error OBSSD-612#87
Merged
obs-gh-justindaines merged 1 commit intoMay 7, 2025
Merged
Conversation
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-austinnixon
approved these changes
May 7, 2025
obs-gh-austinnixon
left a comment
There was a problem hiding this comment.
Changes look good. very good explanation of the change and the purpose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This pull request addresses
InvalidArgumentencountered creating the S3 bucket notification configuration. The error:The error occurred because
aws_lambda_permissionandaws_s3_bucket_notificationwere 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 thePutBucketNotificationConfigurationAPI call is made. Without this sequencing, AWS fails to validate the destination configuration, resulting in anInvalidArgumenterror 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.