CiscoDevNet / terraform-provider-aci

Terraform Cisco ACI provider
https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs
Mozilla Public License 2.0
88 stars 101 forks source link

Attach Leaf interface to EPG #20

Closed thomasbertouxbetclic closed 4 years ago

thomasbertouxbetclic commented 4 years ago

I'm trying to create an EPG on Cisco ACI using Terraform. EPG is created but Leaf's interface isn't attached. The terraform synthax to attach Leaf interface is :

resource "aci_application_epg" "VLAN-616-EPG" {
  ...    
  relation_fv_rs_path_att      = ["topology/pod-1/paths-103/pathep-[eth1/1]"]
  ...
}

It works when I do it manually through ACI web interface or REST API with tDN field like :

<fvRsPathAtt annotation="" descr="" encap="vlan-{{VLAN-ID}}" instrImedcy="immediate" mode="regular" primaryEncap="unknown" tDn="topology/pod-1/paths-103/pathep-[eth1/1]"/>

hakras commented 4 years ago

I am experiencing the same issue. I believe it has something to do with missing parameters (mode, encap, etc). I'm not sure if the provider currently has the capability.

hakras commented 4 years ago

I was able to get around this issue by using the aci_rest module. You still need to keep the relation_fv_rs_path_att value in the aci_application_epg module to avoid it being removed on next apply.

resource "aci_rest" "path_att" { path = "api/node/mo/${aci_application_epg.some_epg.id}.json" class_name = "fvRsPathAtt" content = { "tDn" = "topology/pod-1/paths-103/pathep-[eth1/1]" "mode" = "regular" "encap" = "vlan-1111" "instrImedcy" = "immediate" } }

nkatarmal-crest commented 4 years ago

@hakras @thomasbertouxbetclic I will expose this class as concrete resource so that you can create the object by passing all the required parameters.

devarshishah3 commented 4 years ago

@hakras @thomasbertouxbetclic. This is the expected behaviour as the relationship class has other parameters which need to be passed. The workaround is correct as well. Are there any other relationship classes that you are using which need parameters to be passed?

nkatarmal-crest commented 4 years ago

@thomasbertouxbetclic @hakras I have exposed this class as concrete resource in the version 0.2.1 of the Provider, please find the details here for your reference: https://www.terraform.io/docs/providers/aci/r/fvrspathatt.html Do let me know if this solves your issue.

hakras commented 4 years ago

@nkatarmal-crest, using my existing tf code from a Linux system (using aci_rest), it is working as expected. I have a requirement to get this working under Windows. I copied over the same tf code to a Windows system and the code provided errors. Using the work you have done here, I modified my code to not use aci_rest, but to use aci_epg_to_static_path instead. Unfortunately, it is not working for me. Here are the issues I'm observing:

  1. It requires "tdn" instead of "tDn". Not a big deal just not consistent.
  2. Getting this: Error: unknown attribute 'annotation' in element 'fvRsPathAtt'
  3. After removing 'annotation' from the resources, I started getting this: Error: unknown property value aci_application_epg.aepg1.id/rspathAtt-[topology/pod-1/paths-1012/pathep-[router38_2-1-1]], name dn, class fvRsPathAtt [(Dn0)] Dn0=,

Looking forward to your suggestions. Thanks

nkatarmal-crest commented 4 years ago

@hakras Can you try below terraform snippet?

resource "aci_epg_to_static_path" "epg_to_stat_path" {
  application_epg_dn = aci_application_epg.inherit_epg.id
  tdn                = "topology/pod-1/paths-103/pathep-[eth1/1]"
  mode               = "regular"
  encap              = "vlan-1111"
  instr_imedcy       = "immediate"
}

I am able to create the relation without any error using this.

I will remove the annotation attribute from this resource.

nkatarmal-crest commented 4 years ago

Closing as we haven't heard back in long time.