Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform Version
DCNM version
Affected Resource(s)
Terraform Configuration Files
resource "dcnm_inventory" "fabric" {
fabric_name = "SIMPL-BROWNFIELD"
username = "admin"
password = "cisco.123"
max_hops = 0
preserve_config = "true"
auth_protocol = 0
config_timeout = 15
switch_config {
ip = "1.2.3.4"
role = "leaf"
}
}
Expected Behavior
Switches should be added to the fabric with the field Mode set to "Migration"
Actual Behavior
Switches should baree added to the fabric with the field Mode set to "Normal"
Steps to Reproduce
terraform apply
Important Factoids
The terraform resource exposes the preserve_config flag, which is meant for brownfield migrations but the Go code sends an incorrect payload to the NDFC API. Here an example
{
"cdpSecondTimeout": 0,
"maxHops": 0,
"password": "cisco.123",
"preserveConfig": "true",
"seedIP": "1.2.3.4",
"snmpV3AuthProtocol": 0,
"switches": [
{
"auth": "true",
"deviceIndex": "LF101(FDO2139044J)",
"hopCount": 0,
"ipaddr": "1.2.3.4",
"known": "false",
"lastChange": "null",
"platform": "N9K-C93180YC-EX",
"reachable": "true",
"selectable": "true",
"statusReason": "manageable",
"sysName": "LF101",
"valid": "true",
"version": "9.3(2)"
}
],
"username": "admin"
}
The field preserveConfig must be a true boolean. The field serialNumber is missing inside the switches. Without those two conditions the switch is added to the fabric with mode "Normal"
Furthermore, the Go code seems "not to like" the mode "Migration"
|
if models.G(cont, "mode") != "Migration" { |
. Was this provider developed to not support Brownfield migration?
Community Note
Terraform Version
DCNM version
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
Switches should be added to the fabric with the field Mode set to "Migration"
Actual Behavior
Switches should baree added to the fabric with the field Mode set to "Normal"
Steps to Reproduce
terraform applyImportant Factoids
The terraform resource exposes the
preserve_configflag, which is meant for brownfield migrations but the Go code sends an incorrect payload to the NDFC API. Here an example{ "cdpSecondTimeout": 0, "maxHops": 0, "password": "cisco.123", "preserveConfig": "true", "seedIP": "1.2.3.4", "snmpV3AuthProtocol": 0, "switches": [ { "auth": "true", "deviceIndex": "LF101(FDO2139044J)", "hopCount": 0, "ipaddr": "1.2.3.4", "known": "false", "lastChange": "null", "platform": "N9K-C93180YC-EX", "reachable": "true", "selectable": "true", "statusReason": "manageable", "sysName": "LF101", "valid": "true", "version": "9.3(2)" } ], "username": "admin" }The field
preserveConfigmust be atrueboolean. The fieldserialNumberis missing inside the switches. Without those two conditions the switch is added to the fabric with mode "Normal"Furthermore, the Go code seems "not to like" the mode "Migration"
terraform-provider-dcnm/dcnm/resource_dcnm_inventory.go
Line 1017 in d0ff6c3