Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:updated C8000V SDWAN module #33

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/c8000v-sdwan-ha/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ resource "equinix_network_file" "c8k_bootstrap_file_sec" {
}

data "equinix_network_account" "ny" {
name = "test_account."
name = "test_account"
metro_code = "NY"
project_id = "f1a596ed-d24a-497c-92a8-44e0923cee62"
}
2 changes: 1 addition & 1 deletion examples/c8000v-sdwan-single/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Note that this example may create resources which cost money. Run 'terraform des

| Name | Type |
|------|------|
| [equinix_network_acl_template.c8000v_sdwan_single_wan_acl_template](https://registry.terraform.io/providers/equinix/equinix/latest/docs/resources/network_acl_template) | resource |
| [equinix_network_acl_template.c8000v_sdwan_single_wan_acl_template](https://registry.terraform.io/providers/equinix/equinix/latest/docs/resources/equinix_network_acl_template) | resource |

## Inputs

Expand Down
38 changes: 24 additions & 14 deletions modules/c8000v-sdwan/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ variable "name" {
description = "Device name"
type = string
validation {
condition = length(var.name) >= 2 && length(var.name) <= 50
error_message = "Device name should consist of 2 to 50 characters."
condition = length(var.name) >= 3 && length(var.name) <= 50
error_message = "Device name should consist of 3 to 50 characters."
}
}

Expand All @@ -48,7 +48,7 @@ variable "cloud_init_file_id" {
type = string
validation {
condition = length(var.cloud_init_file_id) > 0
error_message = "Cloud-Init bootstrap is mandatory."
error_message = "Cloud-Init bootstrap file is mandatory."
}
}

Expand All @@ -75,7 +75,7 @@ variable "acl_template_id" {
type = string
validation {
condition = length(var.acl_template_id) > 0
error_message = "acl template is mandatory."
error_message = "Acl template is mandatory."
}
}

Expand All @@ -85,7 +85,7 @@ variable "additional_bandwidth" {
default = 0
validation {
condition = var.additional_bandwidth == 0 || (var.additional_bandwidth >= 25 && var.additional_bandwidth <= 5001)
error_message = "Additional internet bandwidth should be between 25 and 2001 Mbps."
error_message = "Additional internet bandwidth should be between 25 and 5001 Mbps."
}
}

Expand Down Expand Up @@ -137,14 +137,14 @@ variable "secondary" {
})
default = {
enabled = false
metro_code = ""
cloud_init_file_id = ""
acl_template_id = ""
account_number = ""
metro_code = null
cloud_init_file_id = null
acl_template_id = null
account_number = null
vendor_configuration = {
hostname = ""
siteId = ""
systemIpAddress = ""
hostname = null
siteId = null
systemIpAddress = null
}
additional_bandwidth = null
}
Expand All @@ -157,9 +157,19 @@ variable "secondary" {
condition = try(var.secondary.additional_bandwidth >= 25 && var.secondary.additional_bandwidth <= 5001, true)
error_message = "Key 'additional_bandwidth' has to be between 25 and 2001 Mbps."
}

validation {
condition = try(!var.secondary.enabled || (length(var.secondary.account_number) > 0 && var.secondary.account_number != null), true)
error_message = "Secondary account number must not be blank or null when secondary is enabled."
}

validation {
condition = try(!var.secondary.enabled || length(var.secondary.cloud_init_file_id) > 0, true)
error_message = "Secondary Cloud-Init bootstrap file is mandatory."
}
validation {
condition = try(var.secondary.acl_template_id != null, true)
error_message = "WAN ACL template is required."
condition = try(var.secondary.enabled == false || var.secondary.acl_template_id != null, true)
error_message = "Secondary WAN ACL template is required."
}
validation {
condition = var.secondary.enabled ? can(length(var.secondary.vendor_configuration.hostname)) && length(var.secondary.vendor_configuration.hostname) >= 2 && length(var.secondary.vendor_configuration.hostname) <= 10 : true
Expand Down
Loading