Skip to content

Commit 05f2cb7

Browse files
committed
docs: clarify retention_days_cross_valid logical equivalence
Add inline comments explaining: - Why we use positive logic form (both not null) - Logical equivalence to the alternative form - Clearer intent of the expression - Prevents future confusion about this intentional transformation This responds to feedback about the validation logic by documenting that both forms are mathematically equivalent via De Morgan's Law, but our form is clearer for maintenance.
1 parent d6a6d1f commit 05f2cb7

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,36 @@ In case you get an error message similar to this one:
312312
error creating Backup Vault (): AccessDeniedException: status code: 403, request id: 8e7e577e-5b74-4d4d-95d0-bf63e0b2cc2e,
313313
```
314314

315+
Add the [required IAM permissions mentioned in the CreateBackupVault row](https://docs.aws.amazon.com/aws-backup/latest/devguide/access-control.html#backup-api-permissions-ref) to the role or user creating the Vault (the one running Terraform CLI). In particular make sure `kms` and `backup-storage` permissions are added.
316+
<!-- END_TF_DOCS -->
317+
318+
## Known Issues
319+
320+
During the development of the module, the following issues were found:
321+
322+
### Error creating Backup Vault
323+
324+
In case you get an error message similar to this one:
325+
326+
```
327+
error creating Backup Vault (): AccessDeniedException: status code: 403, request id: 8e7e577e-5b74-4d4d-95d0-bf63e0b2cc2e,
328+
```
329+
330+
Add the [required IAM permissions mentioned in the CreateBackupVault row](https://docs.aws.amazon.com/aws-backup/latest/devguide/access-control.html#backup-api-permissions-ref) to the role or user creating the Vault (the one running Terraform CLI). In particular make sure `kms` and `backup-storage` permissions are added.
331+
<!-- END_TF_DOCS -->
332+
333+
## Known Issues
334+
335+
During the development of the module, the following issues were found:
336+
337+
### Error creating Backup Vault
338+
339+
In case you get an error message similar to this one:
340+
341+
```
342+
error creating Backup Vault (): AccessDeniedException: status code: 403, request id: 8e7e577e-5b74-4d4d-95d0-bf63e0b2cc2e,
343+
```
344+
315345
Add the [required IAM permissions mentioned in the CreateBackupVault row](https://docs.aws.amazon.com/aws-backup/latest/devguide/access-control.html#backup-api-permissions-ref) to the role or user creating the Vault (the one running Terraform CLI). In particular make sure `kms` and `backup-storage` permissions are added.
316346

317347
## Testing

main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ 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+
# Uses positive logic form (both not null) instead of negative (either null) for clarity.
21+
# Logically equivalent to: (min == null || max == null) ? true : (min <= max)
22+
# This form is clearer: "if both exist, compare them; otherwise, it's valid"
2023
retention_days_cross_valid = (var.min_retention_days != null && var.max_retention_days != null) ? (var.min_retention_days <= var.max_retention_days) : true
2124

2225
# Vault reference helpers (dynamic based on vault type)

0 commit comments

Comments
 (0)