UserPoolDomain
Provides a Cognito User Pool Domain resource.
Example Usage
Amazon Cognito domain
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.Cognito.UserPool("example", new Aws.Cognito.UserPoolArgs
{
});
var main = new Aws.Cognito.UserPoolDomain("main", new Aws.Cognito.UserPoolDomainArgs
{
Domain = "example-domain",
UserPoolId = example.Id,
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/cognito"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := cognito.NewUserPool(ctx, "example", nil)
if err != nil {
return err
}
_, err = cognito.NewUserPoolDomain(ctx, "main", &cognito.UserPoolDomainArgs{
Domain: pulumi.String("example-domain"),
UserPoolId: example.ID(),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
example = aws.cognito.UserPool("example")
main = aws.cognito.UserPoolDomain("main",
domain="example-domain",
user_pool_id=example.id)import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.cognito.UserPool("example", {});
const main = new aws.cognito.UserPoolDomain("main", {
domain: "example-domain",
userPoolId: example.id,
});Custom Cognito domain
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleUserPool = new Aws.Cognito.UserPool("exampleUserPool", new Aws.Cognito.UserPoolArgs
{
});
var main = new Aws.Cognito.UserPoolDomain("main", new Aws.Cognito.UserPoolDomainArgs
{
CertificateArn = aws_acm_certificate.Cert.Arn,
Domain = "example-domain.example.com",
UserPoolId = exampleUserPool.Id,
});
var exampleZone = Output.Create(Aws.Route53.GetZone.InvokeAsync(new Aws.Route53.GetZoneArgs
{
Name = "example.com",
}));
var auth_cognito_A = new Aws.Route53.Record("auth-cognito-A", new Aws.Route53.RecordArgs
{
Aliases =
{
new Aws.Route53.Inputs.RecordAliasArgs
{
EvaluateTargetHealth = false,
Name = main.CloudfrontDistributionArn,
ZoneId = "Z2FDTNDATAQYW2",
},
},
Name = main.Domain,
Type = "A",
ZoneId = exampleZone.Apply(exampleZone => exampleZone.ZoneId),
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/cognito"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/route53"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleUserPool, err := cognito.NewUserPool(ctx, "exampleUserPool", nil)
if err != nil {
return err
}
main, err := cognito.NewUserPoolDomain(ctx, "main", &cognito.UserPoolDomainArgs{
CertificateArn: pulumi.String(aws_acm_certificate.Cert.Arn),
Domain: pulumi.String("example-domain.example.com"),
UserPoolId: exampleUserPool.ID(),
})
if err != nil {
return err
}
opt0 := "example.com"
exampleZone, err := route53.LookupZone(ctx, &route53.LookupZoneArgs{
Name: &opt0,
}, nil)
if err != nil {
return err
}
_, err = route53.NewRecord(ctx, "auth_cognito_A", &route53.RecordArgs{
Aliases: route53.RecordAliasArray{
&route53.RecordAliasArgs{
EvaluateTargetHealth: pulumi.Bool(false),
Name: main.CloudfrontDistributionArn,
ZoneId: pulumi.String("Z2FDTNDATAQYW2"),
},
},
Name: main.Domain,
Type: pulumi.String("A"),
ZoneId: pulumi.String(exampleZone.ZoneId),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
example_user_pool = aws.cognito.UserPool("exampleUserPool")
main = aws.cognito.UserPoolDomain("main",
certificate_arn=aws_acm_certificate["cert"]["arn"],
domain="example-domain.example.com",
user_pool_id=example_user_pool.id)
example_zone = aws.route53.get_zone(name="example.com")
auth_cognito__a = aws.route53.Record("auth-cognito-A",
aliases=[{
"evaluateTargetHealth": False,
"name": main.cloudfront_distribution_arn,
"zone_id": "Z2FDTNDATAQYW2",
}],
name=main.domain,
type="A",
zone_id=example_zone.zone_id)import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const exampleUserPool = new aws.cognito.UserPool("example", {});
const main = new aws.cognito.UserPoolDomain("main", {
certificateArn: aws_acm_certificate_cert.arn,
domain: "example-domain.example.com",
userPoolId: exampleUserPool.id,
});
const exampleZone = pulumi.output(aws.route53.getZone({
name: "example.com",
}, { async: true }));
const auth_cognito_A = new aws.route53.Record("auth-cognito-A", {
aliases: [{
evaluateTargetHealth: false,
name: main.cloudfrontDistributionArn,
// This zone_id is fixed
zoneId: "Z2FDTNDATAQYW2",
}],
name: main.domain,
type: "A",
zoneId: exampleZone.zoneId!,
});Create a UserPoolDomain Resource
new UserPoolDomain(name: string, args: UserPoolDomainArgs, opts?: CustomResourceOptions);def UserPoolDomain(resource_name, opts=None, certificate_arn=None, domain=None, user_pool_id=None, __props__=None);func NewUserPoolDomain(ctx *Context, name string, args UserPoolDomainArgs, opts ...ResourceOption) (*UserPoolDomain, error)public UserPoolDomain(string name, UserPoolDomainArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args UserPoolDomainArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args UserPoolDomainArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args UserPoolDomainArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
UserPoolDomain Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The UserPoolDomain resource accepts the following input properties:
- Domain string
The domain string.
- User
Pool stringId The user pool ID.
- Certificate
Arn string The ARN of an ISSUED ACM certificate in us-east-1 for a custom domain.
- Domain string
The domain string.
- User
Pool stringId The user pool ID.
- Certificate
Arn string The ARN of an ISSUED ACM certificate in us-east-1 for a custom domain.
- domain string
The domain string.
- user
Pool stringId The user pool ID.
- certificate
Arn string The ARN of an ISSUED ACM certificate in us-east-1 for a custom domain.
- domain str
The domain string.
- user_
pool_ strid The user pool ID.
- certificate_
arn str The ARN of an ISSUED ACM certificate in us-east-1 for a custom domain.
Outputs
All input properties are implicitly available as output properties. Additionally, the UserPoolDomain resource produces the following output properties:
- Aws
Account stringId The AWS account ID for the user pool owner.
- Cloudfront
Distribution stringArn The URL of the CloudFront distribution. This is required to generate the ALIAS
aws.route53.Record- Id string
- The provider-assigned unique ID for this managed resource.
- S3Bucket string
The S3 bucket where the static files for this domain are stored.
- Version string
The app version.
- Aws
Account stringId The AWS account ID for the user pool owner.
- Cloudfront
Distribution stringArn The URL of the CloudFront distribution. This is required to generate the ALIAS
aws.route53.Record- Id string
- The provider-assigned unique ID for this managed resource.
- S3Bucket string
The S3 bucket where the static files for this domain are stored.
- Version string
The app version.
- aws
Account stringId The AWS account ID for the user pool owner.
- cloudfront
Distribution stringArn The URL of the CloudFront distribution. This is required to generate the ALIAS
aws.route53.Record- id string
- The provider-assigned unique ID for this managed resource.
- s3Bucket string
The S3 bucket where the static files for this domain are stored.
- version string
The app version.
- aws_
account_ strid The AWS account ID for the user pool owner.
- cloudfront_
distribution_ strarn The URL of the CloudFront distribution. This is required to generate the ALIAS
aws.route53.Record- id str
- The provider-assigned unique ID for this managed resource.
- s3_
bucket str The S3 bucket where the static files for this domain are stored.
- version str
The app version.
Look up an Existing UserPoolDomain Resource
Get an existing UserPoolDomain resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: UserPoolDomainState, opts?: CustomResourceOptions): UserPoolDomainstatic get(resource_name, id, opts=None, aws_account_id=None, certificate_arn=None, cloudfront_distribution_arn=None, domain=None, s3_bucket=None, user_pool_id=None, version=None, __props__=None);func GetUserPoolDomain(ctx *Context, name string, id IDInput, state *UserPoolDomainState, opts ...ResourceOption) (*UserPoolDomain, error)public static UserPoolDomain Get(string name, Input<string> id, UserPoolDomainState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Aws
Account stringId The AWS account ID for the user pool owner.
- Certificate
Arn string The ARN of an ISSUED ACM certificate in us-east-1 for a custom domain.
- Cloudfront
Distribution stringArn The URL of the CloudFront distribution. This is required to generate the ALIAS
aws.route53.Record- Domain string
The domain string.
- S3Bucket string
The S3 bucket where the static files for this domain are stored.
- User
Pool stringId The user pool ID.
- Version string
The app version.
- Aws
Account stringId The AWS account ID for the user pool owner.
- Certificate
Arn string The ARN of an ISSUED ACM certificate in us-east-1 for a custom domain.
- Cloudfront
Distribution stringArn The URL of the CloudFront distribution. This is required to generate the ALIAS
aws.route53.Record- Domain string
The domain string.
- S3Bucket string
The S3 bucket where the static files for this domain are stored.
- User
Pool stringId The user pool ID.
- Version string
The app version.
- aws
Account stringId The AWS account ID for the user pool owner.
- certificate
Arn string The ARN of an ISSUED ACM certificate in us-east-1 for a custom domain.
- cloudfront
Distribution stringArn The URL of the CloudFront distribution. This is required to generate the ALIAS
aws.route53.Record- domain string
The domain string.
- s3Bucket string
The S3 bucket where the static files for this domain are stored.
- user
Pool stringId The user pool ID.
- version string
The app version.
- aws_
account_ strid The AWS account ID for the user pool owner.
- certificate_
arn str The ARN of an ISSUED ACM certificate in us-east-1 for a custom domain.
- cloudfront_
distribution_ strarn The URL of the CloudFront distribution. This is required to generate the ALIAS
aws.route53.Record- domain str
The domain string.
- s3_
bucket str The S3 bucket where the static files for this domain are stored.
- user_
pool_ strid The user pool ID.
- version str
The app version.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.