Skip to content

Commit

Permalink
Allow node role to be set during node registration (#110)
Browse files Browse the repository at this point in the history
* Allow node role to be set during node registration

* Allow node role to be set during node registration

* fix typo
  • Loading branch information
andbyrne authored Jul 12, 2024
1 parent 5d9cf70 commit 732c6a4
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions aci_node_policies.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module "aci_node_registration" {
name = each.value.name
node_id = each.value.id
pod_id = try(each.value.pod, local.defaults.apic.node_policies.nodes.pod)
role = each.value.role
serial_number = each.value.serial_number
type = try(each.value.type, "unspecified")
remote_pool_id = try(each.value.remote_pool_id, 0)
Expand Down
2 changes: 2 additions & 0 deletions modules/terraform-aci-node-registration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module "aci_node_registration" {
name = "LEAF105"
node_id = 105
pod_id = 2
role = "leaf"
serial_number = "ABCDEFGHIJKLMN"
type = "remote-leaf-wan"
remote_pool_id = 2
Expand All @@ -42,6 +43,7 @@ module "aci_node_registration" {
| <a name="input_name"></a> [name](#input\_name) | Node name. | `string` | n/a | yes |
| <a name="input_node_id"></a> [node\_id](#input\_node\_id) | Node ID. Minimum value: 1. Maximum value: 4000. | `number` | n/a | yes |
| <a name="input_pod_id"></a> [pod\_id](#input\_pod\_id) | Pod ID. Minimum value: 1. Maximum value: 255. | `number` | `1` | no |
| <a name="input_role"></a> [role](#input\_role) | Node role. Choices: `leaf`, `spine`. | `string` | `"unspecified"` | no |
| <a name="input_serial_number"></a> [serial\_number](#input\_serial\_number) | Serial number. | `string` | n/a | yes |
| <a name="input_type"></a> [type](#input\_type) | Node type. Choices: `remote-leaf-wan`, `virtual`, `tier-2-leaf`, `unspecified`. | `string` | `"unspecified"` | no |
| <a name="input_remote_pool_id"></a> [remote\_pool\_id](#input\_remote\_pool\_id) | Remote Pool ID. Minimum value: 0. Maximum value: 255 | `number` | `0` | no |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module "aci_node_registration" {
name = "LEAF105"
node_id = 105
pod_id = 2
role = "leaf"
serial_number = "ABCDEFGHIJKLMN"
type = "remote-leaf-wan"
remote_pool_id = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module "aci_node_registration" {
name = "LEAF105"
node_id = 105
pod_id = 2
role = "leaf"
serial_number = "ABCDEFGHIJKLMN"
type = "remote-leaf-wan"
remote_pool_id = 2
Expand Down
1 change: 1 addition & 0 deletions modules/terraform-aci-node-registration/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ resource "aci_rest_managed" "fabricNodeIdentP" {
name = var.name
serial = var.serial_number
nodeId = var.node_id
role = var.role
nodeType = var.type
podId = var.pod_id
extPoolId = var.type == "remote-leaf-wan" ? var.remote_pool_id : null
Expand Down
11 changes: 11 additions & 0 deletions modules/terraform-aci-node-registration/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ variable "pod_id" {
}
}

variable "role" {
description = "Node role. Choices: `leaf`, `spine`."
type = string
default = "unspecified"

validation {
condition = contains(["leaf", "spine"], var.role)
error_message = "Allowed values: `leaf` or `spine`."
}
}

variable "serial_number" {
description = "Serial number."
type = string
Expand Down

0 comments on commit 732c6a4

Please sign in to comment.