CiscoDevNet / terraform-provider-nxos

Terraform Cisco NX-OS Provider
https://registry.terraform.io/providers/netascode/nxos
Mozilla Public License 2.0
7 stars 10 forks source link

nxos_vpc_domain (Resource) is missing an attribute #221

Open Danmaarjustin opened 4 months ago

Danmaarjustin commented 4 months ago

Maybe im wrong, but i think that the attribute:

"ip arp synchronise" is missing. Will this be released in a future release?

jgomezve commented 4 months ago

Hi @JustinSchoenaker

The cli command ip arp synchronize is not created by modifying the DME object vpcDom. It is created by modifying the DME object arpVpcDom

Here the output of the Sandbox NXAPI after converting CLI commands to native DME configuration

vpc domain 100
  ip arp synchronize
{
  "topSystem": {
    "children": [
      {
        "arpEntity": {
          "children": [
            {
              "arpInst": {
                "children": [
                  {
                    "arpVpc": {
                      "children": [
                        {
                          "arpVpcDom": {
                            "attributes": {
                              "arpSync": "enabled",
                              "domainId": "100"
                            }
                          }
                        }
                      ]
                    }
                  }
                ]
              }
            }
          ]
        }
      },
      {
        "vpcEntity": {
          "children": [
            {
              "vpcInst": {
                "children": [
                  {
                    "vpcDom": {
                      "attributes": {
                        "id": "100"
                      }
                    }
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  }
}

As you can see, you must create the DME objects arpEntity, arpInst, arpVpc and arpVpcDom. Those object do not have dedicated resource in the current version of the NXOS provider. Nonetheless, you can use the generic resource nxos_rest for this purpose as shown below:


resource "nxos_vpc_domain" "example" {
  admin_state                    = "enabled"
  domain_id                      = 100
}

resource "nxos_rest" "arpEntity" {
  dn         = "sys/arp"
  class_name = "arpEntity"
  content = {
    adminSt = "enabled"
  }

  depends_on = [  nxos_vpc_domain.example]
}

resource "nxos_rest" "arpInst" {
  dn         = "${nxos_rest.arpEntity.id}/inst"
  class_name = "arpInst"
  content = {
    adminSt = "enabled"
  }
}

resource "nxos_rest" "arpVpc" {
  dn         = "${nxos_rest.arpInst.id}/vpc"
  class_name = "arpVpc"
}

resource "nxos_rest" "arpVpcDom" {
  dn         = "${nxos_rest.arpVpc.id}/dom-[100]"
  class_name = "arpVpcDom"
  content = {
    arpSync = "enabled"
    domainId = "100"
  }
}

Let us know if this approach works for you, or if you would like to see dedicated resources for those DME objects in a future release

Danmaarjustin commented 4 months ago

Hi @JustinSchoenaker

The cli command ip arp synchronize is not created by modifying the DME object vpcDom. It is created by modifying the DME object arpVpcDom

Here the output of the Sandbox NXAPI after converting CLI commands to native DME configuration

vpc domain 100
  ip arp synchronize
{
  "topSystem": {
    "children": [
      {
        "arpEntity": {
          "children": [
            {
              "arpInst": {
                "children": [
                  {
                    "arpVpc": {
                      "children": [
                        {
                          "arpVpcDom": {
                            "attributes": {
                              "arpSync": "enabled",
                              "domainId": "100"
                            }
                          }
                        }
                      ]
                    }
                  }
                ]
              }
            }
          ]
        }
      },
      {
        "vpcEntity": {
          "children": [
            {
              "vpcInst": {
                "children": [
                  {
                    "vpcDom": {
                      "attributes": {
                        "id": "100"
                      }
                    }
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  }
}

As you can see, you must create the DME objects arpEntity, arpInst, arpVpc and arpVpcDom. Those object do not have dedicated resource in the current version of the NXOS provider. Nonetheless, you can use the generic resource nxos_rest for this purpose as shown below:

resource "nxos_vpc_domain" "example" {
  admin_state                    = "enabled"
  domain_id                      = 100
}

resource "nxos_rest" "arpEntity" {
  dn         = "sys/arp"
  class_name = "arpEntity"
  content = {
    adminSt = "enabled"
  }

  depends_on = [  nxos_vpc_domain.example]
}

resource "nxos_rest" "arpInst" {
  dn         = "${nxos_rest.arpEntity.id}/inst"
  class_name = "arpInst"
  content = {
    adminSt = "enabled"
  }
}

resource "nxos_rest" "arpVpc" {
  dn         = "${nxos_rest.arpInst.id}/vpc"
  class_name = "arpVpc"
}

resource "nxos_rest" "arpVpcDom" {
  dn         = "${nxos_rest.arpVpc.id}/dom-[100]"
  class_name = "arpVpcDom"
  content = {
    arpSync = "enabled"
    domainId = "100"
  }
}

Let us know if this approach works for you, or if you would like to see dedicated resources for those DME objects in a future release

Awesome reply! This works like a charm, good approach for every other issue im facing regarding absence of some parameters within some resources. Thanks a lot!

jgomezve commented 4 months ago

@JustinSchoenaker glad to hear it works

Please feel free to open additional issues for missing resource so we can we track which resources the community want and prioritize them