Skip to content

Commit 08a7a7d

Browse files
committed
Adding Validation
1 parent 9efe1b7 commit 08a7a7d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

modules/network/gpu-rdma-vpc/variables.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,14 @@ variable "subnetworks_template" {
6767
validation {
6868
# If it's NOT a RoCE Metal profile, the template cannot be null
6969
condition = (
70-
can(regex("vpc-roce-metal", var.network_profile)) ||
70+
can(regex("vpc-roce-metal", var.network_profile)) ?
71+
var.subnetworks_template == null :
7172
var.subnetworks_template != null
7273
)
73-
error_message = "subnetworks_template cannot be null unless using a 'vpc-roce-metal' network profile."
74+
error_message = "subnetworks_template must be null when using 'vpc-roce-metal' network profile and non-null for all other profiles."
7475
}
7576

76-
validation {
77+
validation {
7778
# If template is provided, count must be > 0
7879
condition = var.subnetworks_template == null ? true : var.subnetworks_template.count > 0
7980
error_message = "Number of subnetworks must be greater than 0."

0 commit comments

Comments
 (0)