From d1b9b93557e848421f8a9e69c553ffe33b4ef770 Mon Sep 17 00:00:00 2001 From: Steven Miller Date: Mon, 8 Mar 2021 15:59:19 -0500 Subject: [PATCH] Add sns_topic_name variable (#47) Co-authored-by: cloudpossebot <11232728+cloudpossebot@users.noreply.github.com> --- README.md | 14 +++++++++++++- docs/terraform.md | 14 +++++++++++++- main.tf | 1 + variables.tf | 6 ++++++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5eca96f..846b975 100644 --- a/README.md +++ b/README.md @@ -181,6 +181,18 @@ Available targets: |------|---------| | aws | >= 2.0 | +## Modules + +| Name | Source | Version | +|------|--------|---------| +| this | cloudposse/label/null | 0.24.1 | + +## Resources + +| Name | +|------| +| [aws_cloudtrail](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudtrail) | + ## Inputs | Name | Description | Type | Default | Required | @@ -208,6 +220,7 @@ Available targets: | namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no | | regex\_replace\_chars | Regex to replace chars with empty string in `namespace`, `environment`, `stage` and `name`.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no | | s3\_bucket\_name | S3 bucket name for CloudTrail logs | `string` | n/a | yes | +| sns\_topic\_name | Specifies the name of the Amazon SNS topic defined for notification of log file delivery | `string` | `null` | no | | stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no | | tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | `map(string)` | `{}` | no | @@ -218,7 +231,6 @@ Available targets: | cloudtrail\_arn | The Amazon Resource Name of the trail | | cloudtrail\_home\_region | The region in which the trail was created | | cloudtrail\_id | The name of the trail | - diff --git a/docs/terraform.md b/docs/terraform.md index 3ccb7f7..5f48087 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -12,6 +12,18 @@ |------|---------| | aws | >= 2.0 | +## Modules + +| Name | Source | Version | +|------|--------|---------| +| this | cloudposse/label/null | 0.24.1 | + +## Resources + +| Name | +|------| +| [aws_cloudtrail](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudtrail) | + ## Inputs | Name | Description | Type | Default | Required | @@ -39,6 +51,7 @@ | namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no | | regex\_replace\_chars | Regex to replace chars with empty string in `namespace`, `environment`, `stage` and `name`.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no | | s3\_bucket\_name | S3 bucket name for CloudTrail logs | `string` | n/a | yes | +| sns\_topic\_name | Specifies the name of the Amazon SNS topic defined for notification of log file delivery | `string` | `null` | no | | stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no | | tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | `map(string)` | `{}` | no | @@ -49,5 +62,4 @@ | cloudtrail\_arn | The Amazon Resource Name of the trail | | cloudtrail\_home\_region | The region in which the trail was created | | cloudtrail\_id | The name of the trail | - diff --git a/main.tf b/main.tf index 9c3d64c..8bec949 100644 --- a/main.tf +++ b/main.tf @@ -4,6 +4,7 @@ resource "aws_cloudtrail" "default" { enable_logging = var.enable_logging s3_bucket_name = var.s3_bucket_name enable_log_file_validation = var.enable_log_file_validation + sns_topic_name = var.sns_topic_name is_multi_region_trail = var.is_multi_region_trail include_global_service_events = var.include_global_service_events cloud_watch_logs_role_arn = var.cloud_watch_logs_role_arn diff --git a/variables.tf b/variables.tf index f8b4862..bdcc98b 100644 --- a/variables.tf +++ b/variables.tf @@ -65,3 +65,9 @@ variable "is_organization_trail" { default = false description = "The trail is an AWS Organizations trail" } + +variable "sns_topic_name" { + type = string + description = "Specifies the name of the Amazon SNS topic defined for notification of log file delivery" + default = null +}