diff --git a/README.md b/README.md index 18850eed..ea59c807 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,7 @@ Available targets: | attributes | Additional attributes (e.g. `1`) | list(string) | `` | 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 | diff --git a/docs/terraform.md b/docs/terraform.md index 50ff4431..d854c43f 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -9,6 +9,7 @@ | attributes | Additional attributes (e.g. `1`) | list(string) | `` | 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 | diff --git a/main.tf b/main.tf index 78f21beb..9e10fe60 100644 --- a/main.tf +++ b/main.tf @@ -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] : [] @@ -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 } diff --git a/variables.tf b/variables.tf index e1ce1131..5eba7968 100644 --- a/variables.tf +++ b/variables.tf @@ -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