AWS CloudTrail Cloudtrail

This page shows how to write Terraform and CloudFormation for CloudTrail Cloudtrail and write them securely.

aws_cloudtrail (Terraform)

The Cloudtrail in CloudTrail can be configured in Terraform with the resource name aws_cloudtrail. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

github-iconstorebot/pr_demo_flat
resource "aws_cloudtrail" "missing-multi-region" {
  name                          = "tf-trail-foobar"
  s3_bucket_name                = "some-s3-bucket"
  s3_key_prefix                 = "prefix"
  include_global_service_events = false
}
github-iconkanchwala-yusuf/aws-terraform
resource "aws_cloudtrail" "missing-multi-region" {
  name                          = "tf-trail-foobar"
  s3_bucket_name                = "some-s3-bucket"
  s3_key_prefix                 = "prefix"
  include_global_service_events = false
}
github-iconsnyk-labs/infrastructure-as-code-goof
resource "aws_cloudtrail" "allowed" {
  enable_log_file_validation = true
  is_multi_region_trail      = true
  cloud_watch_logs_group_arn = "arn:1234"
  kms_key_id                 = "arn:124"
}
github-iconsnyk-labs/infrastructure-as-code-goof
resource "aws_cloudtrail" "allowed" {
  cloud_watch_logs_group_arn = "some-arn:*"
  kms_key_id                 = "arn:1234"
  enable_log_file_validation = true
  is_multi_region_trail      = true
}
github-iconffsclyh/config-lint
resource "aws_cloudtrail" "object_logging_enabled" {
  name                          = "tf-trail-foobar"
  s3_bucket_name                = "nwm-cloudtrail-logs"
  s3_key_prefix                 = "prefix"
  include_global_service_events = false
  event_selector {

Parameters

Explanation in Terraform Registry

Provides a CloudTrail resource. -> Tip: For a multi-region trail, this resource must be in the home region of the trail. -> Tip: For an organization trail, this resource must be in the master account of the organization.

AWS::CloudTrail::Trail (CloudFormation)

The Trail in CloudTrail can be configured in CloudFormation with the resource name AWS::CloudTrail::Trail. The following sections describe how to use the resource and its parameters.

Parameters

Explanation in CloudFormation Registry

Creates a trail that specifies the settings for delivery of log data to an Amazon S3 bucket.

Frequently asked questions

What is AWS CloudTrail Cloudtrail?

AWS CloudTrail Cloudtrail is a resource for CloudTrail of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS CloudTrail Cloudtrail?

For Terraform, the storebot/pr_demo_flat, kanchwala-yusuf/aws-terraform and snyk-labs/infrastructure-as-code-goof source code examples are useful. See the Terraform Example section for further details.