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

fix: Add enable variable in all resources #28

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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