File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ module "lambda_function" {
2626 source_path = " ${ path . module } /../fixtures/python3.8-app1"
2727
2828 store_on_s3 = true
29- s3_bucket = module. s3_bucket . this_s3_bucket_id
29+ s3_bucket = module. s3_bucket . s3_bucket_id
3030
3131 layers = [
3232 module . lambda_layer_local . this_lambda_layer_arn ,
@@ -183,7 +183,7 @@ module "lambda_layer_s3" {
183183 source_path = " ${ path . module } /../fixtures/python3.8-app1"
184184
185185 store_on_s3 = true
186- s3_bucket = module. s3_bucket . this_s3_bucket_id
186+ s3_bucket = module. s3_bucket . s3_bucket_id
187187}
188188
189189# #############
Original file line number Diff line number Diff line change @@ -83,7 +83,11 @@ resource "aws_lambda_function" "this" {
8383
8484 tags = var. tags
8585
86- depends_on = [null_resource. archive , aws_s3_bucket_object . lambda_package ]
86+ # Depending on the log group is necessary to allow Terraform to create the log group before AWS can.
87+ # When a lambda function is invoked, AWS creates the log group automatically if it doesn't exist yet.
88+ # Without the dependency, this can result in a race condition if the lambda function is invoked before
89+ # Terraform can create the log group.
90+ depends_on = [null_resource. archive , aws_s3_bucket_object . lambda_package , aws_cloudwatch_log_group . lambda ]
8791}
8892
8993resource "aws_lambda_layer_version" "this" {
You can’t perform that action at this time.
0 commit comments