amazon-web-servicesterraformterraform-provider-awsamazon-connect

Get ID of Amazon Connect - Basic Routing Profile to use in "aws_connect_user" Terraform resource


I'm deploying an Amazon Connect instance via Terraform. In order to access the Amazon Connect CCP (Contact Control Panel) without using the emergency access, I need to deploy the following Terraform resource: "aws_connect_user".

As specified in Terraform registry for this resource (https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/connect_user) at one point I need the routing_profile_id, therefore I was thinking to use the ID of the Basic Routing Profile that Amazon automatically creates when you deploy an Amazon Connect instance. The problem is that I don't know how to get this information and which Terraform command I should use.

Consider that I'm new in using Terraform.

Thank you!


Solution

  • As you pointed out by yourself, going with the aws_connect_routing_profile data source is the way to go:

    data "aws_connect_routing_profile" "example" {
        instance_id = "aaaaaaaa-bbbb-cccc-dddd-111111111111"
        name        = "Basic Routing Profile"
    }
    

    Documentation: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/connect_routing_profile