05-21-2020 06:50 AM - edited 05-21-2020 06:56 AM
I've been testing the Terraform ACI Provider. In many ways I like Terraform more vs Ansible, but so far I'm having one issue with Terraform and hope somebody has some insight.
When I try to add an encapsulation block with this:
resource "aci_ranges" "Test-Encap-Block" { vlan_pool_dn = "${aci_vlan_pool.External-VLAN-Pool.id}" _from = 101 to = 101 }I get this error:
aci_ranges.Test-Encap-Block: Creating...
Error: unknown property value uni/infra/vlanns-[External-VLAN-Pool]-static/from-[101]-to-[101], name dn, class fvnsEncapBlk [(Dn0)] Dn0=,
on aci.tf line 56, in resource "aci_ranges" "Test-Encap-Block":
56: resource "aci_ranges" "Test-Encap-Block" {
It seems to be pulling all the pertinent information including the id of the VLAN pool I want to tie the encap block to, allocation mode, and vlan range so I'm not sure why it's throwing and unknown property value error.
I'm not a real programmer but it kinda feels like maybe that Dn0 variable shouldn't be empty? I have no idea what that is though.
Solved! Go to Solution.
05-21-2020 05:38 PM
Hi
Try this:
resource "aci_ranges" "vlanpool3" { depends_on = [ aci_vlan_pool.test_vlan_pool, ] vlan_pool_dn = aci_vlan_pool.test_vlan_pool.id _from = "vlan-134" to = "vlan-134" from = "vlan-134" alloc_mode = "static" }
I made a webcast in the french community for terraform: https://bit.ly/WEBsld-may20
Doesn't matter if you don't understand french, I published a docker in which there's a folder ACI with some code example to provision a fabric using terraform and python.
Anyways, here is the docker:
docker pull supportlan/csc_demo_dc
05-21-2020 05:38 PM
Hi
Try this:
resource "aci_ranges" "vlanpool3" { depends_on = [ aci_vlan_pool.test_vlan_pool, ] vlan_pool_dn = aci_vlan_pool.test_vlan_pool.id _from = "vlan-134" to = "vlan-134" from = "vlan-134" alloc_mode = "static" }
I made a webcast in the french community for terraform: https://bit.ly/WEBsld-may20
Doesn't matter if you don't understand french, I published a docker in which there's a folder ACI with some code example to provision a fabric using terraform and python.
Anyways, here is the docker:
docker pull supportlan/csc_demo_dc
05-21-2020 06:45 PM
Thank you! It is working now. I looked at several examples, even the ones I pulled from CLUS demos never had VLAN pools and encap blocks created. It was all Tenant config.
I didn't realize the encap blocks needed the "vlan-" appended to the front. I probably should have seeing the aci_ranges resource is generic, but man they should put that in the documentation for the provider.
Thanks!
05-21-2020 07:08 PM
I do have one concern though, every time I run terraform apply it destroys and re-creates the encap blocks. Is that normal?
resource "aci_vlan_pool" "External-VLAN-Pool" { name = "External-VLAN-Pool" alloc_mode = "static" } resource "aci_ranges" "External-Encap-Block" { depends_on = [ aci_vlan_pool.External-VLAN-Pool, ] vlan_pool_dn = aci_vlan_pool.External-VLAN-Pool.id annotation = "test" name_alias = "example" description = "test description" role = "external" _from = "vlan-101" from = "vlan-101" to = "vlan-101" alloc_mode = "static" }
yields this every time I run:
# aci_ranges.External-Encap-Block must be replaced
-/+ resource "aci_ranges" "External-Encap-Block" {
_from = "vlan-101"
alloc_mode = "static"
annotation = "test"
description = "test description"
from = "vlan-101"
~ id = "uni/infra/vlanns-[External-VLAN-Pool]-static/from-[vlan-101]-to-[vlan-101]" -> (known after apply)
name_alias = "example"
role = "external"
to = "vlan-101"
~ vlan_pool_dn = "uni/infra" -> "uni/infra/vlanns-[External-VLAN-Pool]-static" # forces replacement
I thought nothing would be touched if it already existed
05-21-2020 08:09 PM
05-21-2020 08:46 PM - edited 05-21-2020 08:50 PM
Yes terraform plan shows the encap block is going to be replaced:
# aci_ranges.External-Encap-Block must be replaced -/+ resource "aci_ranges" "External-Encap-Block" { _from = "vlan-101" alloc_mode = "static" annotation = "test" description = "test description" from = "vlan-101" ~ id = "uni/infra/vlanns-[External-VLAN-Pool]-static/from-[vlan-101]-to-[vlan-101]" -> (known after apply) name_alias = "example" role = "external" to = "vlan-101" ~ vlan_pool_dn = "uni/infra" -> "uni/infra/vlanns-[External-VLAN-Pool]-static" # forces replacement }
The resource does exist in my state file:
[root@devbox aci]# terraform state show aci_ranges.External-Encap-Block
# aci_ranges.External-Encap-Block:
resource "aci_ranges" "External-Encap-Block" {
_from = "vlan-101"
alloc_mode = "static"
annotation = "test"
description = "test description"
from = "vlan-101"
id = "uni/infra/vlanns-[External-VLAN-Pool]-static/from-[vlan-101]-to-[vlan-101]"
name_alias = "example"
role = "external"
to = "vlan-101"
vlan_pool_dn = "uni/infra"
}
Thanks
05-21-2020 08:53 PM
It looks to me like the vlan_pool_dn variable changes after the encap block gets posted.
Changes from "uni/infra/vlanns-[External-VLAN-Pool]-static"
to "uni/infra"
05-23-2020 08:48 AM
05-21-2020 10:51 PM
Hi @AJ Cruz
Just wanted to say I like seeing other people using Terraform with ACI.
What are your thoughts so far?
Thanks,
Sergiu
05-23-2020 01:14 PM
I'm just barely scratching the surface but so far I really like Terraform. I love the option to run a plan to see exactly what would happen on an apply.
05-25-2020 03:44 PM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide