Skip to content

Commit 122c2cf

Browse files
fix: updated variable validation for bucket_configs in fscloud submodule (#507)
1 parent f5db77c commit 122c2cf

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

modules/fscloud/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ locals {
66
validate_sysdig_set = can(bucket.metrics_monitoring.metrics_monitoring_crn) ? bucket.metrics_monitoring.metrics_monitoring_crn == null ? tobool("When metrics_monitoring is set, metrics_monitoring_crn must be provided.") : null : null,
77
validate_hpcs_instance_guid = bucket.skip_iam_authorization_policy == false && bucket.kms_guid == null ? tobool("'kms_guid' must be provided if 'skip_iam_authorization_policy' is set to false") : null,
88
validate_hpcs_key_crn = bucket.kms_key_crn == null ? tobool("When kms_encryption_enabled is set, kms_key_crn must be provided.") : null,
9-
validate_kms_encryption = !bucket.kms_encryption_enabled ? tobool("kms_encryption_enabled must be set to true for all buckets.") : null,
109
}
1110
]
1211
}

modules/fscloud/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ variable "bucket_configs" {
137137
}))
138138
description = "Cloud Object Storage bucket configurations"
139139
default = []
140+
141+
validation {
142+
condition = length([for bucket_config in var.bucket_configs : true if contains([true], bucket_config.kms_encryption_enabled)]) == length(var.bucket_configs)
143+
error_message = "The FSCloud submodule mandates that kms_encryption_enabled is set to true for all buckets in bucket_configs input variable value."
144+
}
140145
}
141146

142147

0 commit comments

Comments
 (0)