github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cognito/userPoolDomain.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package cognito
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Provides a Cognito User Pool Domain resource.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Amazon Cognito domain
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cognito"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			example, err := cognito.NewUserPool(ctx, "example", &cognito.UserPoolArgs{
    35  //				Name: pulumi.String("example-pool"),
    36  //			})
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			_, err = cognito.NewUserPoolDomain(ctx, "main", &cognito.UserPoolDomainArgs{
    41  //				Domain:     pulumi.String("example-domain"),
    42  //				UserPoolId: example.ID(),
    43  //			})
    44  //			if err != nil {
    45  //				return err
    46  //			}
    47  //			return nil
    48  //		})
    49  //	}
    50  //
    51  // ```
    52  // <!--End PulumiCodeChooser -->
    53  //
    54  // ### Custom Cognito domain
    55  //
    56  // <!--Start PulumiCodeChooser -->
    57  // ```go
    58  // package main
    59  //
    60  // import (
    61  //
    62  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cognito"
    63  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53"
    64  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    65  //
    66  // )
    67  //
    68  //	func main() {
    69  //		pulumi.Run(func(ctx *pulumi.Context) error {
    70  //			exampleUserPool, err := cognito.NewUserPool(ctx, "example", &cognito.UserPoolArgs{
    71  //				Name: pulumi.String("example-pool"),
    72  //			})
    73  //			if err != nil {
    74  //				return err
    75  //			}
    76  //			main, err := cognito.NewUserPoolDomain(ctx, "main", &cognito.UserPoolDomainArgs{
    77  //				Domain:         pulumi.String("example-domain"),
    78  //				CertificateArn: pulumi.Any(cert.Arn),
    79  //				UserPoolId:     exampleUserPool.ID(),
    80  //			})
    81  //			if err != nil {
    82  //				return err
    83  //			}
    84  //			example, err := route53.LookupZone(ctx, &route53.LookupZoneArgs{
    85  //				Name: pulumi.StringRef("example.com"),
    86  //			}, nil)
    87  //			if err != nil {
    88  //				return err
    89  //			}
    90  //			_, err = route53.NewRecord(ctx, "auth-cognito-A", &route53.RecordArgs{
    91  //				Name:   main.Domain,
    92  //				Type:   pulumi.String(route53.RecordTypeA),
    93  //				ZoneId: pulumi.String(example.ZoneId),
    94  //				Aliases: route53.RecordAliasArray{
    95  //					&route53.RecordAliasArgs{
    96  //						EvaluateTargetHealth: pulumi.Bool(false),
    97  //						Name:                 main.CloudfrontDistribution,
    98  //						ZoneId:               main.CloudfrontDistributionZoneId,
    99  //					},
   100  //				},
   101  //			})
   102  //			if err != nil {
   103  //				return err
   104  //			}
   105  //			return nil
   106  //		})
   107  //	}
   108  //
   109  // ```
   110  // <!--End PulumiCodeChooser -->
   111  //
   112  // ## Import
   113  //
   114  // Using `pulumi import`, import Cognito User Pool Domains using the `domain`. For example:
   115  //
   116  // ```sh
   117  // $ pulumi import aws:cognito/userPoolDomain:UserPoolDomain main auth.example.org
   118  // ```
   119  type UserPoolDomain struct {
   120  	pulumi.CustomResourceState
   121  
   122  	// The AWS account ID for the user pool owner.
   123  	AwsAccountId pulumi.StringOutput `pulumi:"awsAccountId"`
   124  	// The ARN of an ISSUED ACM certificate in us-east-1 for a custom domain.
   125  	CertificateArn pulumi.StringPtrOutput `pulumi:"certificateArn"`
   126  	// The Amazon CloudFront endpoint (e.g. `dpp0gtxikpq3y.cloudfront.net`) that you use as the target of the alias that you set up with your Domain Name Service (DNS) provider.
   127  	CloudfrontDistribution pulumi.StringOutput `pulumi:"cloudfrontDistribution"`
   128  	// The URL of the CloudFront distribution. This is required to generate the ALIAS `route53.Record`
   129  	CloudfrontDistributionArn pulumi.StringOutput `pulumi:"cloudfrontDistributionArn"`
   130  	// The Route 53 hosted zone ID of the CloudFront distribution.
   131  	CloudfrontDistributionZoneId pulumi.StringOutput `pulumi:"cloudfrontDistributionZoneId"`
   132  	// For custom domains, this is the fully-qualified domain name, such as auth.example.com. For Amazon Cognito prefix domains, this is the prefix alone, such as auth.
   133  	Domain pulumi.StringOutput `pulumi:"domain"`
   134  	// The S3 bucket where the static files for this domain are stored.
   135  	S3Bucket pulumi.StringOutput `pulumi:"s3Bucket"`
   136  	// The user pool ID.
   137  	UserPoolId pulumi.StringOutput `pulumi:"userPoolId"`
   138  	// The app version.
   139  	Version pulumi.StringOutput `pulumi:"version"`
   140  }
   141  
   142  // NewUserPoolDomain registers a new resource with the given unique name, arguments, and options.
   143  func NewUserPoolDomain(ctx *pulumi.Context,
   144  	name string, args *UserPoolDomainArgs, opts ...pulumi.ResourceOption) (*UserPoolDomain, error) {
   145  	if args == nil {
   146  		return nil, errors.New("missing one or more required arguments")
   147  	}
   148  
   149  	if args.Domain == nil {
   150  		return nil, errors.New("invalid value for required argument 'Domain'")
   151  	}
   152  	if args.UserPoolId == nil {
   153  		return nil, errors.New("invalid value for required argument 'UserPoolId'")
   154  	}
   155  	opts = internal.PkgResourceDefaultOpts(opts)
   156  	var resource UserPoolDomain
   157  	err := ctx.RegisterResource("aws:cognito/userPoolDomain:UserPoolDomain", name, args, &resource, opts...)
   158  	if err != nil {
   159  		return nil, err
   160  	}
   161  	return &resource, nil
   162  }
   163  
   164  // GetUserPoolDomain gets an existing UserPoolDomain resource's state with the given name, ID, and optional
   165  // state properties that are used to uniquely qualify the lookup (nil if not required).
   166  func GetUserPoolDomain(ctx *pulumi.Context,
   167  	name string, id pulumi.IDInput, state *UserPoolDomainState, opts ...pulumi.ResourceOption) (*UserPoolDomain, error) {
   168  	var resource UserPoolDomain
   169  	err := ctx.ReadResource("aws:cognito/userPoolDomain:UserPoolDomain", name, id, state, &resource, opts...)
   170  	if err != nil {
   171  		return nil, err
   172  	}
   173  	return &resource, nil
   174  }
   175  
   176  // Input properties used for looking up and filtering UserPoolDomain resources.
   177  type userPoolDomainState struct {
   178  	// The AWS account ID for the user pool owner.
   179  	AwsAccountId *string `pulumi:"awsAccountId"`
   180  	// The ARN of an ISSUED ACM certificate in us-east-1 for a custom domain.
   181  	CertificateArn *string `pulumi:"certificateArn"`
   182  	// The Amazon CloudFront endpoint (e.g. `dpp0gtxikpq3y.cloudfront.net`) that you use as the target of the alias that you set up with your Domain Name Service (DNS) provider.
   183  	CloudfrontDistribution *string `pulumi:"cloudfrontDistribution"`
   184  	// The URL of the CloudFront distribution. This is required to generate the ALIAS `route53.Record`
   185  	CloudfrontDistributionArn *string `pulumi:"cloudfrontDistributionArn"`
   186  	// The Route 53 hosted zone ID of the CloudFront distribution.
   187  	CloudfrontDistributionZoneId *string `pulumi:"cloudfrontDistributionZoneId"`
   188  	// For custom domains, this is the fully-qualified domain name, such as auth.example.com. For Amazon Cognito prefix domains, this is the prefix alone, such as auth.
   189  	Domain *string `pulumi:"domain"`
   190  	// The S3 bucket where the static files for this domain are stored.
   191  	S3Bucket *string `pulumi:"s3Bucket"`
   192  	// The user pool ID.
   193  	UserPoolId *string `pulumi:"userPoolId"`
   194  	// The app version.
   195  	Version *string `pulumi:"version"`
   196  }
   197  
   198  type UserPoolDomainState struct {
   199  	// The AWS account ID for the user pool owner.
   200  	AwsAccountId pulumi.StringPtrInput
   201  	// The ARN of an ISSUED ACM certificate in us-east-1 for a custom domain.
   202  	CertificateArn pulumi.StringPtrInput
   203  	// The Amazon CloudFront endpoint (e.g. `dpp0gtxikpq3y.cloudfront.net`) that you use as the target of the alias that you set up with your Domain Name Service (DNS) provider.
   204  	CloudfrontDistribution pulumi.StringPtrInput
   205  	// The URL of the CloudFront distribution. This is required to generate the ALIAS `route53.Record`
   206  	CloudfrontDistributionArn pulumi.StringPtrInput
   207  	// The Route 53 hosted zone ID of the CloudFront distribution.
   208  	CloudfrontDistributionZoneId pulumi.StringPtrInput
   209  	// For custom domains, this is the fully-qualified domain name, such as auth.example.com. For Amazon Cognito prefix domains, this is the prefix alone, such as auth.
   210  	Domain pulumi.StringPtrInput
   211  	// The S3 bucket where the static files for this domain are stored.
   212  	S3Bucket pulumi.StringPtrInput
   213  	// The user pool ID.
   214  	UserPoolId pulumi.StringPtrInput
   215  	// The app version.
   216  	Version pulumi.StringPtrInput
   217  }
   218  
   219  func (UserPoolDomainState) ElementType() reflect.Type {
   220  	return reflect.TypeOf((*userPoolDomainState)(nil)).Elem()
   221  }
   222  
   223  type userPoolDomainArgs struct {
   224  	// The ARN of an ISSUED ACM certificate in us-east-1 for a custom domain.
   225  	CertificateArn *string `pulumi:"certificateArn"`
   226  	// For custom domains, this is the fully-qualified domain name, such as auth.example.com. For Amazon Cognito prefix domains, this is the prefix alone, such as auth.
   227  	Domain string `pulumi:"domain"`
   228  	// The user pool ID.
   229  	UserPoolId string `pulumi:"userPoolId"`
   230  }
   231  
   232  // The set of arguments for constructing a UserPoolDomain resource.
   233  type UserPoolDomainArgs struct {
   234  	// The ARN of an ISSUED ACM certificate in us-east-1 for a custom domain.
   235  	CertificateArn pulumi.StringPtrInput
   236  	// For custom domains, this is the fully-qualified domain name, such as auth.example.com. For Amazon Cognito prefix domains, this is the prefix alone, such as auth.
   237  	Domain pulumi.StringInput
   238  	// The user pool ID.
   239  	UserPoolId pulumi.StringInput
   240  }
   241  
   242  func (UserPoolDomainArgs) ElementType() reflect.Type {
   243  	return reflect.TypeOf((*userPoolDomainArgs)(nil)).Elem()
   244  }
   245  
   246  type UserPoolDomainInput interface {
   247  	pulumi.Input
   248  
   249  	ToUserPoolDomainOutput() UserPoolDomainOutput
   250  	ToUserPoolDomainOutputWithContext(ctx context.Context) UserPoolDomainOutput
   251  }
   252  
   253  func (*UserPoolDomain) ElementType() reflect.Type {
   254  	return reflect.TypeOf((**UserPoolDomain)(nil)).Elem()
   255  }
   256  
   257  func (i *UserPoolDomain) ToUserPoolDomainOutput() UserPoolDomainOutput {
   258  	return i.ToUserPoolDomainOutputWithContext(context.Background())
   259  }
   260  
   261  func (i *UserPoolDomain) ToUserPoolDomainOutputWithContext(ctx context.Context) UserPoolDomainOutput {
   262  	return pulumi.ToOutputWithContext(ctx, i).(UserPoolDomainOutput)
   263  }
   264  
   265  // UserPoolDomainArrayInput is an input type that accepts UserPoolDomainArray and UserPoolDomainArrayOutput values.
   266  // You can construct a concrete instance of `UserPoolDomainArrayInput` via:
   267  //
   268  //	UserPoolDomainArray{ UserPoolDomainArgs{...} }
   269  type UserPoolDomainArrayInput interface {
   270  	pulumi.Input
   271  
   272  	ToUserPoolDomainArrayOutput() UserPoolDomainArrayOutput
   273  	ToUserPoolDomainArrayOutputWithContext(context.Context) UserPoolDomainArrayOutput
   274  }
   275  
   276  type UserPoolDomainArray []UserPoolDomainInput
   277  
   278  func (UserPoolDomainArray) ElementType() reflect.Type {
   279  	return reflect.TypeOf((*[]*UserPoolDomain)(nil)).Elem()
   280  }
   281  
   282  func (i UserPoolDomainArray) ToUserPoolDomainArrayOutput() UserPoolDomainArrayOutput {
   283  	return i.ToUserPoolDomainArrayOutputWithContext(context.Background())
   284  }
   285  
   286  func (i UserPoolDomainArray) ToUserPoolDomainArrayOutputWithContext(ctx context.Context) UserPoolDomainArrayOutput {
   287  	return pulumi.ToOutputWithContext(ctx, i).(UserPoolDomainArrayOutput)
   288  }
   289  
   290  // UserPoolDomainMapInput is an input type that accepts UserPoolDomainMap and UserPoolDomainMapOutput values.
   291  // You can construct a concrete instance of `UserPoolDomainMapInput` via:
   292  //
   293  //	UserPoolDomainMap{ "key": UserPoolDomainArgs{...} }
   294  type UserPoolDomainMapInput interface {
   295  	pulumi.Input
   296  
   297  	ToUserPoolDomainMapOutput() UserPoolDomainMapOutput
   298  	ToUserPoolDomainMapOutputWithContext(context.Context) UserPoolDomainMapOutput
   299  }
   300  
   301  type UserPoolDomainMap map[string]UserPoolDomainInput
   302  
   303  func (UserPoolDomainMap) ElementType() reflect.Type {
   304  	return reflect.TypeOf((*map[string]*UserPoolDomain)(nil)).Elem()
   305  }
   306  
   307  func (i UserPoolDomainMap) ToUserPoolDomainMapOutput() UserPoolDomainMapOutput {
   308  	return i.ToUserPoolDomainMapOutputWithContext(context.Background())
   309  }
   310  
   311  func (i UserPoolDomainMap) ToUserPoolDomainMapOutputWithContext(ctx context.Context) UserPoolDomainMapOutput {
   312  	return pulumi.ToOutputWithContext(ctx, i).(UserPoolDomainMapOutput)
   313  }
   314  
   315  type UserPoolDomainOutput struct{ *pulumi.OutputState }
   316  
   317  func (UserPoolDomainOutput) ElementType() reflect.Type {
   318  	return reflect.TypeOf((**UserPoolDomain)(nil)).Elem()
   319  }
   320  
   321  func (o UserPoolDomainOutput) ToUserPoolDomainOutput() UserPoolDomainOutput {
   322  	return o
   323  }
   324  
   325  func (o UserPoolDomainOutput) ToUserPoolDomainOutputWithContext(ctx context.Context) UserPoolDomainOutput {
   326  	return o
   327  }
   328  
   329  // The AWS account ID for the user pool owner.
   330  func (o UserPoolDomainOutput) AwsAccountId() pulumi.StringOutput {
   331  	return o.ApplyT(func(v *UserPoolDomain) pulumi.StringOutput { return v.AwsAccountId }).(pulumi.StringOutput)
   332  }
   333  
   334  // The ARN of an ISSUED ACM certificate in us-east-1 for a custom domain.
   335  func (o UserPoolDomainOutput) CertificateArn() pulumi.StringPtrOutput {
   336  	return o.ApplyT(func(v *UserPoolDomain) pulumi.StringPtrOutput { return v.CertificateArn }).(pulumi.StringPtrOutput)
   337  }
   338  
   339  // The Amazon CloudFront endpoint (e.g. `dpp0gtxikpq3y.cloudfront.net`) that you use as the target of the alias that you set up with your Domain Name Service (DNS) provider.
   340  func (o UserPoolDomainOutput) CloudfrontDistribution() pulumi.StringOutput {
   341  	return o.ApplyT(func(v *UserPoolDomain) pulumi.StringOutput { return v.CloudfrontDistribution }).(pulumi.StringOutput)
   342  }
   343  
   344  // The URL of the CloudFront distribution. This is required to generate the ALIAS `route53.Record`
   345  func (o UserPoolDomainOutput) CloudfrontDistributionArn() pulumi.StringOutput {
   346  	return o.ApplyT(func(v *UserPoolDomain) pulumi.StringOutput { return v.CloudfrontDistributionArn }).(pulumi.StringOutput)
   347  }
   348  
   349  // The Route 53 hosted zone ID of the CloudFront distribution.
   350  func (o UserPoolDomainOutput) CloudfrontDistributionZoneId() pulumi.StringOutput {
   351  	return o.ApplyT(func(v *UserPoolDomain) pulumi.StringOutput { return v.CloudfrontDistributionZoneId }).(pulumi.StringOutput)
   352  }
   353  
   354  // For custom domains, this is the fully-qualified domain name, such as auth.example.com. For Amazon Cognito prefix domains, this is the prefix alone, such as auth.
   355  func (o UserPoolDomainOutput) Domain() pulumi.StringOutput {
   356  	return o.ApplyT(func(v *UserPoolDomain) pulumi.StringOutput { return v.Domain }).(pulumi.StringOutput)
   357  }
   358  
   359  // The S3 bucket where the static files for this domain are stored.
   360  func (o UserPoolDomainOutput) S3Bucket() pulumi.StringOutput {
   361  	return o.ApplyT(func(v *UserPoolDomain) pulumi.StringOutput { return v.S3Bucket }).(pulumi.StringOutput)
   362  }
   363  
   364  // The user pool ID.
   365  func (o UserPoolDomainOutput) UserPoolId() pulumi.StringOutput {
   366  	return o.ApplyT(func(v *UserPoolDomain) pulumi.StringOutput { return v.UserPoolId }).(pulumi.StringOutput)
   367  }
   368  
   369  // The app version.
   370  func (o UserPoolDomainOutput) Version() pulumi.StringOutput {
   371  	return o.ApplyT(func(v *UserPoolDomain) pulumi.StringOutput { return v.Version }).(pulumi.StringOutput)
   372  }
   373  
   374  type UserPoolDomainArrayOutput struct{ *pulumi.OutputState }
   375  
   376  func (UserPoolDomainArrayOutput) ElementType() reflect.Type {
   377  	return reflect.TypeOf((*[]*UserPoolDomain)(nil)).Elem()
   378  }
   379  
   380  func (o UserPoolDomainArrayOutput) ToUserPoolDomainArrayOutput() UserPoolDomainArrayOutput {
   381  	return o
   382  }
   383  
   384  func (o UserPoolDomainArrayOutput) ToUserPoolDomainArrayOutputWithContext(ctx context.Context) UserPoolDomainArrayOutput {
   385  	return o
   386  }
   387  
   388  func (o UserPoolDomainArrayOutput) Index(i pulumi.IntInput) UserPoolDomainOutput {
   389  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *UserPoolDomain {
   390  		return vs[0].([]*UserPoolDomain)[vs[1].(int)]
   391  	}).(UserPoolDomainOutput)
   392  }
   393  
   394  type UserPoolDomainMapOutput struct{ *pulumi.OutputState }
   395  
   396  func (UserPoolDomainMapOutput) ElementType() reflect.Type {
   397  	return reflect.TypeOf((*map[string]*UserPoolDomain)(nil)).Elem()
   398  }
   399  
   400  func (o UserPoolDomainMapOutput) ToUserPoolDomainMapOutput() UserPoolDomainMapOutput {
   401  	return o
   402  }
   403  
   404  func (o UserPoolDomainMapOutput) ToUserPoolDomainMapOutputWithContext(ctx context.Context) UserPoolDomainMapOutput {
   405  	return o
   406  }
   407  
   408  func (o UserPoolDomainMapOutput) MapIndex(k pulumi.StringInput) UserPoolDomainOutput {
   409  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *UserPoolDomain {
   410  		return vs[0].(map[string]*UserPoolDomain)[vs[1].(string)]
   411  	}).(UserPoolDomainOutput)
   412  }
   413  
   414  func init() {
   415  	pulumi.RegisterInputType(reflect.TypeOf((*UserPoolDomainInput)(nil)).Elem(), &UserPoolDomain{})
   416  	pulumi.RegisterInputType(reflect.TypeOf((*UserPoolDomainArrayInput)(nil)).Elem(), UserPoolDomainArray{})
   417  	pulumi.RegisterInputType(reflect.TypeOf((*UserPoolDomainMapInput)(nil)).Elem(), UserPoolDomainMap{})
   418  	pulumi.RegisterOutputType(UserPoolDomainOutput{})
   419  	pulumi.RegisterOutputType(UserPoolDomainArrayOutput{})
   420  	pulumi.RegisterOutputType(UserPoolDomainMapOutput{})
   421  }