Skip to content

Commit 3188c8e

Browse files
committed
Fix Precommit
1 parent 4ee4d8f commit 3188c8e

3 files changed

Lines changed: 19 additions & 12 deletions

File tree

modules/network/gpu-rdma-vpc/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ limitations under the License.
9797
9898
## Providers
9999
100-
No providers.
100+
| Name | Version |
101+
|------|---------|
102+
| <a name="provider_terraform"></a> [terraform](#provider\_terraform) | n/a |
101103
102104
## Modules
103105
@@ -107,7 +109,9 @@ No providers.
107109
108110
## Resources
109111
110-
No resources.
112+
| Name | Type |
113+
|------|------|
114+
| [terraform_data.network_profile_validation](https://registry.terraform.io/providers/hashicorp/terraform/latest/docs/resources/data) | resource |
111115
112116
## Inputs
113117

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,16 @@ module "vpc" {
8282
firewall_rules = local.firewall_rules
8383
network_profile = var.network_profile
8484
}
85+
86+
resource "terraform_data" "network_profile_validation" {
87+
lifecycle {
88+
precondition {
89+
condition = (
90+
can(regex("vpc-roce-metal", var.network_profile)) ?
91+
var.subnetworks_template == null :
92+
var.subnetworks_template != null
93+
)
94+
error_message = "subnetworks_template must be null when using 'vpc-roce-metal' network profile and non-null for all other profiles."
95+
}
96+
}
97+
}

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,6 @@ variable "subnetworks_template" {
6464
region = null
6565
}
6666

67-
validation {
68-
# If it's NOT a RoCE Metal profile, the template cannot be null
69-
condition = (
70-
can(regex("vpc-roce-metal", var.network_profile)) ?
71-
var.subnetworks_template == null :
72-
var.subnetworks_template != null
73-
)
74-
error_message = "subnetworks_template must be null when using 'vpc-roce-metal' network profile and non-null for all other profiles."
75-
}
76-
7767
validation {
7868
# If template is provided, count must be > 0
7969
condition = var.subnetworks_template == null ? true : var.subnetworks_template.count > 0

0 commit comments

Comments
 (0)