diff --git a/vpc-flow-logs.tf b/vpc-flow-logs.tf index fea651f98..497a2ad3a 100644 --- a/vpc-flow-logs.tf +++ b/vpc-flow-logs.tf @@ -24,10 +24,14 @@ resource "aws_flow_log" "this" { vpc_id = local.vpc_id max_aggregation_interval = var.flow_log_max_aggregation_interval - destination_options { - file_format = var.flow_log_file_format - hive_compatible_partitions = var.flow_log_hive_compatible_partitions - per_hour_partition = var.flow_log_per_hour_partition + dynamic "destination_options" { + for_each = var.flow_log_destination_type == "s3" ? [true] : [] + + content { + file_format = var.flow_log_file_format + hive_compatible_partitions = var.flow_log_hive_compatible_partitions + per_hour_partition = var.flow_log_per_hour_partition + } } tags = merge(var.tags, var.vpc_flow_log_tags)