MyPureCloud / terraform-provider-genesyscloud

Terraform Provider Genesyscloud
MIT License
37 stars 85 forks source link

Trying to update Site Outbound Route - Only creating, no update. #1345

Closed isrussellm closed 1 week ago

isrussellm commented 2 weeks ago

I'm trying to update my site using the genesyscloud_telephony_providers_edges_site_outbound_route resource, but it has only tried to create a new outbound route. I have done it manually and with the APIs, so I just want to make sure I'm going down the correct path for Terraform.

Here is my main.tf.

`terraform { required_providers { genesyscloud = { source = "MyPureCloud/genesyscloud" version = ">= 1.6.0" } } }

provider "genesyscloud" { oauthclient_id = "id" oauthclient_secret = "secret" aws_region = "region" }

resource "genesyscloud_telephony_providers_edges_site_outbound_route" "russellOutboundRoute" { site_id = "site_id" name = "Default Outbound Route" classification_types = ["Emergency","Suicide Prevention","National","Network"] external_trunk_base_ids = ["external_trunk_base_id_1"] }`

Here is the error. I can see it's tying to POST instead of PUT.

Error: failed to create outbound route Default Outbound Route for site {site_id}: API Error: 400 - OutboundRoute with name 'Default Outbound Route' already exists. ({some ids})

{"resourceName":"genesyscloud_telephony_providers_edges_site_outbound_route","method":"POST","path":"/api/v2/telephony/providers/edges/sites/{site_id}/outboundroutes","statusCode":400,"errorMessage":"API │ Error: 400 - OutboundRoute with name 'Default Outbound Route' already exists. ({some_id})","correlationId":"some_id"}

carnellj-genesys commented 1 week ago

Hi Russel,

Are you trying to update an outbound route that already exists? If you are you need to import the resource into Terraform? Terraform expects to manage the state of any objects configured via it so if you try to update something that already exists you will get the above error.

Thanks, John Carnell Director, Developer Engagement