Hello All
I am new to Terraform, so please expect some naive questions regarding the topic i need help for.
I am doing Cisco ACI implementation in my Lab, where i cannot create the Tenant (its pre-built) and i can create everything under it.
Now i was reading and it said you can use data resource if you want to read the object, but i am not sure if the object still need to be created in the terraform.
Second some documents says use import,
I am not very much familiar the details of the above both.
Here is what i did which assume could be very wrong and need your help:
data “aci_tenant” “user3” {
name = “user3”
}
resource “aci_vrf” “Services” {
tenant_dn = aci_tenant.user3.id
name = “Services”
description = “from terraform”
bd_enforced_enable = “no”
ip_data_plane_learning = “enabled”
knw_mcast_act = “permit”
pc_enf_dir = “ingress”
pc_enf_pref = “enforced”
}
The error i get is :
Error: Reference to undeclared resource
│
│ on main.tf line 6, in resource “aci_vrf” “Services”:
│ 6: tenant_dn = aci_tenant.user3.id
│
│ A managed resource “aci_tenant” “user3” has not been declared in the root module.
│
│ Did you mean the data resource data.aci_tenant.user3?
Now i know it says the resource has not been declared, my question is i cannot create a new Object called aci_tenant “user3” as i have to use this already defined object in the ACI
I am not sure how to use import
Would like help from experts here .
Thanks