aboutsummaryrefslogtreecommitdiffstats
path: root/terraform/events.tf
diff options
context:
space:
mode:
authorAlex Schofield <git@ajschof.me>2024-08-19 23:07:28 +0100
committerAlex Schofield <git@ajschof.me>2024-08-19 23:07:28 +0100
commitb8574d4c4bf262a8034d21b770fd4287022c2648 (patch)
tree36e91d196cad1a16bc32c4abac7845be89ff4853 /terraform/events.tf
parenta8ce060732ed3064696f2d6c5459ffa176fd02f7 (diff)
downloadde-project-bentley-b8574d4c4bf262a8034d21b770fd4287022c2648.tar.gz
de-project-bentley-b8574d4c4bf262a8034d21b770fd4287022c2648.zip
fix(tf): re-add separate random_string suffixes in events.tf
Diffstat (limited to 'terraform/events.tf')
-rw-r--r--terraform/events.tf26
1 files changed, 19 insertions, 7 deletions
diff --git a/terraform/events.tf b/terraform/events.tf
index 9885a86..53ae10a 100644
--- a/terraform/events.tf
+++ b/terraform/events.tf
@@ -2,7 +2,19 @@
# Random String #
#################
-resource "random_string" "suffix" {
+resource "random_string" "eventbridge_suffix" {
+ length = 8
+ special = false
+ upper = false
+}
+
+resource "random_string" "s3_ingestion_suffix" {
+ length = 8
+ special = false
+ upper = false
+}
+
+resource "random_string" "s3_transform_suffix" {
length = 8
special = false
upper = false
@@ -26,7 +38,7 @@ resource "aws_cloudwatch_event_target" "extract_lambda_cw_event" {
}
resource "aws_lambda_permission" "allow_eventbridge" {
- statement_id = "AllowExecutionFromEventBridge${random_string.suffix.result}"
+ statement_id = "AllowExecutionFromEventBridge${random_string.eventbridge_suffix.result}"
action = "lambda:InvokeFunction"
function_name = aws_lambda_function.extract_lambda.function_name
principal = "events.amazonaws.com"
@@ -34,7 +46,7 @@ resource "aws_lambda_permission" "allow_eventbridge" {
lifecycle {
create_before_destroy = true
- replace_triggered_by = [random_string.suffix]
+ replace_triggered_by = [random_string.eventbridge_suffix]
}
}
@@ -43,7 +55,7 @@ resource "aws_lambda_permission" "allow_eventbridge" {
########################################
resource "aws_lambda_permission" "allow_s3_ingestion" {
- statement_id = "AllowS3InvokeLambdaTransform${random_string.suffix.result}"
+ statement_id = "AllowS3InvokeLambdaTransform${random_string.s3_ingestion_suffix.result}"
action = "lambda:InvokeFunction"
function_name = aws_lambda_function.transform_lambda.function_name
principal = "s3.amazonaws.com"
@@ -51,7 +63,7 @@ resource "aws_lambda_permission" "allow_s3_ingestion" {
lifecycle {
create_before_destroy = true
- replace_triggered_by = [random_string.suffix]
+ replace_triggered_by = [random_string.s3_ingestion_suffix]
}
}
@@ -72,7 +84,7 @@ resource "aws_s3_bucket_notification" "extract_bucket_notification" {
##########################################
resource "aws_lambda_permission" "allow_s3_transform_bucket" {
- statement_id = "AllowS3InvokeLambdaTransform${random_string.suffix.result}"
+ statement_id = "AllowS3InvokeLambdaTransform${random_string.s3_transform_suffix.result}"
action = "lambda:InvokeFunction"
function_name = aws_lambda_function.transform_lambda.function_name
principal = "s3.amazonaws.com"
@@ -80,7 +92,7 @@ resource "aws_lambda_permission" "allow_s3_transform_bucket" {
lifecycle {
create_before_destroy = true
- replace_triggered_by = [random_string.suffix]
+ replace_triggered_by = [random_string.s3_transform_suffix]
}
}
git.ajschof.me — hosted by ajschofield — powered by cgit