07-13-2021 05:28 AM
Hi *,
I am a rookie trying to get TF and ACI working - I've been trying to get my head around this for a cpuple of hours now and am still stuck. Maybe someone has an idea how to solve this error and point me into the right direction.
I have a set of servers that should be connected to their leafs (1201, 1202), going with a map holding all the details about the servers seemed to be a good idea to me.
my variables.tf looks like this (extracted the interesting bits):
variable "MAP_leaf_interface_profiles" {
type = map(any)
default = {
"IP_LEAF-1201" = { name="IP_LEAF-1201", name_alias="", description="IP_LEAF-1201"}
"IP_LEAF-1202" = { name="IP_LEAF-1202", name_alias="", description="IP_LEAF-1202"}
"IP_LEAF-2401" = { name="IP_LEAF-2401", name_alias="", description="IP_LEAF-2401"}
"IP_LEAF-2402" = { name="IP_LEAF-2402", name_alias="", description="IP_LEAF-2402"}
"IP_LEAF-1201-1202" = { name="IP_LEAF-1201-1202", name_alias="", description="IP_LEAF-1201-1202"}
"IP_LEAF-2401-2402" = { name="IP_LEAF-2401-2402", name_alias="", description="IP_LEAF-2401-2402"}
}
}
variable "MAP_VxRail_hostnames-TEST" {
type = map(any)
default = {
"XX123456789012-1201" = { hostname="XX123456789012", dc_location="DC1", VPC_PRD_DATA_interface="eth1/25", VPC_PRD_DATA_IP_tdn="uni/infra/accportprof-IP_LEAF-1201", VPC_PRD_DATA_IP="IP_LEAF-1201"},
"XX123456789012-1202" = { hostname="XX123456789012", dc_location="DC1", VPC_PRD_DATA_interface="eth1/25", VPC_PRD_DATA_IP_tdn="uni/infra/accportprof-IP_LEAF-1202", VPC_PRD_DATA_IP="IP_LEAF-1202"}
}
}
I am able to create the interface profiles "IP_LEAF-XXXX" with this snippet just fine:
resource "aci_leaf_interface_profile" "IP_LEAF-Profiles" {
for_each = var.MAP_leaf_interface_profiles
description = each.value.description
name = each.value.name
}
As a next step I would like to create the acces_port_selector for each server with this piece of code:
resource "aci_access_port_selector" "IS_FRx-PRD_VxRail-DATA-SN" {
for_each = var.MAP_VxRail_hostnames-TEST
name = "IS_${each.value.dc_location}-PRD_VxRail-DATA-${each.key}"
leaf_interface_profile_dn = "aci_leaf_interface_profile.IP_LEAF-Profiles.${each.value.VPC_PRD_DATA_IP}.id"
description = "${each.value.hostname}"
access_port_selector_type = "range"
}
which is failing big time with the following error:
│ Error: unknown property value aci_leaf_interface_profile.IP_LEAF-Profiles.IP_LEAF-1201.id/hports-IS_FR2-PRD_VxRail-DATA-XX123456789012-1201-typ-range, name dn, class infraHPortS [(Dn0)] Dn0=,
│
│ with aci_access_port_selector.IS_FRx-PRD_VxRail-DATA-SN["XX123456789012-1201"],
│ on main.tf line 67, in resource "aci_access_port_selector" "IS_FRx-PRD_VxRail-DATA-SN":
│ 67: resource "aci_access_port_selector" "IS_FRx-PRD_VxRail-DATA-SN" {
│
However when changing the following line (like hard-coding the tdn)
leaf_interface_profile_dn = "${each.value.VPC_PRD_DATA_IP_tdn}"
everything just works fine:
aci_access_port_selector.IS_FRx-PRD_VxRail-DATA-SN["XX123456789012-1202"]: Creating...
aci_access_port_selector.IS_FRx-PRD_VxRail-DATA-SN["XX123456789012-1201"]: Creating...
aci_access_port_selector.IS_FRx-PRD_VxRail-DATA-SN["XX123456789012-1201"]: Creation complete after 1s [id=uni/infra/accportprof-IP_LEAF-1201/hports-IS_FR2-PRD_VxRail-DATA-XX123456789012-1201-typ-range]
aci_access_port_selector.IS_FRx-PRD_VxRail-DATA-SN["XX123456789012-1202"]: Creation complete after 1s [id=uni/infra/accportprof-IP_LEAF-1202/hports-IS_FR2-PRD_VxRail-DATA-XX123456789012-1202-typ-range]
Any idea how to fix this? I would like to avoid using the tDN in the map. Or is there even a better approach on doing this?
Solved! Go to Solution.
07-23-2021 10:06 AM
Hello Lennart!
We opened a forum in French with an ACI expert & VIP of the community Francesco Molino who answered your question. Please validate his reply as "accepted solution" in our forum and here!
You can replace the following line in your aci_access_port_selector resource
leaf_interface_profile_dn = "aci_leaf_interface_profile.IP_LEAF-Profiles.${each.value.VPC_PRD_DATA_IP}.id"
by
leaf_interface_profile_dn = aci_leaf_interface_profile.IP_LEAF-Profiles[each.value.VPC_PRD_DATA_IP].id
It should work depending on what you're trying to achieve as a goal.
07-23-2021 10:06 AM
Hello Lennart!
We opened a forum in French with an ACI expert & VIP of the community Francesco Molino who answered your question. Please validate his reply as "accepted solution" in our forum and here!
You can replace the following line in your aci_access_port_selector resource
leaf_interface_profile_dn = "aci_leaf_interface_profile.IP_LEAF-Profiles.${each.value.VPC_PRD_DATA_IP}.id"
by
leaf_interface_profile_dn = aci_leaf_interface_profile.IP_LEAF-Profiles[each.value.VPC_PRD_DATA_IP].id
It should work depending on what you're trying to achieve as a goal.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:
This community is intended for developer topics around Data Center technology and products. If you are looking for a non-developer topic about Data Center, you might find additional information in the Data Center and Cloud community