I'm running into an issue with
terraform-aws-datadog-lambda-forwarder, where the
aws_lambda_permission.allow_s3_bucket attribute is barfing on bucket names that contain periods.
Bucket names can contain any characters that are valid for FQDNs, the use of the raw bucket name in the
aws_lambda_permission.allow_s3_bucket.statement_id attribute allows invalid characters, specifically the period
., which is invalid input for the resource, producing the following error, generated for bucket name
com.somebody.dev-foo-us-east-2-s3-logs:
│ Error: invalid value for statement_id (must contain alphanumeric, underscores or dashes only)
│
│ with module.datadog_lambda_forwarder.aws_lambda_permission.allow_s3_bucket["com.somebody.dev-foo-us-east-2-s3-logs"],
│ on ../../../../../../src/terraform-aws-datadog-lambda-forwarder/lambda-log.tf line 126, in resource "aws_lambda_permission" "allow_s3_bucket":
│ 126: statement_id = "AllowS3ToInvokeLambda-${each.value}"
This change fixes that for periods:
statement_id = "AllowS3ToInvokeLambda-${
replace(
title(
replace(each.value, ".", " "),
),
" ", ""
)
}"
Is there another way around this?