Terraform module that provisions an AWS CloudTrail trail, its optional S3 destination, and optional CloudWatch Logs delivery.
This module requires Terraform 1.6.0 or later and supports AWS provider versions from 5.40.0 up to, but not including, 7.0.0.
| Name |
Version |
| aws |
>= 5.40.0, < 7.0.0 |
No modules.
| Name |
Description |
Type |
Default |
Required |
| create_s3_bucket |
(Optional) Automatically creates the S3 bucket for CloudTrail. |
bool |
true |
no |
| enable_cloudwatchlogs |
(Required) Enables log delivery to CloudWatch Logs. |
bool |
false |
no |
| enable_log_file_validation |
(Optional) Specifies whether log file integrity validation is enabled. |
bool |
true |
no |
| enable_logging |
(Optional) Enables logging for the trail. |
bool |
true |
no |
| event_selector |
(Optional) Specifies event selectors for enabling data event logging. |
list(object({ include_management_events = bool read_write_type = string data_resource = object({ type = string values = list(string) }) })) |
[] |
no |
| force_destroy |
A boolean indicating whether all objects can be deleted when destroying the bucket. |
string |
false |
no |
| include_global_service_events |
(Optional) Specifies whether the trail publishes events from global services. |
bool |
true |
no |
| is_multi_region_trail |
(Optional) Specifies whether the trail is created in the current region or in all regions. |
bool |
true |
no |
| is_organization_trail |
(Optional) Specifies whether the trail is an AWS Organizations trail. |
bool |
false |
no |
| kms_key_id |
(Optional) Specifies the KMS key ARN used to encrypt CloudTrail logs. |
string |
null |
no |
| log_retention_days |
Number of days to keep AWS logs in the CloudWatch Logs group. |
string |
180 |
no |
| name |
(Required) Specifies the name of the trail. |
string |
n/a |
yes |
| s3_block_public_acls |
Whether Amazon S3 should block public ACLs for this bucket. |
bool |
true |
no |
| s3_block_public_policy |
Whether Amazon S3 should block public bucket policies for this bucket. |
bool |
true |
no |
| s3_bucket_name |
(Optional) Required when create_s3_bucket is false, the existing S3 bucket name. |
string |
null |
no |
| s3_ignore_public_acls |
Whether Amazon S3 should ignore public ACLs for this bucket. |
bool |
true |
no |
| s3_lifecycle_expiration_days |
Days until objects in the bucket expire. |
number |
1825 |
no |
| s3_restrict_public_buckets |
Whether Amazon S3 should restrict public bucket policies for this bucket. |
bool |
true |
no |
| tags |
(Optional) A map of tags to assign to the trail. |
map(string) |
{} |
no |
See examples/complete.