Skip to content

Commit

Permalink
fix: Create backup policy conditionally (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeenadeepak authored Dec 9, 2022
1 parent 288b884 commit 6154c0c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ No modules.
| <a name="input_availability_zone_name"></a> [availability\_zone\_name](#input\_availability\_zone\_name) | The AWS Availability Zone in which to create the file system. Used to create a file system that uses One Zone storage classes | `string` | `null` | no |
| <a name="input_bypass_policy_lockout_safety_check"></a> [bypass\_policy\_lockout\_safety\_check](#input\_bypass\_policy\_lockout\_safety\_check) | A flag to indicate whether to bypass the `aws_efs_file_system_policy` lockout safety check. Defaults to `false` | `bool` | `null` | no |
| <a name="input_create"></a> [create](#input\_create) | Determines whether resources will be created (affects all resources) | `bool` | `true` | no |
| <a name="input_create_backup_policy"></a> [create\_backup\_policy](#input\_create\_backup\_policy) | Determines whether a backup policy is created | `bool` | `true` | no |
| <a name="input_create_replication_configuration"></a> [create\_replication\_configuration](#input\_create\_replication\_configuration) | Determines whether a replication configuration is created | `bool` | `false` | no |
| <a name="input_create_security_group"></a> [create\_security\_group](#input\_create\_security\_group) | Determines whether a security group is created | `bool` | `true` | no |
| <a name="input_creation_token"></a> [creation\_token](#input\_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. By default generated by Terraform | `string` | `null` | no |
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ resource "aws_efs_access_point" "this" {
################################################################################

resource "aws_efs_backup_policy" "this" {
count = var.create ? 1 : 0
count = var.create && var.create_backup_policy ? 1 : 0

file_system_id = aws_efs_file_system.this[0].id

Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ variable "access_points" {
# Backup Policy
################################################################################

variable "create_backup_policy" {
description = "Determines whether a backup policy is created"
type = bool
default = true
}

variable "enable_backup_policy" {
description = "Determines whether a backup policy is `ENABLED` or `DISABLED`"
type = bool
Expand Down

0 comments on commit 6154c0c

Please sign in to comment.