Skip to content

Commit

Permalink
fix: variable added to enable or disable policy
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolnagpal committed Aug 30, 2023
1 parent 115d1e3 commit 27f7786
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
4 changes: 2 additions & 2 deletions _example/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ module "efs" {
subnets = module.subnets.public_subnet_id
security_groups = [module.vpc.vpc_default_security_group_id]
efs_backup_policy_enabled = true
allow_cidr = ["10.0.0.0/16"] #vpc_cidr
allow_cidr = [module.vpc.vpc_cidr_block] #vpc_cidr
replication_enabled = true
replication_configuration_destination = {
region = "eu-west-2"
availability_zone_name = ["eu-west-2a", "eu-west-2b"]
}
}
}
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ resource "aws_efs_replication_configuration" "this" {
}

resource "aws_efs_file_system_policy" "this" {
count = var.efs_enabled ? 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
Expand Down
22 changes: 14 additions & 8 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,42 +33,42 @@ variable "security_groups" {
}
variable "from_port" {
type = number
default = 2049
default = 2049
description = "Security group IDs to allow access to the EFS"
}

variable "to_port" {
type = number
default = 2049
default = 2049
description = "Security group IDs to allow access to the EFS"
}

variable "egress_from_port" {
type = number
default = 0
default = 0
description = "Security group IDs to allow access to the EFS"
}
variable "egress_to_port" {
type = number
default = 0
default = 0
description = "Security group IDs to allow access to the EFS"
}

variable "protocol" {
type = string
default = "tcp"
default = "tcp"
description = "Security group IDs to allow access to the EFS"
}

variable "egress_protocol" {
type = number
default = -1
default = -1
description = "Security group IDs to allow access to the EFS"
}

variable "egress_cidr_blocks" {
type = list(string)
default = ["0.0.0.0/0"]
default = ["0.0.0.0/0"]
description = "Security group IDs to allow access to the EFS"
}

Expand Down Expand Up @@ -181,6 +181,12 @@ variable "bypass_policy_lockout_safety_check" {
default = null
}

variable "aws_efs_file_system_policy" {
description = "A flag to enable or disable aws efs file system policy . Defaults to `false`"
type = bool
default = false
}

variable "replication_configuration_destination" {
description = "A destination configuration block"
type = any
Expand Down Expand Up @@ -208,5 +214,5 @@ variable "policy_statements" {
variable "deny_nonsecure_transport" {
description = "Determines whether `aws:SecureTransport` is required when connecting to elastic file system"
type = bool
default = true
default = false
}

0 comments on commit 27f7786

Please sign in to comment.