Skip to content

Data Source: awsCognitoUserPools

Use this data source to get a list of cognito user pools.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const dataAwsApiGatewayRestApiSelected =
  new aws.dataAwsApiGatewayRestApi.DataAwsApiGatewayRestApi(this, "selected", {
    name: "${var.api_gateway_name}",
  });
const dataAwsCognitoUserPoolsSelected =
  new aws.dataAwsCognitoUserPools.DataAwsCognitoUserPools(this, "selected_1", {
    name: "${var.cognito_user_pool_name}",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
dataAwsCognitoUserPoolsSelected.overrideLogicalId("selected");
new aws.apiGatewayAuthorizer.ApiGatewayAuthorizer(this, "cognito", {
  name: "cognito",
  providerArns: dataAwsCognitoUserPoolsSelected.arns,
  restApiId: dataAwsApiGatewayRestApiSelected.id,
  type: "COGNITO_USER_POOLS",
});

Argument Reference

  • name - (Required) Name of the cognito user pools. Name is not a unique attribute for cognito user pool, so multiple pools might be returned with given name. If the pool name is expected to be unique, you can reference the pool id via tolist(dataAwsCognitoUserPoolsSelectedIds)[0]

Attributes Reference

  • ids - Set of cognito user pool ids.
  • arns - Set of cognito user pool Amazon Resource Names (ARNs).