Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added support in lifecycle_policy with transition_to_archive #24

Merged
merged 6 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module "efs" {
provisioned_throughput_in_mibps = 256

lifecycle_policy = {
transition_to_ia = "AFTER_30_DAYS"
transition_to_ia = "AFTER_30_DAYS"
glavk marked this conversation as resolved.
Show resolved Hide resolved
}

# File system policy
Expand Down
1 change: 1 addition & 0 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Note that this example may create resources which will incur monetary charges on
| Name | Source | Version |
|------|--------|---------|
| <a name="module_efs"></a> [efs](#module\_efs) | ../.. | n/a |
| <a name="module_efs_archive"></a> [efs\_archive](#module\_efs\_archive) | ../.. | n/a |
| <a name="module_efs_default"></a> [efs\_default](#module\_efs\_default) | ../.. | n/a |
| <a name="module_efs_disabled"></a> [efs\_disabled](#module\_efs\_disabled) | ../.. | n/a |
| <a name="module_kms"></a> [kms](#module\_kms) | terraform-aws-modules/kms/aws | ~> 1.0 |
Expand Down
83 changes: 83 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,89 @@ module "efs" {
tags = local.tags
}

module "efs_archive" {
glavk marked this conversation as resolved.
Show resolved Hide resolved
source = "../.."

# File system
name = local.name
creation_token = local.name
encrypted = true
kms_key_arn = module.kms.key_arn

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 = "../.."

Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ resource "aws_efs_file_system" "this" {

content {
transition_to_ia = try(lifecycle_policy.value.transition_to_ia, null)
transition_to_archive = try(lifecycle_policy.value.transition_to_archive, null)
bryantbiggs marked this conversation as resolved.
Show resolved Hide resolved
transition_to_primary_storage_class = try(lifecycle_policy.value.transition_to_primary_storage_class, null)
}
}
Expand Down