diff --git a/_example/example.tf b/_example/example.tf index 56e148e..ac1772d 100644 --- a/_example/example.tf +++ b/_example/example.tf @@ -9,9 +9,8 @@ locals { } module "vpc" { - source = "clouddrove/vpc/aws" - version = "2.0.0" - + source = "clouddrove/vpc/aws" + version = "2.0.0" name = "vpc" environment = local.environment label_order = local.label_order @@ -19,9 +18,8 @@ module "vpc" { } module "subnets" { - source = "clouddrove/subnet/aws" - version = "2.0.0" - + source = "clouddrove/subnet/aws" + version = "2.0.0" name = "subnet" environment = local.environment label_order = local.label_order @@ -34,8 +32,7 @@ module "subnets" { } module "efs" { - source = "./.." - + source = "./.." name = "efs" environment = "test" creation_token = "changeme" diff --git a/main.tf b/main.tf index aad1249..2774e09 100644 --- a/main.tf +++ b/main.tf @@ -2,9 +2,9 @@ # Description : This Script is used to create security group. # Copyright @ CloudDrove. All Right Reserved. -####---------------------------------------------------------------------------------- -#Description : Terraform module to create consistent naming for multiple names. -####---------------------------------------------------------------------------------- +##------------------------------------------------------------------------------ +## Description : Terraform module to create consistent naming for multiple names. +##------------------------------------------------------------------------------ module "label" { source = "clouddrove/labels/aws" @@ -17,9 +17,9 @@ module "label" { enabled = var.efs_enabled } -####---------------------------------------------------------------------------------- -#Description :Provides an Elastic File System (EFS) File System resource. -####---------------------------------------------------------------------------------- +##------------------------------------------------------------------------------ +## Description :Provides an Elastic File System (EFS) File System resource. +##------------------------------------------------------------------------------ resource "aws_efs_file_system" "default" { count = var.efs_enabled ? 1 : 0 creation_token = var.creation_token @@ -31,9 +31,9 @@ resource "aws_efs_file_system" "default" { kms_key_id = var.kms_key_id } -####---------------------------------------------------------------------------------- -#Description : Provides an Elastic File System (EFS) mount target. -####---------------------------------------------------------------------------------- +##------------------------------------------------------------------------------ +## Description : Provides an Elastic File System (EFS) mount target. +##------------------------------------------------------------------------------ resource "aws_efs_mount_target" "default" { count = var.efs_enabled && length(var.availability_zones) > 0 ? length(var.availability_zones) : 0 file_system_id = join("", aws_efs_file_system.default[*].id) @@ -42,9 +42,9 @@ resource "aws_efs_mount_target" "default" { security_groups = [join("", aws_security_group.default[*].id)] } -####---------------------------------------------------------------------------------- -#Description : Provides a security group resource. -####---------------------------------------------------------------------------------- +##------------------------------------------------------------------------------ +## Description : Provides a security group resource. +##------------------------------------------------------------------------------ #tfsec:ignore:aws-ec2-add-description-to-security-group-rule resource "aws_security_group" "default" { count = var.efs_enabled ? 1 : 0 @@ -64,9 +64,9 @@ resource "aws_security_group" "default" { } ingress { - from_port = var.from_port # NFS - to_port = var.to_port - protocol = var.protocol + from_port = var.from_port # NFS + to_port = var.to_port + protocol = var.protocol cidr_blocks = var.allow_cidr #tfsec:ignore:aws-vpc-no-public-egress-sgr } @@ -81,9 +81,9 @@ resource "aws_security_group" "default" { tags = module.label.tags } -####---------------------------------------------------------------------------------- -#Description : Provides a security group resource. -####---------------------------------------------------------------------------------- +##------------------------------------------------------------------------------ +## Description : Provides a security group resource. +##------------------------------------------------------------------------------ resource "aws_efs_backup_policy" "policy" { count = var.efs_enabled && var.efs_backup_policy_enabled == "ENABLED" ? 1 : 0 @@ -94,21 +94,19 @@ resource "aws_efs_backup_policy" "policy" { } } -####---------------------------------------------------------------------------------- -#Description : Provides an Elastic File System (EFS) access point. -####---------------------------------------------------------------------------------- +##------------------------------------------------------------------------------ +## Description : Provides an Elastic File System (EFS) access point. +##------------------------------------------------------------------------------ resource "aws_efs_access_point" "default" { count = var.efs_enabled && var.access_point_enabled ? 1 : 0 file_system_id = join("", aws_efs_file_system.default[*].id) tags = module.label.tags } -data "aws_availability_zones" "available" {} -data "aws_caller_identity" "current" {} -################################################################################ -# Replication Configuration -################################################################################ +##------------------------------------------------------------------------------ +## Replication Configuration +##------------------------------------------------------------------------------ resource "aws_efs_replication_configuration" "this" { count = var.efs_enabled && var.replication_enabled ? 1 : 0 @@ -127,7 +125,7 @@ resource "aws_efs_replication_configuration" "this" { } resource "aws_efs_file_system_policy" "this" { - count = var.efs_enabled && var.aws_efs_file_system_policy? 1 : 0 + count = var.efs_enabled && var.aws_efs_file_system_policy ? 1 : 0 file_system_id = aws_efs_file_system.default[0].id bypass_policy_lockout_safety_check = var.bypass_policy_lockout_safety_check diff --git a/variables.tf b/variables.tf index 8761338..a558c6f 100644 --- a/variables.tf +++ b/variables.tf @@ -106,12 +106,6 @@ variable "availability_zones" { description = "Availability Zone IDs" } -variable "availability_zone" { - type = list(string) - default = ["us-east-1b", "us-east-1c"] - description = "Availability Zone IDs" -} - variable "encrypted" { type = bool default = true