Skip to content

Commit 3034deb

Browse files
author
João Taveira Araújo
authored
fix: address snapshot race (#75)
We need to ensure we only invoke the snapshot lambda once we have the appropriate permission. Since we depend on the eventbridge target, we should ensure the target is only installed after the lambda permission has been configured. We also update the version constraint on `aws` to reflect the use of `aws_lambda_invocation` which was only introduced in 3.72.0
1 parent 8fd6b3f commit 3034deb

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

modules/snapshot/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ module "observe_lambda_snapshot_b" {
9494
| Name | Version |
9595
|------|---------|
9696
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.1.0 |
97-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.68 |
97+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.73 |
9898

9999
## Providers
100100

101101
| Name | Version |
102102
|------|---------|
103-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 2.68 |
103+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.73 |
104104

105105
## Modules
106106

modules/snapshot/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ resource "aws_cloudwatch_event_target" "target" {
5151
overrides = var.overrides
5252
}
5353
})
54+
55+
depends_on = [aws_lambda_permission.this]
5456
}
5557

5658
resource "aws_lambda_permission" "this" {
@@ -68,4 +70,3 @@ resource "aws_lambda_invocation" "snapshot" {
6870

6971
input = aws_cloudwatch_event_target.target.input
7072
}
71-

modules/snapshot/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 2.68"
7+
version = ">= 3.73"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)