Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outbound Routes issue - Moving from 1.48 to later versions impacts production #1398

Open
JyotiSharma101 opened this issue Nov 29, 2024 · 10 comments

Comments

@JyotiSharma101
Copy link

Version greater then 1.48 requires outbound route to be present as individual resources. Splitting the outbound routes into individual resources hangs the terraform plan as the updated provider cannot understand the old config in state file and errors out. The only way to bring up the new format is to delete the existing outbound resource from state file, delete the config from front end and then create the outbound routes again through new format. This process is production impacting.

Can we have seemless way of moving to new structure for outbound routes without requirements of recreating them.

Steps to reproduce:
Create a site with two outbound routes with old provider (1.48)
The state file will have one resource for outbound route.
Now upgrade the provider (1.53)
change the config in terraform to support new format (two outbound resources)
run terraform plan.
Terraform plan errors out - You will see the error as below:

│ Error: failed to read outbound route 8ec1860c-7780-443c-8039-aa17175360cc for site | error: API Error: 404 - HTTP 404 Not Found (413f4aac-ad03-4e25-adf5-680078799438)
│ {"resourceName":"genesyscloud_telephony_providers_edges_site_outbound_route","method":"GET","path":"/api/v2/telephony/providers/edges/sites//outboundroutes/","statusCode":404,"errorMessage":"API Error: 404 - HTTP 404 Not Found (413f4aac-ad03-4e25-adf5-680078799438)","correlationId":"413f4aac-ad03-4e25-adf5-680078799438"}

Terraform plan is looking for old resource for outbound route and provider is not able to read the format.

To get rid of this error:

  1. delete outbound resource from state file.
  2. remove outbound route from UI
  3. Run terraform apply and two new outbound route resource will be created for 1 site.
@charliecon
Copy link
Collaborator

Hi @JyotiSharma101

Are you saying that, without defining any genesyscloud_telephony_providers_edges_site_outbound_routes resources in your config, the Terraform command is failing just by upgrading the version?

The routes should stay contained within the sites resource unless you set the env variable "ENABLE_STANDALONE_OUTBOUND_ROUTES". This env variable is supposed to enable the new genesyscloud_telephony_providers_edges_site_outbound_routes resource to ensure backward compatibility. If you do not have this var set, then nothing should break when you upgrade version.

-Charlie

@JyotiSharma101
Copy link
Author

JyotiSharma101 commented Dec 2, 2024 via email

@charliecon
Copy link
Collaborator

I understand the problem now. With v1.49.0 we restructured the genesyscloud_telephony_providers_edges_site_outbound_router resource without given proper thought to how we should roll out this breaking change. Apologies—this was a mistake on our part.

All we can do from here is help you to get set up with the latest version and take measures to prevent this sort of behaviour happening on future upgrades.

Sorry for the inconvenience and thank you for bringing this to our attention!

-Charlie

@JyotiSharma101
Copy link
Author

JyotiSharma101 commented Dec 2, 2024 via email

@charliecon
Copy link
Collaborator

I cannot view these attachments on GitHub. You might have to attach them directly on GitHub instead of replying via email.

I have created a ticket. We will investigate further and see if a resolution can be included in a later version.

(Tracking with DEVTOOLING-970)

@kavinbalagen
Copy link
Collaborator

Hey @JyotiSharma101 , Did you manage to get around this issue for PROD?

@JyotiSharma101
Copy link
Author

Hello @kavinbalagen, Because of holidays, this went on hold. Our Provider is restricted at 1.48 version. Is there a solution in any new release?

@kavinbalagen
Copy link
Collaborator

kavinbalagen commented Jan 8, 2025

@JyotiSharma101 we're looking at it.
Do you by anychance have read-write access to the PROD state files?

@JyotiSharma101
Copy link
Author

JyotiSharma101 commented Jan 8, 2025 via email

@kavinbalagen
Copy link
Collaborator

kavinbalagen commented Jan 10, 2025

Hey @JyotiSharma101

  • Since the new version of the provider doesn't recognize the previous version's state for outbound route, you may need to re-import the state for outbound route with the latest version. We recommend that simulate the following procedure in DEV and backup your state files in PROD before executing it in PROD.
  • Set the provider version to the latest in your configuration and perform terraform init -upgrade
  • List the states of the existing resources with terraform state list
  • Remove the outbound route resource's state from the state file with terraform state rm genesyscloud_telephony_providers_edges_site_outbound_route.RouteResource
  • Verify successful removal by running terraform state list again, the outbound route shouldn't get listed.
  • After version 1.49 and above, the outbound routes need to be re-configured as separate resource for each route. Hence you will need re-configure your existing outbound resource in the configuration with respect to the latest version of the provider. (this is important as importing just the state will cause to delete the resource in the next apply cycle). You may also need to populate the external_trunk_base_ids based on your configuration.
  • Once done, you can generate the state for each route. With the following process.
    • you need to have the siteId and the outboundRouteId handy. You can use the GET /api/v2/telephony/providers/edges/outboundroutes endpoint in our API_EXPLORER to get the GUIDs.
    • Use the command terraform import genesyscloud_telephony_providers_edges_site_outbound_route.RouteResource siteGUID:outboundRouteGUID
    • Repeat the process for each of your outbound route resource
  • Once finished Run terraform plan to validate the configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants