Skip to content

Commit

Permalink
Set default value to null
Browse files Browse the repository at this point in the history
  • Loading branch information
sbkg0002 committed Nov 9, 2023
1 parent f0a4d50 commit 0da0895
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 13 deletions.
23 changes: 13 additions & 10 deletions cloudtrail.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@ resource "aws_cloudtrail" "additional_auditing_trail" {
kms_key_id = var.additional_auditing_trail.kms_key_id
tags = var.tags

event_selector {
dynamic "data_resource" {
for_each = var.additional_auditing_trail.event_selector.data_resource != null ? { create = true } : {}
dynamic "event_selector" {
for_each = var.additional_auditing_trail.event_selector != null ? { create = true } : {}

content {
type = var.additional_auditing_trail.event_selector.data_resource.type
values = var.additional_auditing_trail.event_selector.data_resource.values
content {
dynamic "data_resource" {
for_each = var.additional_auditing_trail.event_selector.data_resource != null ? { create = true } : {}

content {
type = var.additional_auditing_trail.event_selector.data_resource.type
values = var.additional_auditing_trail.event_selector.data_resource.values
}
}

include_management_events = var.additional_auditing_trail.event_selector.include_management_events
exclude_management_event_sources = var.additional_auditing_trail.event_selector.exclude_management_event_sources
read_write_type = var.additional_auditing_trail.event_selector.read_write_type
}

include_management_events = var.additional_auditing_trail.event_selector.include_management_events
exclude_management_event_sources = var.additional_auditing_trail.event_selector.exclude_management_event_sources
read_write_type = var.additional_auditing_trail.event_selector.read_write_type
}
}
99 changes: 99 additions & 0 deletions examples/basic/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ provider "datadog" {
}

provider "mcaf" {
aws {
region = "eu-west-1"
}
aws {}
}

module "landing_zone" {
Expand Down
2 changes: 2 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ variable "additional_auditing_trail" {
name = string
bucket = string
kms_key_id = string

event_selector = optional(object({
data_resource = optional(object({
type = string
Expand All @@ -13,6 +14,7 @@ variable "additional_auditing_trail" {
read_write_type = optional(string, "All")
}))
})
default = null
description = "CloudTrail configuration for additional auditing trail"
}

Expand Down

0 comments on commit 0da0895

Please sign in to comment.