Terraform Genesys Cloud Queue Resource: Skill Attribute Mapping Failure

Does anyone know the correct syntax for mapping skill attributes to a queue definition within the genesyscloud_queue resource? I am attempting to define a queue with specific skill requirements using the CX as Code Terraform provider.

Background

I am building an Infrastructure as Code pipeline to manage Genesys Cloud resources. My goal is to create a queue that requires specific skills for routing. I am using the genesyscloud_queue resource and attempting to set the outbound_wrap_up_code and skill requirements via the routing_skills block.

Issue

When I apply the configuration below, the terraform plan succeeds, but terraform apply fails with a validation error regarding the routing_skills structure. The error message indicates that the skill_id field is expected to be a string, but the provider seems to interpret it as a map or object incorrectly.

resource "genesyscloud_queue" "sentiment_analysis_queue" {
 name = "Sentiment Analysis Queue"
 description = "Queue for high-priority sentiment cases"
 enabled = true
 split_skills = true

 routing_skills {
 skill_id = "12345678-1234-1234-1234-123456789012" # This is a valid skill ID from our org
 priority = 1
 level = 5
 }
}

The error returned is:

Error: expected routing_skills.skill_id to be a string, got map[string]interface{}

Troubleshooting

I have verified that the skill_id is a valid UUID string. I have also checked the provider documentation for version 1.45.0. The documentation shows the routing_skills block should contain skill_id, priority, and level.

I suspect the issue might be related to how the provider handles the list of skills versus a single skill object. I tried wrapping it in a list syntax routing_skills = [{...}] but that resulted in a different parsing error. I am running this in a local environment with the provider initialized via terraform init. The timezone is Europe/Stockholm, but I do not believe this affects the schema validation.

Is there a specific way to define the routing_skills block that I am missing? Or is this a known bug in the current provider version?

You should probably look at at the specific schema requirements for routing.skill_requirements within the Genesys Cloud Terraform provider. The 400 Bad Request usually stems from a mismatch between the provider’s expected nested object structure and the actual JSON payload sent to the /api/v2/queues/{queueId} endpoint.

When defining skill requirements, you must ensure that the skill object contains a valid id and that the level is an integer. A common pitfall is omitting the id field or passing a string instead of an integer for the level, which causes the API to reject the payload during the Data Action processing phase.

Here is the corrected JSON structure that should be reflected in your Terraform genesyscloud_queue resource:

{
 "routing": {
 "skill_requirements": [
 {
 "skill": {
 "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
 },
 "level": 3
 }
 ],
 "utilization": {
 "capacity": 100
 }
 }
}

In Terraform, this translates to:

resource "genesyscloud_queue" "example_queue" {
 name = "Support Queue"
 
 routing {
 skill_requirements {
 skill {
 id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
 }
 level = 3
 }
 utilization {
 capacity = 100
 }
 }
}

Verify that the skill ID exists and is active in your Genesys Cloud organization. If you are tracing this via OpenTelemetry, ensure that the span captures the exact payload sent to the API to debug any subtle type mismatches. The error often hides in the serialization of the skill object. Check the API logs for the precise validation error returned by the Genesys Cloud backend.