Skip to content

Commit

Permalink
fix: Fixed retention policy for flow log
Browse files Browse the repository at this point in the history
  • Loading branch information
13archit committed Jun 16, 2023
1 parent 109be74 commit 7ee75d8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
9 changes: 4 additions & 5 deletions _example/basic/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module "network_security_group" {
source = "../../"
name = "app"
environment = "test"
resource_group_name = module.resource_group.resource_group_name
resource_group_location = module.resource_group.resource_group_location
subnet_ids = module.subnet.default_subnet_id
resource_group_name = "test-rg"
resource_group_location = "CanadaCentral"
subnet_ids = ""
inbound_rules = [
{
name = "ssh"
Expand All @@ -33,6 +33,5 @@ module "network_security_group" {
description = "ssh allowed port"
}
]
enable_diagnostic = true
log_analytics_workspace_id = module.log-analytics.workspace_id
enable_diagnostic = false
}
23 changes: 12 additions & 11 deletions _example/nsg-with-flow-logs/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,18 @@ module "storage" {
## Network Security Group module call.
##-----------------------------------------------------------------------------
module "network_security_group" {
depends_on = [module.subnet]
source = "../../"
name = local.name
environment = local.environment
resource_group_name = module.resource_group.resource_group_name
resource_group_location = module.resource_group.resource_group_location
subnet_ids = module.subnet.default_subnet_id
enable_flow_logs = true
network_watcher_name = module.vnet.network_watcher_name
flow_log_storage_account_id = module.storage.default_storage_account_id
enable_traffic_analytics = false
depends_on = [module.subnet]
source = "../../"
name = local.name
environment = local.environment
resource_group_name = module.resource_group.resource_group_name
resource_group_location = module.resource_group.resource_group_location
subnet_ids = module.subnet.default_subnet_id
enable_flow_logs = true
network_watcher_name = module.vnet.network_watcher_name
flow_log_storage_account_id = module.storage.default_storage_account_id
enable_traffic_analytics = false
flow_log_retention_policy_enabled = true
inbound_rules = [
{
name = "ssh"
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ resource "azurerm_network_watcher_flow_log" "nsg_flow_logs" {
}

##-----------------------------------------------------------------------------
## Below resource will create diagnostic setting for ACR.
## Below resource will create diagnostic setting for network security group.
##-----------------------------------------------------------------------------
resource "azurerm_monitor_diagnostic_setting" "example" {
count = var.enabled && var.enable_diagnostic ? 1 : 0
Expand Down

0 comments on commit 7ee75d8

Please sign in to comment.