CX as a Code - Site, Trunk and Numbering Plan Issue

Hi,

I am relatively new in the CX as code but the whole idea of it looks very promising to me :slight_smile:

I have already learned a lot by trying, but recently I have came across one issue, which to be honest I dont understand how to solve.

I thought that it would be great if we could use Terraform for the initial provisioning of the configuration and managed it once the project in production. It would be great if we can take control with the help of terraform over such objects like: locations, sites, trunks, numbering plans and etc.

And the issue which I currently have is that I would like to provide with Terraform Site, Trunk (External Trunk BYOC) and Numbering Plan. But it looks like it is not possible - because "Cycle" appears - the Trunk depends on the Site, The numbering plan can be only created as a part of Site, and Outbound Numbering Plan depends on the Trunk :slight_smile: Is it possible some how to decouple the Numbering plan from the Site ? Or probably somebody has already faced this issue and there are other ways to solve this problem?

Any information regarding that will be helpful :slight_smile: thanks in advance!

Oh, sorry, I think it is not the right place here...

For issues, I believe, I should use github, I found my issue there:

Hi Anton,

This is the right place. We sometimes have users cross-post. I am posting the same response here:

Hi @absoliman123 ,

I actually ran into this issue as well right after upgrading to provider version 1.27.0. It seems that there is a slightly different approach that needs to be taken regarding setting up BYOC telephony.

Previous to 1.27.0, you could setup your telephony like so:

resource "genesyscloud_telephony_providers_edges_trunkbasesettings" "trunk_base_settings" {
  name               = "BYOC Cloud Trunk"
  trunk_meta_base_id = "external_sip_pcv_byoc_carrier.json"
  trunk_type         = "EXTERNAL"
  managed            = false

  properties = jsonencode({
     ...
  })
}
resource "genesyscloud_telephony_providers_edges_site" "site" {
  name        = "Headquarters"
  location_id = genesyscloud_location.id
  media_model = "Cloud"
  edge_auto_update_config {
    ...
  }
  outbound_routes {
    name                    = "Default Outbound Route"
    classification_types    = ["National", "Network", "Emergency"]
    enabled                 = true
    external_trunk_base_ids = [genesyscloud_telephony_providers_edges_trunkbasesettings.trunk_base_settings.id]
  }
}

and the Site and Trunks would be created as expected connected.

However, as of 1.27.0 the inbound_site_id field became a required field for the genesyscloud_telephony_providers_edges_trunkbasesettings resource when the trunk_meta_base_id = "external_sip_pcv_byoc_carrier.json" is set. Apparently there is now some handling within the Genesys Cloud product to autoconnect the site from the trunk instead of the other way around. The proposed fix looks like this:

 resource "genesyscloud_telephony_providers_edges_trunkbasesettings" "trunk_base_settings" {
   name               = "BYOC Cloud Trunk"
   trunk_meta_base_id = "external_sip_pcv_byoc_carrier.json"
   trunk_type         = "EXTERNAL"
   managed            = false
+ inbound_site_id = genesyscloud_telephony_providers_edges_site.site.id

   properties = jsonencode({
      ...
   })
 }
 resource "genesyscloud_telephony_providers_edges_site" "site" {
   name        = "Headquarters"
   location_id = genesyscloud_location.id
   media_model = "Cloud"
   edge_auto_update_config {
     ...
   }
   outbound_routes {
     name                    = "Default Outbound Route"
     classification_types    = ["National", "Network", "Emergency"]
-   enabled                 = true
+  enabled                   = false
-   external_trunk_base_ids = [genesyscloud_telephony_providers_edges_trunkbasesettings.trunk_base_settings.id]
   }
 }

@John_Carnell thank you very much for the reply. It actually works - the trunk, site and Default Outbound route were created. But in the outbound route there are no trunks associated ( I have several External Trunks, may be that is the reason why they are not associated). Plus I will have to create an additional outbound route with a separate destination. Does it work by design :slight_smile: ?

As a workaround I can add them manually, it is not detected by the terraform, thus it will not be deleted next time you run "terraform apply". But it would be great, if there was a way to configure it through the terraform.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.