Skip to content

Terraform module to create an AWS elastic file system (EFS)

License

Notifications You must be signed in to change notification settings

philips-software/terraform-aws-efs

Repository files navigation

Terraform module for EFS

This repo contains a Terraform module to create an AWS EFS.

Terraform version

  • Terraform 0.12: Pin module to ~> 2+, submit pull request to branch develop
  • Terraform 0.11: Pin module to ~> 1.x, submit pull request to branch terrafomr011

Example usages:

See also the full examples.

module "efs" {
  source = "github.com/philips-software/terraform-aws-efs?ref=terraform012"

  environment    = "${var.environment}"
  subnet_ids     = "${var.private_subnet_ids}"
  vpc_id         = "${var.vpc_id}"
}

# The EFS module outputs user_data parts, which can be used in the following way.
data "template_cloudinit_config" "config" {

  ... other parts ....

  part {
    content_type = "${module.efs.amazon_linux_cloudinit_config_part["content_type"]}"
    content      = "${module.efs.amazon_linux_cloudinit_config_part["content"]}"
  }
}

Inputs

Name Description Type Default Required
creation_token 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. By default generated by Terraform. string "" no
encrypted Encrypt file system. bool "true" no
environment Name of the environment; will be prefixed to all resources string n/a yes
mount_location Used to create a cloud init config part for amazon linux instances. string "/efs" no
performance_mode maxIO string "generalPurpose" no
project Name of the project. string n/a yes
subnet_ids The created EFS will be available in these subnet ids list(string) n/a yes
tags A map of tags to add to the resources map(string) <map> no
transition_to_ia Indicates how long it takes to transition files to the IA storage class. Valid values: AFTER_7_DAYS, AFTER_14_DAYS, AFTER_30_DAYS, AFTER_60_DAYS, or AFTER_90_DAYS. string null no
vpc_id EFS is created in this VPC string n/a yes

Outputs

Name Description
amazon_linux_cloudinit_config_part Cloud init part to mount an EFS to an EC2 instance.
efs_dns_name List of DNS mount points, one per subnet.
efs_id Id of the EFS file system.

Automated checks

Currently the automated checks are limited. In CI the following checks are done for the root and each example.

  • lint: terraform validate and terraform fmt
  • basic init / get check: terraform init -get -backend=false -input=false

Generation variable documentation

A markdown table for variables can be generated as follow. Generation requires awk and terraform-docs installed.

 .ci/bin/terraform-docs.sh markdown .

Philips Forest

This module is part of the Philips Forest.

                                                     ___                   _
                                                    / __\__  _ __ ___  ___| |_
                                                   / _\/ _ \| '__/ _ \/ __| __|
                                                  / / | (_) | | |  __/\__ \ |_
                                                  \/   \___/|_|  \___||___/\__|  

                                                                 Infrastructure

Talk to the forestkeepers in the forest-channel on Slack.

Slack