Skip to content

Commit

Permalink
Add support to set S3 access logs bucket (#40)
Browse files Browse the repository at this point in the history
Allow setting `access_log_bucket_name` and `access_log_bucket_prefix`
variables, which will be bypassed to the `cloudposse/s3-log-storage/aws`
module as-is.

We need to bump the `cloudposse/s3-log-storage/aws` module to version
`0.24.0`, as that's where the `access_log_bucket_prefix` variable was
introduced.
  • Loading branch information
adamantike committed Jun 14, 2021
1 parent 0a922de commit 95b4d42
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Available targets:

| Name | Source | Version |
|------|--------|---------|
| <a name="module_s3_bucket"></a> [s3\_bucket](#module\_s3\_bucket) | cloudposse/s3-log-storage/aws | 0.20.0 |
| <a name="module_s3_bucket"></a> [s3\_bucket](#module\_s3\_bucket) | cloudposse/s3-log-storage/aws | 0.24.0 |
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.24.1 |

## Resources
Expand All @@ -155,6 +155,8 @@ Available targets:

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_access_log_bucket_name"></a> [access\_log\_bucket\_name](#input\_access\_log\_bucket\_name) | Name of the S3 bucket where S3 access logs will be sent to | `string` | `""` | no |
| <a name="input_access_log_bucket_prefix"></a> [access\_log\_bucket\_prefix](#input\_access\_log\_bucket\_prefix) | Prefix to prepend to the current S3 bucket name, where S3 access logs will be sent to | `string` | `null` | no |
| <a name="input_acl"></a> [acl](#input\_acl) | Canned ACL to apply to the S3 bucket | `string` | `"log-delivery-write"` | no |
| <a name="input_additional_tag_map"></a> [additional\_tag\_map](#input\_additional\_tag\_map) | Additional tags for appending to tags\_as\_list\_of\_maps. Not added to `tags`. | `map(string)` | `{}` | no |
| <a name="input_attributes"></a> [attributes](#input\_attributes) | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no |
Expand Down Expand Up @@ -201,14 +203,13 @@ Like this project? Please give it a ★ on [our GitHub](https://github.com/cloud
Are you using this project or any of our other projects? Consider [leaving a testimonial][testimonial]. =)



## Related Projects

Check out these related projects.

- [terraform-aws-alb](https://github.com/cloudposse/terraform-aws-alb) - Terraform module to provision a standard ALB for HTTP/HTTP traffic



## Help

**Got a question?** We got answers.
Expand Down
4 changes: 3 additions & 1 deletion docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

| Name | Source | Version |
|------|--------|---------|
| <a name="module_s3_bucket"></a> [s3\_bucket](#module\_s3\_bucket) | cloudposse/s3-log-storage/aws | 0.20.0 |
| <a name="module_s3_bucket"></a> [s3\_bucket](#module\_s3\_bucket) | cloudposse/s3-log-storage/aws | 0.24.0 |
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.24.1 |

## Resources
Expand All @@ -32,6 +32,8 @@

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_access_log_bucket_name"></a> [access\_log\_bucket\_name](#input\_access\_log\_bucket\_name) | Name of the S3 bucket where S3 access logs will be sent to | `string` | `""` | no |
| <a name="input_access_log_bucket_prefix"></a> [access\_log\_bucket\_prefix](#input\_access\_log\_bucket\_prefix) | Prefix to prepend to the current S3 bucket name, where S3 access logs will be sent to | `string` | `null` | no |
| <a name="input_acl"></a> [acl](#input\_acl) | Canned ACL to apply to the S3 bucket | `string` | `"log-delivery-write"` | no |
| <a name="input_additional_tag_map"></a> [additional\_tag\_map](#input\_additional\_tag\_map) | Additional tags for appending to tags\_as\_list\_of\_maps. Not added to `tags`. | `map(string)` | `{}` | no |
| <a name="input_attributes"></a> [attributes](#input\_attributes) | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no |
Expand Down
4 changes: 3 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ data "aws_iam_policy_document" "default" {

module "s3_bucket" {
source = "cloudposse/s3-log-storage/aws"
version = "0.20.0"
version = "0.24.0"
context = module.this.context
acl = var.acl
policy = join("", data.aws_iam_policy_document.default.*.json)
Expand All @@ -70,4 +70,6 @@ module "s3_bucket" {
noncurrent_version_transition_days = var.noncurrent_version_transition_days
standard_transition_days = var.standard_transition_days
lifecycle_prefix = var.lifecycle_prefix
access_log_bucket_name = var.access_log_bucket_name
access_log_bucket_prefix = var.access_log_bucket_prefix
}
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,15 @@ variable "standard_transition_days" {
description = "Number of days to persist logs in standard storage tier before moving to the infrequent access tier"
default = 30
}

variable "access_log_bucket_name" {
type = string
description = "Name of the S3 bucket where S3 access logs will be sent to"
default = ""
}

variable "access_log_bucket_prefix" {
type = string
description = "Prefix to prepend to the current S3 bucket name, where S3 access logs will be sent to"
default = null
}

0 comments on commit 95b4d42

Please sign in to comment.