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

Terraform Module for EFS #35

Merged
merged 10 commits into from
Oct 12, 2023
5 changes: 5 additions & 0 deletions terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ This are various examples build using the above modules.
[Compute Engine -GCP](/terraform/gcp/modules/compute_engine/compute_engine.tf)

This module will create a VM instance with the image chosen by the user (defaults to Ubuntu 22.04)

### 6. EFS - AWS
[Elastic File System -AWS](/terraform/aws/modules/efs/efs.tf)

This module will create EFS in AWS via Terraform.
11 changes: 11 additions & 0 deletions terraform/aws/examples/efs/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module "efs" {
source = "../../modules/efs"
creation_token = "test-efs"
performance_mode = "generalPurpose"
throughput_mode = "bursting"

}

output "example_outputs" {
value = module.efs
}
19 changes: 19 additions & 0 deletions terraform/aws/examples/efs/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
terraform {
required_version = ">= 1.0.0"
}

provider "aws" {
region = var.region
default_tags {
tags = {
Environment = "Test"
Project = "QBurst"
}
}
}

variable "region" {
type = string
description = "The default region to use"
default = "ap-south-1"
}
20 changes: 20 additions & 0 deletions terraform/aws/modules/efs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# EFS Module
This module will create EFS. As a part of the module it will generate the following

- 1 EFS in bursting throughput mode .



## Inputs
**Important**
All inputs :heavy_check_mark: must be configured.
Any with :x: can be ignored, but can be configurd if you want.

| Name | Description | Required | Type | Default |
| ----------- | ----------- | -------- | ---- | ------- |
| 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 | :x: | string | If not provided, it will generated by Terraform|
| performance_mode | The file system performance mode | :x:| string | "generalPurpose" |
| throughput_mode | Throughput mode for the file system | :x: | string | "bursting" |



11 changes: 11 additions & 0 deletions terraform/aws/modules/efs/efs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*This will create EFS in bursting mode.The mode can be changed as per the requirement*/
resource "aws_efs_file_system" "elastic_file_system" {
creation_token = var.creation_token

lifecycle_policy {
transition_to_ia = "AFTER_30_DAYS"
}
qburst-praven marked this conversation as resolved.
Show resolved Hide resolved
performance_mode = var.performance_mode
throughput_mode = var.throughput_mode
}

qburst-praven marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 8 additions & 0 deletions terraform/aws/modules/efs/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
output "efs_id" {
value = aws_efs_file_system.elastic_file_system.id
description = "The ID of the EFS created"
}
output "efs_arn" {
value = aws_efs_file_system.elastic_file_system.arn
description = "The ARN of the EFS created"
}
15 changes: 15 additions & 0 deletions terraform/aws/modules/efs/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
variable "creation_token" {
type = string
default = "test-efs"

}
variable "performance_mode" {
type = string
default = "generalPurpose"

}
variable "throughput_mode" {
type = string
default = "bursting"

}