cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1036
Views
0
Helpful
10
Replies
Highlighted
Beginner

Terraform ACI Provider Error

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
VIP Advisor

Re: Terraform ACI Provider Error

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

 

 

 


Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question

View solution in original post

10 REPLIES 10
Highlighted
VIP Advisor

Re: Terraform ACI Provider Error

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

 

 

 


Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question

View solution in original post

Highlighted
Beginner

Re: Terraform ACI Provider Error

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!

Highlighted
Beginner

Re: Terraform ACI Provider Error

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

Highlighted
VIP Advisor

Re: Terraform ACI Provider Error

It shouldn’t create again. If you do a terraform plan do you see a change is going to be applied?
Do you see this resource in your terraform.tfstate file?

Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question
Highlighted
Beginner

Re: Terraform ACI Provider Error

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

Highlighted
Beginner

Re: Terraform ACI Provider Error

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"

 
Highlighted
VIP Advisor

Re: Terraform ACI Provider Error

I opened an issue on github on aci terraform provider.
Tested and getting the same issue.

Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question
Highlighted
Rising star

Re: Terraform ACI Provider Error

Hi @AJ Cruz 

Just wanted to say I like seeing other people using Terraform with ACI.
What are your thoughts so far?

 

Thanks,

Sergiu

Highlighted
Beginner

Re: Terraform ACI Provider Error

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.

Highlighted
VIP Advisor

Re: Terraform ACI Provider Error

You will see it's awesome what you can do with. Plans are very good when you want to take a view of what will be applied, save it and apply it later. Also, to come to a working previous state helps a lot in certain circumstances.

Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question
This widget could not be displayed.