Skip to content

Resource: awsCognitoUserPoolUiCustomization

Provides a Cognito User Pool UI Customization resource.

\~> Note: To use this resource, the user pool must have a domain associated with it. For more information, see the Amazon Cognito Developer Guide on Customizing the Built-in Sign-In and Sign-up Webpages.

Example Usage

UI customization settings for a single client

/*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 awsCognitoUserPoolExample = new aws.cognitoUserPool.CognitoUserPool(
  this,
  "example",
  {
    name: "example",
  }
);
const awsCognitoUserPoolClientExample =
  new aws.cognitoUserPoolClient.CognitoUserPoolClient(this, "example_1", {
    name: "example",
    userPoolId: awsCognitoUserPoolExample.id,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsCognitoUserPoolClientExample.overrideLogicalId("example");
const awsCognitoUserPoolDomainExample =
  new aws.cognitoUserPoolDomain.CognitoUserPoolDomain(this, "example_2", {
    domain: "example",
    userPoolId: awsCognitoUserPoolExample.id,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsCognitoUserPoolDomainExample.overrideLogicalId("example");
const awsCognitoUserPoolUiCustomizationExample =
  new aws.cognitoUserPoolUiCustomization.CognitoUserPoolUiCustomization(
    this,
    "example_3",
    {
      clientId: awsCognitoUserPoolClientExample.id,
      css: ".label-customizable {font-weight: 400;}",
      imageFile: '${filebase64("logo.png")}',
      userPoolId: awsCognitoUserPoolDomainExample.userPoolId,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsCognitoUserPoolUiCustomizationExample.overrideLogicalId("example");

UI customization settings for all clients

/*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 awsCognitoUserPoolExample = new aws.cognitoUserPool.CognitoUserPool(
  this,
  "example",
  {
    name: "example",
  }
);
const awsCognitoUserPoolDomainExample =
  new aws.cognitoUserPoolDomain.CognitoUserPoolDomain(this, "example_1", {
    domain: "example",
    userPoolId: awsCognitoUserPoolExample.id,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsCognitoUserPoolDomainExample.overrideLogicalId("example");
const awsCognitoUserPoolUiCustomizationExample =
  new aws.cognitoUserPoolUiCustomization.CognitoUserPoolUiCustomization(
    this,
    "example_2",
    {
      css: ".label-customizable {font-weight: 400;}",
      imageFile: '${filebase64("logo.png")}',
      userPoolId: awsCognitoUserPoolDomainExample.userPoolId,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsCognitoUserPoolUiCustomizationExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • clientId (Optional) The client ID for the client app. Defaults to all. If all is specified, the css and/or imageFile settings will be used for every client that has no UI customization set previously.
  • css (Optional) - The CSS values in the UI customization, provided as a String. At least one of css or imageFile is required.
  • imageFile (Optional) - The uploaded logo image for the UI customization, provided as a base64-encoded String. Drift detection is not possible for this argument. At least one of css or imageFile is required.
  • userPoolId (Required) - The user pool ID for the user pool.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • creationDate - The creation date in RFC3339 format for the UI customization.
  • cssVersion - The CSS version number.
  • imageUrl - The logo image URL for the UI customization.
  • lastModifiedDate - The last-modified date in RFC3339 format for the UI customization.

Import

Cognito User Pool UI Customizations can be imported using the userPoolId and clientId separated by ,, e.g.,

$ terraform import aws_cognito_user_pool_ui_customization.example us-west-2_ZCTarbt5C,12bu4fuk3mlgqa2rtrujgp6egq