https://github.com/tomarv2/terraform-aws-efs
Terraform module for EFS(Elastic File System)
https://github.com/tomarv2/terraform-aws-efs
aws aws-efs terraform terraform-module
Last synced: 7 months ago
JSON representation
Terraform module for EFS(Elastic File System)
- Host: GitHub
- URL: https://github.com/tomarv2/terraform-aws-efs
- Owner: tomarv2
- License: apache-2.0
- Created: 2021-02-17T20:03:02.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-04T04:57:22.000Z (over 2 years ago)
- Last Synced: 2025-03-22T15:49:52.198Z (7 months ago)
- Topics: aws, aws-efs, terraform, terraform-module
- Language: HCL
- Homepage:
- Size: 56.6 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Terraform module for [AWS EFS](https://registry.terraform.io/modules/tomarv2/efs/aws/latest)
####
> :arrow_right: Terraform module for [Google Filestore](https://registry.terraform.io/modules/tomarv2/filestore/google/latest)
> :arrow_right: Terraform module for [Azure Storage Share](https://registry.terraform.io/modules/tomarv2/mysql/azure/latest)
### Versions
- Module tested for Terraform 1.0.1.
- AWS provider version [3.74](https://registry.terraform.io/providers/hashicorp/aws/latest)
- `main` branch: Provider versions not pinned to keep up with Terraform releases
- `tags` releases: Tags are pinned with versions (use
in your releases)
### Usage
#### Option 1:
```
terrafrom init
terraform plan -var='teamid=tryme' -var='prjid=project1'
terraform apply -var='teamid=tryme' -var='prjid=project1'
terraform destroy -var='teamid=tryme' -var='prjid=project1'
```
**Note:** With this option please take care of remote state storage#### Option 2:
##### Recommended method (stores remote state in S3 using `prjid` and `teamid` to create directory structure):
- Create python 3.8+ virtual environment
```
python3 -m venv
```- Install package:
```
pip install tfremote --upgrade
```- Set below environment variables:
```
export TF_AWS_BUCKET=
export TF_AWS_BUCKET_REGION=us-west-2
export TF_AWS_PROFILE=
```or
- Set below environment variables:
```
export TF_AWS_BUCKET=
export TF_AWS_BUCKET_REGION=us-west-2
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
```- Updated `examples` directory with required values.
- Run and verify the output before deploying:
```
tf -c=aws plan -var='teamid=foo' -var='prjid=bar'
```- Run below to deploy:
```
tf -c=aws apply -var='teamid=foo' -var='prjid=bar'
```- Run below to destroy:
```
tf -c=aws destroy -var='teamid=foo' -var='prjid=bar'
```**Note:** Read more on [tfremote](https://github.com/tomarv2/tfremote)
##### EFS
```
module "efs" {
source = "../"security_groups = []
#-------------------------------------------
# Do not change the teamid, prjid once set.
teamid = var.teamid
prjid = var.prjid
}
```#### EFS with Security Group
```
module "common" {
source = "git::git@github.com:tomarv2/terraform-global.git//common?ref=v0.0.1"
}module "efs" {
source = "../"security_groups = [module.security_group.security_group_id]
encrypted = true
#-------------------------------------------
# Do not change the teamid, prjid once set.
teamid = var.teamid
prjid = var.prjid
}module "security_group" {
source = "git::git@github.com:tomarv2/terraform-aws-security-group.git?ref=v0.0.2"security_group_ingress = {
default = {
description = "https"
from_port = 443
protocol = "tcp"
to_port = 443
self = true
cidr_blocks = []
type = "ingress"
},
ssh = {
description = "ssh"
from_port = 22
protocol = "tcp"
to_port = 22
self = false
cidr_blocks = module.common.cidr_for_sec_grp_access
type = "ingress"
}
}
#-------------------------------------------
# Do not change the teamid, prjid once set.
teamid = var.teamid
prjid = var.prjid
}
```Please refer to examples directory [link](examples) for references.
## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0.1 |
| [aws](#requirement\_aws) | ~> 3.74 |## Providers
| Name | Version |
|------|---------|
| [aws](#provider\_aws) | ~> 3.74 |## Modules
| Name | Source | Version |
|------|--------|---------|
| [global](#module\_global) | git::git@github.com:tomarv2/terraform-global.git//aws | v0.0.1 |## Resources
| Name | Type |
|------|------|
| [aws_efs_access_point.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/efs_access_point) | resource |
| [aws_efs_file_system.efs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/efs_file_system) | resource |
| [aws_efs_mount_target.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/efs_mount_target) | resource |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [access\_points](#input\_access\_points) | A map of the access points you would like in your EFS volume | `map(map(map(any)))` | `{}` | no |
| [deploy\_efs](#input\_deploy\_efs) | Feature flag, true or false | `bool` | `true` | no |
| [efs\_mount\_target](#input\_efs\_mount\_target) | Feature flag, true or false | `bool` | `true` | no |
| [encrypted](#input\_encrypted) | The disk will be encrypted | `bool` | `true` | no |
| [file\_system\_id](#input\_file\_system\_id) | The ID of the file system for which the mount target is intended | `string` | `null` | no |
| [kms\_key\_id](#input\_kms\_key\_id) | The ARN for the KMS encryption key. When specifying kms\_key\_id, encrypted needs to be set to true. | `string` | `""` | no |
| [mount\_target\_ip\_address](#input\_mount\_target\_ip\_address) | The address (within the address range of the specified subnet) at which the file system may be mounted via the mount target | `string` | `null` | no |
| [name](#input\_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. By default generated by Terraform. See [Elastic File System] (http://docs.aws.amazon.com/efs/latest/ug/) user guide for more information | `string` | `null` | no |
| [performance\_mode](#input\_performance\_mode) | The performance mode of your file system. | `string` | `"generalPurpose"` | no |
| [prjid](#input\_prjid) | Name of the project/stack e.g: mystack, nifieks, demoaci. Should not be changed after running 'tf apply' | `string` | n/a | yes |
| [provisioned\_throughput](#input\_provisioned\_throughput) | Provisioned throughput (in mbps) | `string` | `null` | no |
| [security\_groups](#input\_security\_groups) | Security Groups | `list(any)` | n/a | yes |
| [teamid](#input\_teamid) | Name of the team/group e.g. devops, dataengineering. Should not be changed after running 'tf apply' | `string` | n/a | yes |
| [throughput\_mode](#input\_throughput\_mode) | Throughput mode for the file system. Defaults to bursting. Valid values: bursting, provisioned. When using provisioned, also set provisioned\_throughput\_in\_mibps. | `string` | `"bursting"` | no |
| [transition\_to\_ia](#input\_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 and AFTER\_90\_DAYS | `string` | `""` | no |## Outputs
| Name | Description |
|------|-------------|
| [file\_system\_arn](#output\_file\_system\_arn) | Amazon Resource Name of the file system |
| [file\_system\_dns\_name](#output\_file\_system\_dns\_name) | The DNS name for the EFS file system |
| [file\_system\_id](#output\_file\_system\_id) | The ID of the file system for which the mount target is intended |