cisco-en-programmability / terraform-provider-dnacenter

https://registry.terraform.io/providers/cisco-en-programmability/dnacenter/latest/docs
MIT License
14 stars 12 forks source link

Reserve IP subpool for a site #70

Closed artur-tekieli closed 2 years ago

artur-tekieli commented 2 years ago

Prerequisites

Describe the bug Its not really a bug but more of a question maybe an enhancement. When reserving an IP pools I need to reference site_id, but site_id are only after a DNAC site is configured. So it makes the automation a bit more difficult to achieve:

Screenshot 2022-07-11 at 22 30 11

resource "dnacenter_reserve_ip_subpool" "example" {
   provider = dnacenter
   depends_on = [ dnacenter_global_pool.example ]

   parameters {
    ...
     name               = "Cape_Town_Corp_VN"
     site_id            = "5812a67c-4939-44f9-92cc-81ceac6019cc" **<<<<<<<<<<<<<<<<<<**
     type               = "Generic"
  }
}

Is it not possible to reference "site_name_hierarchy" = "Global/SouthAfrica/CapeTown" - instead of site_id ?

This would make it much more easier to use.

fmunozmiranda commented 2 years ago

@artur-tekieli I think you can solve it without an enhancement doing something like this:

resource "dnacenter_site" "example" {
  provider = dnacenter
  parameters {
    site {
      building {
        name        = "testBuilding"
        address     = "255 China Basin Street, San Francisco, California 94158, United States"
        parent_name = "Global"
        latitude    = 37.77178651716143
        longitude   = -122.39062051589885
      }
    }
    type = "building"
  }
}
resource "dnacenter_reserve_ip_subpool" "example" {
   provider = dnacenter
   depends_on = [ dnacenter_site.example ]

   parameters {
    ...
     name               = "Cape_Town_Corp_VN"
     site_id            =  dnacenter_site.example.item.0.id  //<=====
     type               = "Generic"
  }
}

Try it and let us know if works and it's what you want.

artur-tekieli commented 2 years ago

@fmunozmiranda - Yes that's exactly what I wanted - Thanks!