Reputation: 42520
I am using terraform
to manage IaC in AWS in my project. cognito
is already existing on AWS and it has a user pool and its related resources. How can I reference the client ID in my terraform? I have tried below setting:
data "aws_cognito_user_pool_client" "selected" {
name = "app-client"
}
I got this error:
The provider provider.aws does not support data source
"aws_cognito_user_pool_client".
It seems AWS doesn't support data source for aws_cognito_user_pool_client
. Is there another way to get the client ID?
Upvotes: 1
Views: 2242
Reputation: 1
There is no data source for a aws_cognito_user_pool_client
There is a data source for aws_cognito_user_pools
The correct syntax for the aws_cognito_user_pools data source is -
data "aws_cognito_user_pools" "selected" {
name = "app-pool"
}
Source: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/cognito_user_pools
Upvotes: 0
Reputation: 2983
User pool client is a resource, not a data source so it should look like this:
resource "aws_cognito_user_pool_client" "test" {
name = "app-client"
}
Of course, if it already exists within Cognito yo will have to import it.
terraform import aws_cognito_user_pool_client.test id-of-client-in-cognito
Upvotes: 2