diff --git a/modules/cloudtrail-event-data-store/README.md b/modules/cloudtrail-event-data-store/README.md
index 3d08c7f..a37d3b6 100644
--- a/modules/cloudtrail-event-data-store/README.md
+++ b/modules/cloudtrail-event-data-store/README.md
@@ -43,7 +43,7 @@ This module creates following resources.
| [management\_event\_selector](#input\_management\_event\_selector) | (Optional) A configuration of management event selector to use to select the events for the event data store. Only used if `event_type` is `CLOUDTRAIL_EVENTS`. `management_event_selector` block as defined below.
(Optional) `enabled` - Whether to capture management events. Defaults to `false`.
(Optional) `scope` - The type of events to log. Valid values are `ALL`, `READ` and `WRITE`. Defaults to `ALL`.
(Optional) `exclude_event_sources` - A set of event sources to exclude. Valid values are `kms.amazonaws.com` and `rdsdata.amazonaws.com`. `management_event_selector.enabled` must be set to true to allow this. |
object({| n/a | yes | | [name](#input\_name) | (Required) The name of the event data store. | `string` | n/a | yes | | [data\_event\_selectors](#input\_data\_event\_selectors) | (Optional) A configuration of event selectors to use to select the data events for the event data store. Each item of `data_event_selectors` block as defined below.
enabled = optional(bool, false)
scope = optional(string, "ALL")
exclude_event_sources = optional(set(string), [])
})
list(object({| `[]` | no | -| [encryption\_kms\_key](#input\_encryption\_kms\_key) | (Optional) Specify the KMS key ID to use to encrypt the events delivered by CloudTrail. The value can be an alias name prefixed by 'alias/', a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier. By default, the event data store is encrypted with a KMS key that AWS owns and manages. | `string` | `null` | no | +| [encryption](#input\_encryption) | (Optional) A configuration to encrypt the events delivered by CloudTrail. By default, the event data store is encrypted with a KMS key that AWS owns and manages.`encryption` as defined below.
name = optional(string)
resource_type = string
scope = optional(string, "WRITE")
conditions = optional(list(object({
field = string
operator = string
values = set(string)
})), [])
}))
object({| `{}` | no | | [event\_type](#input\_event\_type) | (Required) A type of event to be collected by the event data store. Valid values are `CLOUDTRAIL_EVENTS`, `CONFIG_CONFIGURATION_ITEMS`. Defaults to `CLOUDTRAIL_EVENTS`. | `string` | `"CLOUDTRAIL_EVENTS"` | no | | [import\_trail\_events\_iam\_role](#input\_import\_trail\_events\_iam\_role) | (Optional) A configuration of IAM Role for importing CloudTrail events from S3 Bucket. `import_trail_events_iam_role` as defined below.
kms_key = optional(string)
})
object({| `{}` | no | | [level](#input\_level) | (Optional) The level of the event data store to decide whether the event data store collects events logged for an organization in AWS Organizations. Can be created in the management account or delegated administrator account. Valid values are `ACCOUNT` and `ORGANIZATION`. Defaults to `ACCOUNT`. | `string` | `"ACCOUNT"` | no | diff --git a/modules/cloudtrail-event-data-store/main.tf b/modules/cloudtrail-event-data-store/main.tf index 63d3b6a..a95c00c 100644 --- a/modules/cloudtrail-event-data-store/main.tf +++ b/modules/cloudtrail-event-data-store/main.tf @@ -43,8 +43,7 @@ resource "aws_cloudtrail_event_data_store" "this" { ## Encryption - # TODO: Not supported yet in aws provider - # kms_key_id = var.encryption_kms_key + kms_key_id = var.encryption.kms_key ## Event Selector - AWS CloudTrail Events (Management) diff --git a/modules/cloudtrail-event-data-store/outputs.tf b/modules/cloudtrail-event-data-store/outputs.tf index 6bdd9e1..73f3305 100644 --- a/modules/cloudtrail-event-data-store/outputs.tf +++ b/modules/cloudtrail-event-data-store/outputs.tf @@ -2,6 +2,7 @@ output "arn" { description = "The Amazon Resource Name (ARN) of the event data store." value = aws_cloudtrail_event_data_store.this.arn } + output "id" { description = "The ID of the event data store." value = aws_cloudtrail_event_data_store.this.id @@ -40,7 +41,7 @@ output "data_event_selectors" { output "encryption" { description = "The configuration for the encryption of the event data store." value = { - # kms_key = aws_cloudtrail_event_data_store.this.kms_key_id + kms_key = aws_cloudtrail_event_data_store.this.kms_key_id } } diff --git a/modules/cloudtrail-event-data-store/variables.tf b/modules/cloudtrail-event-data-store/variables.tf index 7026da0..61ea41b 100644 --- a/modules/cloudtrail-event-data-store/variables.tf +++ b/modules/cloudtrail-event-data-store/variables.tf @@ -179,11 +179,16 @@ variable "data_event_selectors" { } } -variable "encryption_kms_key" { - description = "(Optional) Specify the KMS key ID to use to encrypt the events delivered by CloudTrail. The value can be an alias name prefixed by 'alias/', a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier. By default, the event data store is encrypted with a KMS key that AWS owns and manages." - type = string - default = null - nullable = true +variable "encryption" { + description = <
enabled = optional(bool, true)
source_s3_buckets = optional(list(object({
name = string
key_prefix = optional(string, "/")
})), [])
})