Skip to content

Commit b9a6ea1

Browse files
fix: Dynamic logging config for Gov Cloud (terraform-aws-modules#541)
1 parent 9e3798e commit b9a6ea1

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

main.tf

+11-5
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,17 @@ resource "aws_lambda_function" "this" {
112112
}
113113
}
114114

115-
logging_config {
116-
log_group = var.logging_log_group
117-
log_format = var.logging_log_format
118-
application_log_level = var.logging_application_log_level
119-
system_log_level = var.logging_system_log_level
115+
dynamic "logging_config" {
116+
# Dont create logging config on gov cloud as it is not avaible.
117+
# See https://github.com/hashicorp/terraform-provider-aws/issues/34810
118+
for_each = data.aws_partition.current.partition == "aws" ? [true] : []
119+
120+
content {
121+
log_group = var.logging_log_group
122+
log_format = var.logging_log_format
123+
application_log_level = var.logging_application_log_level
124+
system_log_level = var.logging_system_log_level
125+
}
120126
}
121127

122128
dynamic "timeouts" {

0 commit comments

Comments
 (0)