Skip to content

Commit

Permalink
fix: Add enable variable in all resources (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
13archit committed Oct 17, 2023
1 parent c0e4a16 commit 57ee695
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ resource "aws_security_group" "default" {
## Description : Provides a security group resource.
##------------------------------------------------------------------------------
resource "aws_efs_backup_policy" "policy" {
count = var.efs_enabled && var.efs_backup_policy_enabled == "ENABLED" ? 1 : 0
count = var.efs_enabled && var.efs_backup_policy_enabled ? 1 : 0

file_system_id = join("", aws_efs_file_system.default[*].id)

Expand Down Expand Up @@ -125,16 +125,14 @@ 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.enable_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
policy = data.aws_iam_policy_document.policy[0].json
}

data "aws_iam_policy_document" "policy" {
count = var.efs_enabled ? 1 : 0

count = var.efs_enabled && var.enable_aws_efs_file_system_policy ? 1 : 0
source_policy_documents = var.source_policy_documents
override_policy_documents = var.override_policy_documents

Expand Down
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ variable "mount_target_description" {
variable "bypass_policy_lockout_safety_check" {
description = "A flag to indicate whether to bypass the `aws_efs_file_system_policy` lockout safety check. Defaults to `false`"
type = bool
default = null
default = false
}

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

0 comments on commit 57ee695

Please sign in to comment.