Skip to content

Commit 31f7f40

Browse files
jamengualPePe (Jose) Amengualaknysh
authored
Disable retention option (#24)
* 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]>
1 parent fe66c46 commit 31f7f40

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ Available targets:
130130
| attributes | Additional attributes (e.g. `1`) | list(string) | `<list>` | no |
131131
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | string | `-` | no |
132132
| enable_glacier_transition | Enables the transition to AWS Glacier which can cause unnecessary costs for huge amount of small files | bool | `true` | no |
133+
| enable_standard_ia_transition | Enables the transition to STANDARD_IA | bool | `false` | no |
133134
| enabled | Set to false to prevent the module from creating any resources | bool | `true` | no |
134135
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | string | `` | no |
135136
| expiration_days | Number of days after which to expunge the objects | number | `90` | no |

docs/terraform.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
| attributes | Additional attributes (e.g. `1`) | list(string) | `<list>` | no |
1010
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | string | `-` | no |
1111
| enable_glacier_transition | Enables the transition to AWS Glacier which can cause unnecessary costs for huge amount of small files | bool | `true` | no |
12+
| enable_standard_ia_transition | Enables the transition to STANDARD_IA | bool | `false` | no |
1213
| enabled | Set to false to prevent the module from creating any resources | bool | `true` | no |
1314
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | string | `` | no |
1415
| expiration_days | Number of days after which to expunge the objects | number | `90` | no |

main.tf

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ resource "aws_s3_bucket" "default" {
4242
}
4343
}
4444

45-
transition {
46-
days = var.standard_transition_days
47-
storage_class = "STANDARD_IA"
48-
}
49-
5045
dynamic "transition" {
5146
for_each = var.enable_glacier_transition ? [1] : []
5247

@@ -56,6 +51,15 @@ resource "aws_s3_bucket" "default" {
5651
}
5752
}
5853

54+
dynamic "transition" {
55+
for_each = var.enable_standard_ia_transition ? [1] : []
56+
57+
content {
58+
days = var.standard_transition_days
59+
storage_class = "STANDARD_IA"
60+
}
61+
}
62+
5963
expiration {
6064
days = var.expiration_days
6165
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ variable "enable_glacier_transition" {
148148
description = "Enables the transition to AWS Glacier which can cause unnecessary costs for huge amount of small files"
149149
}
150150

151+
variable "enable_standard_ia_transition" {
152+
type = bool
153+
default = false
154+
description = "Enables the transition to STANDARD_IA"
155+
}
156+
151157
variable "expiration_days" {
152158
type = number
153159
default = 90

0 commit comments

Comments
 (0)