CIS-v1.4.0-sentinel-policies/terraform_v1.4.0/CloudTrail/main.tf
2023-11-15 15:06:26 -08:00

55 lines
1.2 KiB
HCL

terraform {
cloud {
organization = "sean-env"
workspaces {
name = "cis-sentinel-resources"
}
}
required_providers {
aws = {
source = "hashicorp/aws"
version = "~>5.0"
}
}
}
variable "s3_bucket_arn" {
type = string
description = "The ARN of the CloudTrail bucket"
}
provider "aws" {
region = "us-west-2"
}
resource "aws_cloudtrail" "example" {
name = "example"
s3_bucket_name = "stm-cloudtrail-sentinel"
include_global_service_events = false
}
resource "aws_cloudtrail" "example-multi-region" {
name = "example-multi-region"
s3_bucket_name = "stm-cloudtrail-sentinel"
include_global_service_events = true
is_multi_region_trail = true
}
resource "aws_cloudtrail" "example-with-event-selector" {
name = "example-with-event-selector"
s3_bucket_name = "stm-cloudtrail-sentinel"
include_global_service_events = true
is_multi_region_trail = true
event_selector {
read_write_type = "All"
include_management_events = true
data_resource {
type = "AWS::S3::Object"
values = ["${var.s3_bucket_arn}/"]
}
}
}