Skip to content

Commit b97717a

Browse files
authored
Support kms_key for cloudtrail-event-data-store (#48)
1 parent d6025db commit b97717a

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

modules/cloudtrail-event-data-store/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ This module creates following resources.
4343
| <a name="input_management_event_selector"></a> [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.<br> (Optional) `enabled` - Whether to capture management events. Defaults to `false`.<br> (Optional) `scope` - The type of events to log. Valid values are `ALL`, `READ` and `WRITE`. Defaults to `ALL`.<br> (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. | <pre>object({<br> enabled = optional(bool, false)<br> scope = optional(string, "ALL")<br> exclude_event_sources = optional(set(string), [])<br> })</pre> | n/a | yes |
4444
| <a name="input_name"></a> [name](#input\_name) | (Required) The name of the event data store. | `string` | n/a | yes |
4545
| <a name="input_data_event_selectors"></a> [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.<br> (Optional) `name` - A name of the advanced event selector.<br> (Optional) `resource_type` - A resource type to log data events to log. Valid values are one of the following:<br> - `AWS::DynamoDB::Table`<br> - `AWS::Lambda::Function`<br> - `AWS::S3::Object`<br> - `AWS::AppConfig::Configuration`<br> - `AWS::B2BI::Transformer`<br> - `AWS::Bedrock::AgentAlias`<br> - `AWS::Bedrock::KnowledgeBase`<br> - `AWS::Cassandra::Table`<br> - `AWS::CloudFront::KeyValueStore`<br> - `AWS::CloudTrail::Channel`<br> - `AWS::CodeWhisperer::Customization`<br> - `AWS::CodeWhisperer::Profile`<br> - `AWS::Cognito::IdentityPool`<br> - `AWS::DynamoDB::Stream`<br> - `AWS::EC2::Snapshot`<br> - `AWS::EMRWAL::Workspace`<br> - `AWS::FinSpace::Environment`<br> - `AWS::Glue::Table`<br> - `AWS::GreengrassV2::ComponentVersion`<br> - `AWS::GreengrassV2::Deployment`<br> - `AWS::GuardDuty::Detector`<br> - `AWS::IoT::Certificate`<br> - `AWS::IoT::Thing`<br> - `AWS::IoTSiteWise::Asset`<br> - `AWS::IoTSiteWise::TimeSeries`<br> - `AWS::IoTTwinMaker::Entity`<br> - `AWS::IoTTwinMaker::Workspace`<br> - `AWS::KendraRanking::ExecutionPlan`<br> - `AWS::KinesisVideo::Stream`<br> - `AWS::ManagedBlockchain::Network`<br> - `AWS::ManagedBlockchain::Node`<br> - `AWS::MedicalImaging::Datastore`<br> - `AWS::NeptuneGraph::Graph`<br> - `AWS::PCAConnectorAD::Connector`<br> - `AWS::QBusiness::Application`<br> - `AWS::QBusiness::DataSource`<br> - `AWS::QBusiness::Index`<br> - `AWS::QBusiness::WebExperience`<br> - `AWS::RDS::DBCluster`<br> - `AWS::S3::AccessPoint`<br> - `AWS::S3ObjectLambda::AccessPoint`<br> - `AWS::S3Outposts::Object`<br> - `AWS::SageMaker::Endpoint`<br> - `AWS::SageMaker::ExperimentTrialComponent`<br> - `AWS::SageMaker::FeatureGroup`<br> - `AWS::ServiceDiscovery::Namespace`<br> - `AWS::ServiceDiscovery::Service`<br> - `AWS::SCN::Instance`<br> - `AWS::SNS::PlatformEndpoint`<br> - `AWS::SNS::Topic`<br> - `AWS::SWF::Domain`<br> - `AWS::SQS::Queue`<br> - `AWS::SSMMessages::ControlChannel`<br> - `AWS::ThinClient::Device`<br> - `AWS::ThinClient::Environment`<br> - `AWS::Timestream::Database`<br> - `AWS::Timestream::Table`<br> - `AWS::VerifiedPermissions::PolicyStore`<br> (Optional) `scope` - The type of events to log. Valid values are `ALL`, `READ` and `WRITE`. Defaults to `WRITE`.<br> (Optional) `conditions` - A configuration of field conditions to filter events by the ARN of resource and the event name. Each item of `conditions` as defined below.<br> (Required) `field` - A field to compare by the field condition. Valid values are `event_name` and `resource_arn`.<br> (Required) `operator` - An operator of the field condition. Valid values are `equals`, `not_equals`, `starts_with`, `not_starts_with`, `ends_with`, `not_ends_with`.<br> (Required) `values` - A set of values of the field condition to compare. | <pre>list(object({<br> name = optional(string)<br> resource_type = string<br> scope = optional(string, "WRITE")<br> conditions = optional(list(object({<br> field = string<br> operator = string<br> values = set(string)<br> })), [])<br> }))</pre> | `[]` | no |
46-
| <a name="input_encryption_kms_key"></a> [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 |
46+
| <a name="input_encryption"></a> [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.<br> (Optional) `kms_key` - The ID of AWS KMS key to use to encrypt the events delivered by CloudtTrail. 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. | <pre>object({<br> kms_key = optional(string)<br> })</pre> | `{}` | no |
4747
| <a name="input_event_type"></a> [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 |
4848
| <a name="input_import_trail_events_iam_role"></a> [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.<br> (Optional) `enabled` - Indicates whether you want to create IAM Role to import trail events. Defaults to `true`.<br> (Optional) `source_s3_buckets` - A list of source S3 buckets to import events from. Each item of `source_s3_buckets` as defined below.<br> (Required) `name` - A name of source S3 bucket.<br> (Optional) `key_prefix` - A key prefix of source S3 bucket. | <pre>object({<br> enabled = optional(bool, true)<br> source_s3_buckets = optional(list(object({<br> name = string<br> key_prefix = optional(string, "/")<br> })), [])<br> })</pre> | `{}` | no |
4949
| <a name="input_level"></a> [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 |

modules/cloudtrail-event-data-store/main.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ resource "aws_cloudtrail_event_data_store" "this" {
4343

4444

4545
## Encryption
46-
# TODO: Not supported yet in aws provider
47-
# kms_key_id = var.encryption_kms_key
46+
kms_key_id = var.encryption.kms_key
4847

4948

5049
## Event Selector - AWS CloudTrail Events (Management)

modules/cloudtrail-event-data-store/outputs.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ output "arn" {
22
description = "The Amazon Resource Name (ARN) of the event data store."
33
value = aws_cloudtrail_event_data_store.this.arn
44
}
5+
56
output "id" {
67
description = "The ID of the event data store."
78
value = aws_cloudtrail_event_data_store.this.id
@@ -40,7 +41,7 @@ output "data_event_selectors" {
4041
output "encryption" {
4142
description = "The configuration for the encryption of the event data store."
4243
value = {
43-
# kms_key = aws_cloudtrail_event_data_store.this.kms_key_id
44+
kms_key = aws_cloudtrail_event_data_store.this.kms_key_id
4445
}
4546
}
4647

modules/cloudtrail-event-data-store/variables.tf

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,16 @@ variable "data_event_selectors" {
179179
}
180180
}
181181

182-
variable "encryption_kms_key" {
183-
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."
184-
type = string
185-
default = null
186-
nullable = true
182+
variable "encryption" {
183+
description = <<EOF
184+
(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.
185+
(Optional) `kms_key` - The ID of AWS KMS key to use to encrypt the events delivered by CloudtTrail. 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.
186+
EOF
187+
type = object({
188+
kms_key = optional(string)
189+
})
190+
default = {}
191+
nullable = false
187192
}
188193

189194
variable "retention_in_days" {

0 commit comments

Comments
 (0)