Skip to content

Commit 38072de

Browse files
claude[bot]lgallard
andcommitted
fix: retention_days validation logic for backward compatibility
The retention_days_cross_valid validation was causing 'argument must not be null' errors in Terraform 1.6.0-1.11.4 and OpenTofu 1.6.0-1.9.3 when both min_retention_days and max_retention_days were null (valid for standard vaults). Changed from logical OR to conditional expression to handle null values properly: - Returns true if either value is null (valid for standard vaults) - Only performs min <= max comparison when both values are provided - Maintains existing validation for air-gapped vaults via airgapped_vault_requirements_met This ensures backward compatibility with older Terraform/OpenTofu versions while preserving functionality for newer versions. Fixes #281 Co-authored-by: Luis M. Gallardo D. <lgallard@users.noreply.github.com>
1 parent 1bc55d9 commit 38072de

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ locals {
1717
airgapped_vault_requirements_met = var.vault_type != "logically_air_gapped" || (var.min_retention_days != null && var.max_retention_days != null)
1818

1919
# Cross-validation for retention days (unified validation approach)
20-
retention_days_cross_valid = (var.min_retention_days == null || var.max_retention_days == null) || var.min_retention_days <= var.max_retention_days
20+
retention_days_cross_valid = (var.min_retention_days == null || var.max_retention_days == null) ? true : var.min_retention_days <= var.max_retention_days
2121

2222
# Vault reference helpers (dynamic based on vault type)
2323
vault_name = local.should_create_standard_vault ? try(aws_backup_vault.ab_vault[0].name, null) : (

0 commit comments

Comments
 (0)