Skip to content

austincloudguru/terraform-aws-efs

Repository files navigation

AWS EFS Terraform Module

Terratest Latest Version License

Terraform module that creates an Elastic File System on AWS along with the mount targets. It also creates a security group that allows access to 2049 to any instance that has the security group attached to it.

Usage

module "efs-0" {
  source                 = "AustinCloudGuru/efs/aws"
  # You should pin the module to a specific version
  # version              = "x.x.x"
  vpc_id                 = "vpc-0156c7c6959ba5858"
  name                   = "dev-efs"
  subnet_ids             = ["subnet-05b1a3ffd786709d5", "subnet-0a35212c972a2af05", "subnet-0d0e78f696428aa28"]
  security_group_ingress = {
                             default = {
                               description = "NFS Inbound"
                               from_port   = 2049
                               protocol    = "tcp"
                               to_port     = 2049
                               self        = true
                               cidr_blocks = []
                             },
                             ssh = {
                               description = "ssh"
                               from_port   = 22
                               protocol    = "tcp"
                               to_port     = 22
                               self        = true
                               cidr_blocks = []
                             }
                           }
  lifecycle_policy = [{
                        "transition_to_ia" = "AFTER_30_DAYS"
                     }]
  tags          = {
                    Terraform = "true"
                    Environment = "development"
                  } 
}

Requirements

Name Version
terraform ~> 1.8.0
aws ~> 5.0

Providers

Name Version
aws ~> 5.0

Modules

No modules.

Resources

Name Type
aws_efs_backup_policy.this resource
aws_efs_file_system.this resource
aws_efs_mount_target.this resource
aws_security_group.this resource
aws_security_group_rule.this_egress resource
aws_security_group_rule.this_ingress resource

Inputs

Name Description Type Default Required
backup_policy_status Enable/disable backup for EFS Filesystem. Value should be ENABLE/DISABLED. Defaults to DISABLED string "DISABLED" no
encrypted If true, the file system will be encrypted bool true no
kms_key_id If set, use a specific KMS key string null no
lifecycle_policy Lifecycle Policy for the EFS Filesystem
list(object({
transition_to_ia = string
}))
[] no
name A unique name (a maximum of 64 characters are allowed) used as reference when creating the Elastic File System to ensure idempotent file system creation. string n/a yes
performance_mode The file system performance mode. string null no
provisioned_throughput_in_mibps The throughput, measured in MiB/s, that you want to provision for the file system. Only applicable with throughput_mode set to provisioned. string null no
security_group_egress Can be specified multiple times for each egress rule.
map(object({
description = string
from_port = number
protocol = string
to_port = number
self = bool
cidr_blocks = list(string)
}))
{
"default": {
"cidr_blocks": [
"0.0.0.0/0"
],
"description": "Allow All Outbound",
"from_port": 0,
"protocol": "-1",
"self": false,
"to_port": 0
}
}
no
security_group_ingress Can be specified multiple times for each ingress rule.
map(object({
description = string
from_port = number
protocol = string
to_port = number
self = bool
cidr_blocks = list(string)
}))
{
"default": {
"cidr_blocks": null,
"description": "NFS Inbound",
"from_port": 2049,
"protocol": "tcp",
"self": true,
"to_port": 2049
}
}
no
subnet_ids Subnet IDs for Mount Targets list(string) n/a yes
tags A map of tags to add to all resources map(string) {} no
throughput_mode Throughput mode for the file system. string null no
vpc_id The name of the VPC that EFS will be deployed to string n/a yes

Outputs

Name Description
arn EFS ARN
dns_name EFS DNS name
id EFS ID
mount_target_ids List of EFS mount target IDs (one per Availability Zone)
security_group_arn EFS Security Group ARN
security_group_id EFS Security Group ID
security_group_name EFS Security Group name

About

Terraform module for deploying EFS

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages