Skip to content

Commit

Permalink
chore(aws) rename enable_cloudtrail => use_existing_cloudtrail (#34)
Browse files Browse the repository at this point in the history
chore(aws) rename enable_cloudtrail => use_existing_cloudtrail

Signed-off-by: Scott Ford <[email protected]>

Co-authored-by: Salim Afiune <[email protected]>
  • Loading branch information
scottford-lw and afiune authored Jun 17, 2020
1 parent e307836 commit 1ab3036
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ module "aws_cloudtrail" {
source = "../../"

# Use an existing CloudTrail
enable_cloudtrail = false
bucket_name = "lacework-ct-bucket-7bb591f4"
sns_topic_name = "lacework-ct-sns-7bb591f4"
use_existing_cloudtrail = true
bucket_name = "lacework-ct-bucket-7bb591f4"
sns_topic_name = "lacework-ct-sns-7bb591f4"

# Use an existing IAM role
use_existing_iam_role = true
Expand Down
6 changes: 3 additions & 3 deletions aws/modules/cloudtrail/examples/existing-cloudtrail/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module "aws_cloudtrail" {
source = "../../"

# Use an existing CloudTrail
enable_cloudtrail = false
bucket_name = "lacework-ct-bucket-8805c0bf"
sns_topic_name = "lacework-ct-sns-8805c0bf"
use_existing_cloudtrail = true
bucket_name = "lacework-ct-bucket-8805c0bf"
sns_topic_name = "lacework-ct-sns-8805c0bf"
}

4 changes: 2 additions & 2 deletions aws/modules/cloudtrail/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ resource "random_id" "uniq" {
}

resource "aws_cloudtrail" "lacework_cloudtrail" {
count = var.enable_cloudtrail ? 1 : 0
count = var.use_existing_cloudtrail ? 0 : 1
name = var.cloudtrail_name
is_multi_region_trail = true
s3_bucket_name = local.bucket_name
Expand All @@ -27,7 +27,7 @@ resource "aws_cloudtrail" "lacework_cloudtrail" {
# we need the identity of the caller to get their account_id for the s3 bucket
data "aws_caller_identity" "current" {}
resource "aws_s3_bucket" "cloudtrail_bucket" {
count = var.enable_cloudtrail ? 1 : 0
count = var.use_existing_cloudtrail ? 0 : 1
bucket = local.bucket_name
force_destroy = var.bucket_force_destroy
policy = <<POLICY
Expand Down
6 changes: 3 additions & 3 deletions aws/modules/cloudtrail/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ variable "sqs_queue_name" {
default = ""
}

variable "enable_cloudtrail" {
variable "use_existing_cloudtrail" {
type = bool
default = true
description = "Set this to false to use an existing cloudtrail"
default = false
description = "Set this to true to use an existing cloudtrail. Default behavior enables new cloudtrail"
}

variable "cloudtrail_name" {
Expand Down

0 comments on commit 1ab3036

Please sign in to comment.