Skip to content

Commit

Permalink
Disable retention option (#24)
Browse files Browse the repository at this point in the history
* adding dynamic to allow for other expiration types for non versioned buckets

* adding support for abort_incomplete_multipart_upload_days

* Fixing tags in lifecycle when multipart upload is enabled

* Adding option to disable any transition

* Adding option to disable any transition

* Fixing condition for transition days

* Update main.tf

Co-authored-by: Andriy Knysh <[email protected]>

* Update main.tf

Co-authored-by: Andriy Knysh <[email protected]>

* Re-adding deleted trasition dynamic

Co-authored-by: PePe (Jose) Amengual <[email protected]>
Co-authored-by: Andriy Knysh <[email protected]>
  • Loading branch information
3 people authored May 15, 2020
1 parent fe66c46 commit 31f7f40
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Available targets:
| attributes | Additional attributes (e.g. `1`) | list(string) | `<list>` | no |
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | string | `-` | no |
| enable_glacier_transition | Enables the transition to AWS Glacier which can cause unnecessary costs for huge amount of small files | bool | `true` | no |
| enable_standard_ia_transition | Enables the transition to STANDARD_IA | bool | `false` | no |
| enabled | Set to false to prevent the module from creating any resources | bool | `true` | no |
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | string | `` | no |
| expiration_days | Number of days after which to expunge the objects | number | `90` | no |
Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
| attributes | Additional attributes (e.g. `1`) | list(string) | `<list>` | no |
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | string | `-` | no |
| enable_glacier_transition | Enables the transition to AWS Glacier which can cause unnecessary costs for huge amount of small files | bool | `true` | no |
| enable_standard_ia_transition | Enables the transition to STANDARD_IA | bool | `false` | no |
| enabled | Set to false to prevent the module from creating any resources | bool | `true` | no |
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | string | `` | no |
| expiration_days | Number of days after which to expunge the objects | number | `90` | no |
Expand Down
14 changes: 9 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ resource "aws_s3_bucket" "default" {
}
}

transition {
days = var.standard_transition_days
storage_class = "STANDARD_IA"
}

dynamic "transition" {
for_each = var.enable_glacier_transition ? [1] : []

Expand All @@ -56,6 +51,15 @@ resource "aws_s3_bucket" "default" {
}
}

dynamic "transition" {
for_each = var.enable_standard_ia_transition ? [1] : []

content {
days = var.standard_transition_days
storage_class = "STANDARD_IA"
}
}

expiration {
days = var.expiration_days
}
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ variable "enable_glacier_transition" {
description = "Enables the transition to AWS Glacier which can cause unnecessary costs for huge amount of small files"
}

variable "enable_standard_ia_transition" {
type = bool
default = false
description = "Enables the transition to STANDARD_IA"
}

variable "expiration_days" {
type = number
default = 90
Expand Down

0 comments on commit 31f7f40

Please sign in to comment.