From 624fd3c5b9281a4d4adc87d7d034c7660cc08ddb Mon Sep 17 00:00:00 2001 From: Eugene Selivanov Date: Fri, 19 Jan 2024 22:19:47 +0700 Subject: [PATCH] chore: add example for transition_to_archive and remove from common readme transition_to_archive don't work with provisioned throughput_mode --- README.md | 1 - examples/complete/README.md | 1 + examples/complete/main.tf | 84 +++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f67f91..2a2f8fc 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,6 @@ module "efs" { lifecycle_policy = { transition_to_ia = "AFTER_30_DAYS" - transition_to_archive = "AFTER_60_DAYS" } # File system policy diff --git a/examples/complete/README.md b/examples/complete/README.md index ffae145..f499561 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -37,6 +37,7 @@ Note that this example may create resources which will incur monetary charges on | Name | Source | Version | |------|--------|---------| | [efs](#module\_efs) | ../.. | n/a | +| [efs\_archive](#module\_efs\_archive) | ../.. | n/a | | [efs\_default](#module\_efs\_default) | ../.. | n/a | | [efs\_disabled](#module\_efs\_disabled) | ../.. | n/a | | [kms](#module\_kms) | terraform-aws-modules/kms/aws | ~> 1.0 | diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 327d336..6787a9b 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -106,6 +106,90 @@ module "efs" { tags = local.tags } +module "efs_archive" { + source = "../.." + + # File system + name = local.name + creation_token = local.name + encrypted = true + kms_key_arn = module.kms.key_arn + + performance_mode = "maxIO" + throughput_mode = "elastic" + + lifecycle_policy = { + transition_to_archive = "AFTER_60_DAYS" + transition_to_ia = "AFTER_30_DAYS" + transition_to_primary_storage_class = "AFTER_1_ACCESS" + } + + # File system policy + attach_policy = true + bypass_policy_lockout_safety_check = false + policy_statements = [ + { + sid = "Example" + actions = ["elasticfilesystem:ClientMount"] + principals = [ + { + type = "AWS" + identifiers = [data.aws_caller_identity.current.arn] + } + ] + } + ] + + # Mount targets / security group + mount_targets = { for k, v in zipmap(local.azs, module.vpc.private_subnets) : k => { subnet_id = v } } + security_group_description = "Example EFS security group" + security_group_vpc_id = module.vpc.vpc_id + security_group_rules = { + vpc = { + # relying on the defaults provdied for EFS/NFS (2049/TCP + ingress) + description = "NFS ingress from VPC private subnets" + cidr_blocks = module.vpc.private_subnets_cidr_blocks + } + } + + # Access point(s) + access_points = { + posix_example = { + name = "posix-example" + posix_user = { + gid = 1001 + uid = 1001 + secondary_gids = [1002] + } + + tags = { + Additionl = "yes" + } + } + root_example = { + root_directory = { + path = "/example" + creation_info = { + owner_gid = 1001 + owner_uid = 1001 + permissions = "755" + } + } + } + } + + # Backup policy + enable_backup_policy = true + + # Replication configuration + create_replication_configuration = true + replication_configuration_destination = { + region = "eu-west-2" + } + + tags = local.tags +} + module "efs_default" { source = "../.."