Skip to content

Commit e7f3476

Browse files
authored
fix-log-enable (#44)
Fix Log enabling Signed-off-by: Kyle Nguyen <[email protected]>
1 parent 67649c5 commit e7f3476

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

main.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ resource "aws_ec2_client_vpn_endpoint" "default" {
181181
}
182182

183183
connection_log_options {
184-
enabled = var.Connection_logging
184+
enabled = var.connection_logging
185185
cloudwatch_log_group = join("", aws_cloudwatch_log_group.vpn[*].name)
186186
cloudwatch_log_stream = join("", aws_cloudwatch_log_stream.vpn[*].name)
187187
}
@@ -242,7 +242,7 @@ resource "aws_ec2_client_vpn_network_association" "default" {
242242
##-----------------------------------------------------------------------------
243243
#tfsec:ignore:aws-cloudwatch-log-group-customer-key
244244
resource "aws_cloudwatch_log_group" "vpn" {
245-
count = var.enabled ? 1 : 0
245+
count = var.enabled && var.connection_logging ? 1 : 0
246246
name = format("/aws/vpn/%s/logs", module.labels.id)
247247
retention_in_days = var.logs_retention
248248
tags = module.labels.tags
@@ -252,7 +252,7 @@ resource "aws_cloudwatch_log_group" "vpn" {
252252
## A log stream is a sequence of log events that share the same source. Each separate source of logs in CloudWatch Logs makes up a separate log stream.
253253
##-----------------------------------------------------------------------------
254254
resource "aws_cloudwatch_log_stream" "vpn" {
255-
count = var.enabled ? 1 : 0
255+
count = var.enabled && var.connection_logging ? 1 : 0
256256
name = format("%s-usage", module.labels.id)
257257
log_group_name = join("", aws_cloudwatch_log_group.vpn[*].name)
258258
}

variables.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ variable "certificate_enabled" {
135135
default = true
136136
}
137137

138-
variable "Connection_logging" {
138+
variable "connection_logging" {
139139
type = bool
140140
default = true
141141
description = "Connection logging is a feature of AWS client VPN that enables you to capture connection logs for your client VPN endpoint. Before you enable, you must have a CloudWatch Logs log group in your account."

0 commit comments

Comments
 (0)