1- module "asg_label" {
2- source = " cloudposse/label/null"
3- version = " 0.25.0"
4-
5- context = module. this . context
6-
7- # This tag attribute is required.
8- # See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_group#propagate_at_launch
9- additional_tag_map = {
10- propagate_at_launch = " true"
11- }
12- }
13-
141module "role_label" {
152 source = " cloudposse/label/null"
163 version = " 0.25.0"
204191
205192module "logs_bucket" {
206193 source = " cloudposse/s3-bucket/aws"
207- version = " 0.40.1 "
194+ version = " 3.1.2 "
208195
209196 enabled = local. logs_bucket_enabled
210197 context = module. logs_label . context
@@ -220,28 +207,40 @@ module "logs_bucket" {
220207 user_enabled = false
221208 versioning_enabled = true
222209
223- lifecycle_rules = [
224- {
225- prefix = null
226- enabled = true
227- tags = {}
228-
229- enable_glacier_transition = true
230- enable_deeparchive_transition = false
231- enable_standard_ia_transition = false
232- enable_current_object_expiration = false
233-
234- abort_incomplete_multipart_upload_days = null
235- noncurrent_version_glacier_transition_days = 30
236- noncurrent_version_deeparchive_transition_days = 0
237- noncurrent_version_expiration_days = 365
238-
239- standard_transition_days = 30
240- glacier_transition_days = 90
241- deeparchive_transition_days = 0
242- expiration_days = 0
243- },
244- ]
210+ lifecycle_configuration_rules = [{
211+ enabled = true
212+ id = module.logs_label.id
213+ abort_incomplete_multipart_upload_days = 90
214+ filter_and = null
215+
216+ expiration = {
217+ days = 0
218+ }
219+ noncurrent_version_expiration = {
220+ noncurrent_days = 365
221+ }
222+ noncurrent_version_transition = [{
223+ noncurrent_days = 30
224+ storage_class = " GLACIER"
225+ },
226+ {
227+ noncurrent_days = 0
228+ storage_class = " DEEP_ARCHIVE"
229+ }]
230+ transition = [{
231+ days = 30
232+ storage_class = " STANDARD_IA"
233+ },
234+ {
235+ days = 90
236+ storage_class = " GLACIER"
237+ },
238+ {
239+ days = 0
240+ storage_class = " DEEP_ARCHIVE"
241+
242+ }]
243+ }]
245244}
246245
247246resource "aws_cloudwatch_log_group" "session_logging" {
@@ -319,9 +318,15 @@ resource "aws_launch_template" "default" {
319318}
320319
321320resource "aws_autoscaling_group" "default" {
322- name_prefix = " ${ module . asg_label . id } -asg"
323- tags = module. asg_label . tags_as_list_of_maps
324-
321+ name_prefix = " ${ module . this . id } -asg"
322+ dynamic "tag" {
323+ for_each = module. this . tags
324+ content {
325+ key = tag. key
326+ value = tag. value
327+ propagate_at_launch = true
328+ }
329+ }
325330 launch_template {
326331 id = aws_launch_template. default . id
327332 version = " $Latest"
0 commit comments