Closed aj-cruz closed 1 year ago
Hi,
It seems that this is an NX-API limitation/feature. According to the outputs below to create a vpc port-channel the NX-API requires bothvpcIf
and vpcRsVpcConf
objects at the same time.
nxos_rest
can only manage a single API object. Which means that it is not possible to configure vpc port-channel via nxos_rest
. This will require a new custom resource. @danischm please correct if I am wrong.
Not working example. POST:
{
"vpcIf": {
"attributes": {
"id": "22"
}
}
}
Results in
{
"imdata": [
{
"error": {
"attributes": {
"code": "1",
"text": "ERROR: vPC configuration does not exist\nfaulty_dn=sys/vpc/inst/dom/if-22"
}
}
}
]
}
Working example. POST:
{
"vpcIf": {
"attributes": {
"id": "21"
},
"children": [
{
"vpcRsVpcConf": {
"attributes": {
"tDn": "sys/intf/aggr-[po21]"
}
}
}
]
}
}
If that is indeed the case (both objects required to be pushed in a single request), then yes, this is currently not supported and would require a custom resource. Did you make sure that the parent object (sys/vpc/inst/dom
) already exists?
Did you make sure that the parent object (
sys/vpc/inst/dom
) already exists?
Yes, sys/vpc/inst/dom
exists.
Should I open a new issue for a new resource request or will this one be used? Also, maybe we could modify nxos_rest and add an optional "payload" attribute? That way instead of the dn & class you could optionally provide a raw payload to handle cases where multiple objects have to be created simultaneously?
We can keep this one.. the problem with a raw payload is, that we cannot keep track of state and detect config drift.
Ya in one of the other providers I use they just put a big warning in the _rest resource about it. I manage it with a "state" variable. Turns it into Ansible-like behavior for that resource which is a pain but, better than nothing. Though maybe there isn't a lot of instances where you'd run into that with the NXAPI DME and so not worth it.
v0.4.0 enhances nxos_rest
to manage child objects and also adds dedicated resources to manage port-channels and vPCs.
Terraform Version
Affected Resource(s)
nxos_rest
Specifically dn=sys/vpc/inst/dom/if-
Class Name = vpcIf
Terraform Configuration Files
Debug Output
tftrace.log
Panic Output
Expected Behavior
vpcIf object created in the DME
Actual Behavior
Of course it doesn't, I'm trying to create it :D
Steps to Reproduce
terraform apply
Important Factoids
Using the NXAPI sandbox, adding the VPC command to port-channel 2 does this:
The vpc dom object is already in the DME, and the port-channel exists, so I'm not sure why it's having trouble adding the vpcIf object.
References