diff --git a/README.md b/README.md index b76e51d..bda1493 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ Use [the awesome `gossm` project](https://github.com/gjbae1212/gossm). | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 0.13.0 | -| [aws](#requirement\_aws) | >= 3.0 | +| [aws](#requirement\_aws) | >= 4.0 | | [local](#requirement\_local) | >= 1.2 | | [null](#requirement\_null) | >= 2.0 | @@ -76,15 +76,14 @@ Use [the awesome `gossm` project](https://github.com/gjbae1212/gossm). | Name | Version | |------|---------| -| [aws](#provider\_aws) | 4.51.0 | +| [aws](#provider\_aws) | >= 4.0 | ## Modules | Name | Source | Version | |------|--------|---------| -| [asg\_label](#module\_asg\_label) | cloudposse/label/null | 0.25.0 | | [kms\_key](#module\_kms\_key) | cloudposse/kms-key/aws | 0.12.1 | -| [logs\_bucket](#module\_logs\_bucket) | cloudposse/s3-bucket/aws | 0.40.1 | +| [logs\_bucket](#module\_logs\_bucket) | cloudposse/s3-bucket/aws | 3.1.2 | | [logs\_label](#module\_logs\_label) | cloudposse/label/null | 0.25.0 | | [role\_label](#module\_role\_label) | cloudposse/label/null | 0.25.0 | | [this](#module\_this) | cloudposse/label/null | 0.25.0 | diff --git a/main.tf b/main.tf index 2a2dfe9..c96f9bc 100644 --- a/main.tf +++ b/main.tf @@ -1,16 +1,3 @@ -module "asg_label" { - source = "cloudposse/label/null" - version = "0.25.0" - - context = module.this.context - - # This tag attribute is required. - # See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_group#propagate_at_launch - additional_tag_map = { - propagate_at_launch = "true" - } -} - module "role_label" { source = "cloudposse/label/null" version = "0.25.0" @@ -204,7 +191,7 @@ DOC module "logs_bucket" { source = "cloudposse/s3-bucket/aws" - version = "0.40.1" + version = "3.1.2" enabled = local.logs_bucket_enabled context = module.logs_label.context @@ -220,28 +207,40 @@ module "logs_bucket" { user_enabled = false versioning_enabled = true - lifecycle_rules = [ - { - prefix = null - enabled = true - tags = {} - - enable_glacier_transition = true - enable_deeparchive_transition = false - enable_standard_ia_transition = false - enable_current_object_expiration = false - - abort_incomplete_multipart_upload_days = null - noncurrent_version_glacier_transition_days = 30 - noncurrent_version_deeparchive_transition_days = 0 - noncurrent_version_expiration_days = 365 - - standard_transition_days = 30 - glacier_transition_days = 90 - deeparchive_transition_days = 0 - expiration_days = 0 - }, - ] + lifecycle_configuration_rules = [{ + enabled = true + id = module.logs_label.id + abort_incomplete_multipart_upload_days = 90 + filter_and = null + + expiration = { + days = 0 + } + noncurrent_version_expiration = { + noncurrent_days = 365 + } + noncurrent_version_transition = [{ + noncurrent_days = 30 + storage_class = "GLACIER" + }, + { + noncurrent_days = 0 + storage_class = "DEEP_ARCHIVE" + }] + transition = [{ + days = 30 + storage_class = "STANDARD_IA" + }, + { + days = 90 + storage_class = "GLACIER" + }, + { + days = 0 + storage_class = "DEEP_ARCHIVE" + + }] + }] } resource "aws_cloudwatch_log_group" "session_logging" { @@ -319,9 +318,15 @@ resource "aws_launch_template" "default" { } resource "aws_autoscaling_group" "default" { - name_prefix = "${module.asg_label.id}-asg" - tags = module.asg_label.tags_as_list_of_maps - + name_prefix = "${module.this.id}-asg" + dynamic "tag" { + for_each = module.this.tags + content { + key = tag.key + value = tag.value + propagate_at_launch = true + } + } launch_template { id = aws_launch_template.default.id version = "$Latest" diff --git a/versions.tf b/versions.tf index d3ba302..b2d5c36 100644 --- a/versions.tf +++ b/versions.tf @@ -2,7 +2,7 @@ terraform { required_version = ">= 0.13.0" required_providers { - aws = ">= 3.0" + aws = ">= 4.0" local = ">= 1.2" null = ">= 2.0" }