Skip to content

Commit 5c3289c

Browse files
authored
Merge pull request #4 from mike-rsi/feature/custom-logging-target
Feature/custom logging target
2 parents 7d50aef + 8e4ebb1 commit 5c3289c

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ region = "us-east-1"
6060
| Name | Description | Type | Default | Required |
6161
|------|-------------|:----:|:-----:|:-----:|
6262
| allowed\_account\_ids | Account IDs that are allowed to access the bucket/KMS key | list(string) | `[]` | no |
63-
| bucket | Name of bucket to create \(do not provide if using `remote\_bucket`\) | string | `""` | no |
63+
| bucket | Name of bucket to create \(do not provide if using `remote_bucket`\) | string | `""` | no |
6464
| kms\_key\_id | ARN for KMS key for all encryption operations. | string | `""` | no |
65+
| logging\_target\_bucket | The name of the bucket that will receive the log objects | string | `var.bucket` | no |
66+
| logging\_target\_prefix | A key prefix for log objects | string | `"TFStateLogs/"` | no |
6567
| region | Region bucket will be created in | string | n/a | yes |
6668
| remote\_bucket | If specified, the remote bucket will be used for the backend. A new bucket will not be created | string | `""` | no |
6769
| table | Name of Dynamo Table to create | string | `"tf-locktable"` | no |

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ resource "aws_s3_bucket" "this" {
4949
}
5050

5151
logging {
52-
target_bucket = var.bucket
53-
target_prefix = "TFStateLogs/"
52+
target_bucket = coalesce(var.logging_target_bucket, var.bucket)
53+
target_prefix = var.logging_target_prefix
5454
}
5555
}
5656

variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ variable "kms_key_id" {
1616
type = string
1717
}
1818

19+
variable "logging_target_bucket" {
20+
default = null
21+
description = "The name of the bucket that will receive the log objects"
22+
type = string
23+
}
24+
25+
variable "logging_target_prefix" {
26+
default = "TFStateLogs/"
27+
description = "A key prefix for log objects"
28+
type = string
29+
}
30+
1931
variable "region" {
2032
description = "Region bucket will be created in"
2133
type = string

0 commit comments

Comments
 (0)