Legacy Dev Forum Posts

 View Only

Sign Up

Terraform import fails because of incorrect phone numbers format

  • 1.  Terraform import fails because of incorrect phone numbers format

    Posted 06-05-2025 18:25

    Dariusz | 2023-04-13 14:18:12 UTC | #1

    Using Terraform I try to export configuration from one org and apply it to another one. Export goes well - the genesyscloud.tf.json file is generated w/o any errors, but the import fails because of incorrect phone number format for Locations and Users:

    │ Error: Failed to parse number in an E164 format. Passed +48 600 XXX XXX and expected: +48600XXXXXX │ │ with genesyscloudlocation.DariuszTest3939338301, │ on input.tf.json line 115, in resource.genesyscloudlocation.DariuszTest3939338301.emergency_number[0]: │ 115: "number": "+48 600 XXX XXX”,

    Object from the exported TF file:

    "DariuszTest3939338301": { "address": [ { "city": "City", "country": "PL", "state": "State", "street1": "Address 1", "street2": "Address 2", "zipcode": "00-100" } ], "emergencynumber": [ { "number": "+48 600 XXX XXX”, "type": "default" } ], "name": "Dariusz Test", "notes": null, "path": null },

    Output of the same location object from the platform API:

    { "id": "28275173-961e-4f15-8547-29b99d8f9d06", "name": "Dariusz Test", "emergencyNumber": { "e164": "+48600XXXXXX”, "number": "+48 600 XXX XXX”, "type": "default" }, "address": { "city": "City", "country": "PL", "countryName": "Poland", "state": "State", "street1": "Address 1", "street2": "Address 2", "zipcode": "00-100" }, "state": "active", "version": 2, "addressVerified": false, "selfUri": "/api/v2/locations/28275173-961e-4f15-8547-29b99d8f9d06" }

    It looks that exported phone numbers are taken from the ‘number’ field but import expects the ‘e164’ format.

    Any ideas how to solve this?

    my export configuration tf.json:

    { "terraform":{ "requiredversion":"~> 1.4.2", "requiredproviders":{ "genesyscloud":{ "source":"mypurecloud/genesyscloud", "version":"~> 1.14.0" } } }, "provider":{ "genesyscloud":{ "oauthclientid":"${var.TFVARID}", "oauthclientsecret":"${var.TFVARSECRET}", "awsregion":"${var.TFVARREGION}" } }, "variable":[ { "TFVARID":{ "type":"string" } }, { "TFVARSECRET":{ "type":"string" } }, { "TFVARREGION":{ "type":"string" } } ], "resource":{ "genesyscloudtfexport":{ "export":{ "directory":"./export", "resourcetypes":[ "genesysclouduser", "genesyscloudauthdivision", "genesyscloudroutingskill", "genesyscloudroutinglanguage", "genesyscloudlocation" ], "includestatefile":false } } } }

    Import configuration tf:

    terraform { required_version = "~> 1.4.2" }

    variable "TFVARID" { type = string }

    variable "TFVARSECRET" { type = string }

    variable "TFVARREGION" { type = string }

    provider "genesyscloud" { oauthclientid = var.TFVARID oauthclientsecret = var.TFVARSECRET awsregion = var.TFVAR_REGION }

    Thanks!


    1E04 | 2023-07-28 09:28:37 UTC | #2

    Hey @Dariusz, did you find any solution to solve this problem? I am stuck at the same problem with wrong number format.

    Thanks!


    This post was migrated from the old Developer Forum.

    ref: 19436