Files
floci/docs
Mario Toffia f3c251ef20 feat(cognito): provision AWS::Cognito::UserPoolDomain (#3005)
* feat(cognito): provision AWS::Cognito::UserPoolDomain

The type was a stub: the stack turned green, but Fn::GetAtt
CloudFrontDistribution resolved to the literal
LogicalId.CloudFrontDistribution, so a Route 53 alias record for a
custom domain pointed at that text.

CognitoCfnProvisioner creates the domain through the existing
CreateUserPoolDomain. Ref is the domain name and CloudFrontDistribution
is the CloudFront name DescribeUserPoolDomain reports. A changed Domain
or UserPoolId replaces the domain; any other change is applied in place
through the new UpdateUserPoolDomain operation, so the distribution a
DNS alias points at survives a certificate change, as on AWS. Delete
uses the pool id recorded at create time and tolerates an already
deleted domain.

UpdateUserPoolDomain is also exposed on the Cognito API, with the same
response shape as CreateUserPoolDomain.

* feat(cognito): treat null domain settings as absent and pin the same-name replacement failure

Review follow-ups for AWS::Cognito::UserPoolDomain:

- A JSON null inside CustomDomainConfig was copied as the text "null",
  which would have passed for a certificate ARN. Null values are now
  skipped, so the service rejects the missing ARN as it should.
- ManagedLoginVersion on CreateUserPoolDomain and UpdateUserPoolDomain
  treated an explicit null as 0, overwriting the stored version. Null
  now counts as omitted, and a value of another JSON type is a
  SerializationException, as on AWS.
- Moving an unchanged domain to another pool fails on the create,
  because domain names are unique across pools and the replacement is
  created before the original is deleted, exactly as on AWS. The unit
  test that mocked this path as a success is replaced by one that pins
  the failure and checks the original domain is left in place.

* test(cognito): cover domain replacement, prefix domains and SecurityPolicy updates

The stack test now also renames the domain through UpdateStack, asserting the old domain is gone and the new one has its own distribution, and a second stack proves a prefix domain resolves Fn::GetAtt CloudFrontDistribution to an empty string rather than the literal attribute name. The service test covers a SecurityPolicy change and that an omitted policy is kept. The in-place check reads ctx.reusesPriorEntity(domain), as the sibling provisioners do.

* test(cognito): provision the stack test's certificate through AWS::CertificateManager::Certificate

With the ACM provisioner merged, the stack test now declares the certificate as a resource and references it with Fn::GetAtt, the way CDK does. Rotating to a new certificate resource updates the domain in place and removes the old certificate once nothing references it. A wildcard name keeps a domain rename from replacing the certificate.
2026-09-04 00:55:19 -05:00
..
2026-03-15 17:43:56 -05:00