Commit a0d03932 authored by Chris Merrett's avatar Chris Merrett

Cleanup, added comments

parent 3cf85a3c
Pipeline #775 passed with stage
in 6 seconds
#############################################################################################################
# Variables
#############################################################################################################
variable "customer_name" { variable "customer_name" {
description = "Account canonical name" description = "Account canonical name"
} }
...@@ -12,6 +15,9 @@ variable "child_accounts" { ...@@ -12,6 +15,9 @@ variable "child_accounts" {
type = "list" type = "list"
} }
#############################################################################################################
# IAM Policy Documents
#############################################################################################################
data "aws_iam_policy_document" "main" { data "aws_iam_policy_document" "main" {
statement { statement {
sid = "AWSCloudTrailAclCheck" sid = "AWSCloudTrailAclCheck"
...@@ -62,18 +68,27 @@ data "aws_iam_policy_document" "main" { ...@@ -62,18 +68,27 @@ data "aws_iam_policy_document" "main" {
} }
} }
#############################################################################################################
# S3
#############################################################################################################
resource "aws_s3_bucket" "main" { resource "aws_s3_bucket" "main" {
bucket = "${var.customer_name}-${var.environment}-cloudtrail" bucket = "${var.customer_name}-${var.environment}-cloudtrail"
force_destroy = true force_destroy = true
policy = "${data.aws_iam_policy_document.main.json}" policy = "${data.aws_iam_policy_document.main.json}"
} }
#############################################################################################################
# CloudTrail
#############################################################################################################
resource "aws_cloudtrail" "main" { resource "aws_cloudtrail" "main" {
name = "${var.customer_name}-${var.environment}-cloudtrail" name = "${var.customer_name}-${var.environment}-cloudtrail"
s3_bucket_name = "${aws_s3_bucket.main.id}" s3_bucket_name = "${aws_s3_bucket.main.id}"
include_global_service_events = true include_global_service_events = true
} }
#############################################################################################################
# Outputs
#############################################################################################################
output "bucket_name" { output "bucket_name" {
value = "${aws_s3_bucket.main.id}" value = "${aws_s3_bucket.main.id}"
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment