github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/apprunner/customDomainAssociation.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 apprunner
     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  // Manages an App Runner Custom Domain association.
    16  //
    17  // > **NOTE:** After creation, you must use the information in the `certificationValidationRecords` attribute to add CNAME records to your Domain Name System (DNS). For each mapped domain name, add a mapping to the target App Runner subdomain (found in the `dnsTarget` attribute) and one or more certificate validation records. App Runner then performs DNS validation to verify that you own or control the domain name you associated. App Runner tracks domain validity in a certificate stored in AWS Certificate Manager (ACM).
    18  //
    19  // ## Example Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apprunner"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := apprunner.NewCustomDomainAssociation(ctx, "example", &apprunner.CustomDomainAssociationArgs{
    35  //				DomainName: pulumi.String("example.com"),
    36  //				ServiceArn: pulumi.Any(exampleAwsApprunnerService.Arn),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			return nil
    42  //		})
    43  //	}
    44  //
    45  // ```
    46  // <!--End PulumiCodeChooser -->
    47  //
    48  // ## Import
    49  //
    50  // Using `pulumi import`, import App Runner Custom Domain Associations using the `domain_name` and `service_arn` separated by a comma (`,`). For example:
    51  //
    52  // ```sh
    53  // $ pulumi import aws:apprunner/customDomainAssociation:CustomDomainAssociation example example.com,arn:aws:apprunner:us-east-1:123456789012:service/example-app/8fe1e10304f84fd2b0df550fe98a71fa
    54  // ```
    55  type CustomDomainAssociation struct {
    56  	pulumi.CustomResourceState
    57  
    58  	// A set of certificate CNAME records used for this domain name. See Certificate Validation Records below for more details.
    59  	CertificateValidationRecords CustomDomainAssociationCertificateValidationRecordArrayOutput `pulumi:"certificateValidationRecords"`
    60  	// App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name. Attribute only available if resource created (not imported) with this provider.
    61  	DnsTarget pulumi.StringOutput `pulumi:"dnsTarget"`
    62  	// Custom domain endpoint to association. Specify a base domain e.g., `example.com` or a subdomain e.g., `subdomain.example.com`.
    63  	DomainName pulumi.StringOutput `pulumi:"domainName"`
    64  	// Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to `true`.
    65  	EnableWwwSubdomain pulumi.BoolPtrOutput `pulumi:"enableWwwSubdomain"`
    66  	// ARN of the App Runner service.
    67  	ServiceArn pulumi.StringOutput `pulumi:"serviceArn"`
    68  	// Current state of the certificate CNAME record validation. It should change to `SUCCESS` after App Runner completes validation with your DNS.
    69  	Status pulumi.StringOutput `pulumi:"status"`
    70  }
    71  
    72  // NewCustomDomainAssociation registers a new resource with the given unique name, arguments, and options.
    73  func NewCustomDomainAssociation(ctx *pulumi.Context,
    74  	name string, args *CustomDomainAssociationArgs, opts ...pulumi.ResourceOption) (*CustomDomainAssociation, error) {
    75  	if args == nil {
    76  		return nil, errors.New("missing one or more required arguments")
    77  	}
    78  
    79  	if args.DomainName == nil {
    80  		return nil, errors.New("invalid value for required argument 'DomainName'")
    81  	}
    82  	if args.ServiceArn == nil {
    83  		return nil, errors.New("invalid value for required argument 'ServiceArn'")
    84  	}
    85  	opts = internal.PkgResourceDefaultOpts(opts)
    86  	var resource CustomDomainAssociation
    87  	err := ctx.RegisterResource("aws:apprunner/customDomainAssociation:CustomDomainAssociation", name, args, &resource, opts...)
    88  	if err != nil {
    89  		return nil, err
    90  	}
    91  	return &resource, nil
    92  }
    93  
    94  // GetCustomDomainAssociation gets an existing CustomDomainAssociation resource's state with the given name, ID, and optional
    95  // state properties that are used to uniquely qualify the lookup (nil if not required).
    96  func GetCustomDomainAssociation(ctx *pulumi.Context,
    97  	name string, id pulumi.IDInput, state *CustomDomainAssociationState, opts ...pulumi.ResourceOption) (*CustomDomainAssociation, error) {
    98  	var resource CustomDomainAssociation
    99  	err := ctx.ReadResource("aws:apprunner/customDomainAssociation:CustomDomainAssociation", name, id, state, &resource, opts...)
   100  	if err != nil {
   101  		return nil, err
   102  	}
   103  	return &resource, nil
   104  }
   105  
   106  // Input properties used for looking up and filtering CustomDomainAssociation resources.
   107  type customDomainAssociationState struct {
   108  	// A set of certificate CNAME records used for this domain name. See Certificate Validation Records below for more details.
   109  	CertificateValidationRecords []CustomDomainAssociationCertificateValidationRecord `pulumi:"certificateValidationRecords"`
   110  	// App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name. Attribute only available if resource created (not imported) with this provider.
   111  	DnsTarget *string `pulumi:"dnsTarget"`
   112  	// Custom domain endpoint to association. Specify a base domain e.g., `example.com` or a subdomain e.g., `subdomain.example.com`.
   113  	DomainName *string `pulumi:"domainName"`
   114  	// Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to `true`.
   115  	EnableWwwSubdomain *bool `pulumi:"enableWwwSubdomain"`
   116  	// ARN of the App Runner service.
   117  	ServiceArn *string `pulumi:"serviceArn"`
   118  	// Current state of the certificate CNAME record validation. It should change to `SUCCESS` after App Runner completes validation with your DNS.
   119  	Status *string `pulumi:"status"`
   120  }
   121  
   122  type CustomDomainAssociationState struct {
   123  	// A set of certificate CNAME records used for this domain name. See Certificate Validation Records below for more details.
   124  	CertificateValidationRecords CustomDomainAssociationCertificateValidationRecordArrayInput
   125  	// App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name. Attribute only available if resource created (not imported) with this provider.
   126  	DnsTarget pulumi.StringPtrInput
   127  	// Custom domain endpoint to association. Specify a base domain e.g., `example.com` or a subdomain e.g., `subdomain.example.com`.
   128  	DomainName pulumi.StringPtrInput
   129  	// Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to `true`.
   130  	EnableWwwSubdomain pulumi.BoolPtrInput
   131  	// ARN of the App Runner service.
   132  	ServiceArn pulumi.StringPtrInput
   133  	// Current state of the certificate CNAME record validation. It should change to `SUCCESS` after App Runner completes validation with your DNS.
   134  	Status pulumi.StringPtrInput
   135  }
   136  
   137  func (CustomDomainAssociationState) ElementType() reflect.Type {
   138  	return reflect.TypeOf((*customDomainAssociationState)(nil)).Elem()
   139  }
   140  
   141  type customDomainAssociationArgs struct {
   142  	// Custom domain endpoint to association. Specify a base domain e.g., `example.com` or a subdomain e.g., `subdomain.example.com`.
   143  	DomainName string `pulumi:"domainName"`
   144  	// Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to `true`.
   145  	EnableWwwSubdomain *bool `pulumi:"enableWwwSubdomain"`
   146  	// ARN of the App Runner service.
   147  	ServiceArn string `pulumi:"serviceArn"`
   148  }
   149  
   150  // The set of arguments for constructing a CustomDomainAssociation resource.
   151  type CustomDomainAssociationArgs struct {
   152  	// Custom domain endpoint to association. Specify a base domain e.g., `example.com` or a subdomain e.g., `subdomain.example.com`.
   153  	DomainName pulumi.StringInput
   154  	// Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to `true`.
   155  	EnableWwwSubdomain pulumi.BoolPtrInput
   156  	// ARN of the App Runner service.
   157  	ServiceArn pulumi.StringInput
   158  }
   159  
   160  func (CustomDomainAssociationArgs) ElementType() reflect.Type {
   161  	return reflect.TypeOf((*customDomainAssociationArgs)(nil)).Elem()
   162  }
   163  
   164  type CustomDomainAssociationInput interface {
   165  	pulumi.Input
   166  
   167  	ToCustomDomainAssociationOutput() CustomDomainAssociationOutput
   168  	ToCustomDomainAssociationOutputWithContext(ctx context.Context) CustomDomainAssociationOutput
   169  }
   170  
   171  func (*CustomDomainAssociation) ElementType() reflect.Type {
   172  	return reflect.TypeOf((**CustomDomainAssociation)(nil)).Elem()
   173  }
   174  
   175  func (i *CustomDomainAssociation) ToCustomDomainAssociationOutput() CustomDomainAssociationOutput {
   176  	return i.ToCustomDomainAssociationOutputWithContext(context.Background())
   177  }
   178  
   179  func (i *CustomDomainAssociation) ToCustomDomainAssociationOutputWithContext(ctx context.Context) CustomDomainAssociationOutput {
   180  	return pulumi.ToOutputWithContext(ctx, i).(CustomDomainAssociationOutput)
   181  }
   182  
   183  // CustomDomainAssociationArrayInput is an input type that accepts CustomDomainAssociationArray and CustomDomainAssociationArrayOutput values.
   184  // You can construct a concrete instance of `CustomDomainAssociationArrayInput` via:
   185  //
   186  //	CustomDomainAssociationArray{ CustomDomainAssociationArgs{...} }
   187  type CustomDomainAssociationArrayInput interface {
   188  	pulumi.Input
   189  
   190  	ToCustomDomainAssociationArrayOutput() CustomDomainAssociationArrayOutput
   191  	ToCustomDomainAssociationArrayOutputWithContext(context.Context) CustomDomainAssociationArrayOutput
   192  }
   193  
   194  type CustomDomainAssociationArray []CustomDomainAssociationInput
   195  
   196  func (CustomDomainAssociationArray) ElementType() reflect.Type {
   197  	return reflect.TypeOf((*[]*CustomDomainAssociation)(nil)).Elem()
   198  }
   199  
   200  func (i CustomDomainAssociationArray) ToCustomDomainAssociationArrayOutput() CustomDomainAssociationArrayOutput {
   201  	return i.ToCustomDomainAssociationArrayOutputWithContext(context.Background())
   202  }
   203  
   204  func (i CustomDomainAssociationArray) ToCustomDomainAssociationArrayOutputWithContext(ctx context.Context) CustomDomainAssociationArrayOutput {
   205  	return pulumi.ToOutputWithContext(ctx, i).(CustomDomainAssociationArrayOutput)
   206  }
   207  
   208  // CustomDomainAssociationMapInput is an input type that accepts CustomDomainAssociationMap and CustomDomainAssociationMapOutput values.
   209  // You can construct a concrete instance of `CustomDomainAssociationMapInput` via:
   210  //
   211  //	CustomDomainAssociationMap{ "key": CustomDomainAssociationArgs{...} }
   212  type CustomDomainAssociationMapInput interface {
   213  	pulumi.Input
   214  
   215  	ToCustomDomainAssociationMapOutput() CustomDomainAssociationMapOutput
   216  	ToCustomDomainAssociationMapOutputWithContext(context.Context) CustomDomainAssociationMapOutput
   217  }
   218  
   219  type CustomDomainAssociationMap map[string]CustomDomainAssociationInput
   220  
   221  func (CustomDomainAssociationMap) ElementType() reflect.Type {
   222  	return reflect.TypeOf((*map[string]*CustomDomainAssociation)(nil)).Elem()
   223  }
   224  
   225  func (i CustomDomainAssociationMap) ToCustomDomainAssociationMapOutput() CustomDomainAssociationMapOutput {
   226  	return i.ToCustomDomainAssociationMapOutputWithContext(context.Background())
   227  }
   228  
   229  func (i CustomDomainAssociationMap) ToCustomDomainAssociationMapOutputWithContext(ctx context.Context) CustomDomainAssociationMapOutput {
   230  	return pulumi.ToOutputWithContext(ctx, i).(CustomDomainAssociationMapOutput)
   231  }
   232  
   233  type CustomDomainAssociationOutput struct{ *pulumi.OutputState }
   234  
   235  func (CustomDomainAssociationOutput) ElementType() reflect.Type {
   236  	return reflect.TypeOf((**CustomDomainAssociation)(nil)).Elem()
   237  }
   238  
   239  func (o CustomDomainAssociationOutput) ToCustomDomainAssociationOutput() CustomDomainAssociationOutput {
   240  	return o
   241  }
   242  
   243  func (o CustomDomainAssociationOutput) ToCustomDomainAssociationOutputWithContext(ctx context.Context) CustomDomainAssociationOutput {
   244  	return o
   245  }
   246  
   247  // A set of certificate CNAME records used for this domain name. See Certificate Validation Records below for more details.
   248  func (o CustomDomainAssociationOutput) CertificateValidationRecords() CustomDomainAssociationCertificateValidationRecordArrayOutput {
   249  	return o.ApplyT(func(v *CustomDomainAssociation) CustomDomainAssociationCertificateValidationRecordArrayOutput {
   250  		return v.CertificateValidationRecords
   251  	}).(CustomDomainAssociationCertificateValidationRecordArrayOutput)
   252  }
   253  
   254  // App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name. Attribute only available if resource created (not imported) with this provider.
   255  func (o CustomDomainAssociationOutput) DnsTarget() pulumi.StringOutput {
   256  	return o.ApplyT(func(v *CustomDomainAssociation) pulumi.StringOutput { return v.DnsTarget }).(pulumi.StringOutput)
   257  }
   258  
   259  // Custom domain endpoint to association. Specify a base domain e.g., `example.com` or a subdomain e.g., `subdomain.example.com`.
   260  func (o CustomDomainAssociationOutput) DomainName() pulumi.StringOutput {
   261  	return o.ApplyT(func(v *CustomDomainAssociation) pulumi.StringOutput { return v.DomainName }).(pulumi.StringOutput)
   262  }
   263  
   264  // Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to `true`.
   265  func (o CustomDomainAssociationOutput) EnableWwwSubdomain() pulumi.BoolPtrOutput {
   266  	return o.ApplyT(func(v *CustomDomainAssociation) pulumi.BoolPtrOutput { return v.EnableWwwSubdomain }).(pulumi.BoolPtrOutput)
   267  }
   268  
   269  // ARN of the App Runner service.
   270  func (o CustomDomainAssociationOutput) ServiceArn() pulumi.StringOutput {
   271  	return o.ApplyT(func(v *CustomDomainAssociation) pulumi.StringOutput { return v.ServiceArn }).(pulumi.StringOutput)
   272  }
   273  
   274  // Current state of the certificate CNAME record validation. It should change to `SUCCESS` after App Runner completes validation with your DNS.
   275  func (o CustomDomainAssociationOutput) Status() pulumi.StringOutput {
   276  	return o.ApplyT(func(v *CustomDomainAssociation) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
   277  }
   278  
   279  type CustomDomainAssociationArrayOutput struct{ *pulumi.OutputState }
   280  
   281  func (CustomDomainAssociationArrayOutput) ElementType() reflect.Type {
   282  	return reflect.TypeOf((*[]*CustomDomainAssociation)(nil)).Elem()
   283  }
   284  
   285  func (o CustomDomainAssociationArrayOutput) ToCustomDomainAssociationArrayOutput() CustomDomainAssociationArrayOutput {
   286  	return o
   287  }
   288  
   289  func (o CustomDomainAssociationArrayOutput) ToCustomDomainAssociationArrayOutputWithContext(ctx context.Context) CustomDomainAssociationArrayOutput {
   290  	return o
   291  }
   292  
   293  func (o CustomDomainAssociationArrayOutput) Index(i pulumi.IntInput) CustomDomainAssociationOutput {
   294  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *CustomDomainAssociation {
   295  		return vs[0].([]*CustomDomainAssociation)[vs[1].(int)]
   296  	}).(CustomDomainAssociationOutput)
   297  }
   298  
   299  type CustomDomainAssociationMapOutput struct{ *pulumi.OutputState }
   300  
   301  func (CustomDomainAssociationMapOutput) ElementType() reflect.Type {
   302  	return reflect.TypeOf((*map[string]*CustomDomainAssociation)(nil)).Elem()
   303  }
   304  
   305  func (o CustomDomainAssociationMapOutput) ToCustomDomainAssociationMapOutput() CustomDomainAssociationMapOutput {
   306  	return o
   307  }
   308  
   309  func (o CustomDomainAssociationMapOutput) ToCustomDomainAssociationMapOutputWithContext(ctx context.Context) CustomDomainAssociationMapOutput {
   310  	return o
   311  }
   312  
   313  func (o CustomDomainAssociationMapOutput) MapIndex(k pulumi.StringInput) CustomDomainAssociationOutput {
   314  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *CustomDomainAssociation {
   315  		return vs[0].(map[string]*CustomDomainAssociation)[vs[1].(string)]
   316  	}).(CustomDomainAssociationOutput)
   317  }
   318  
   319  func init() {
   320  	pulumi.RegisterInputType(reflect.TypeOf((*CustomDomainAssociationInput)(nil)).Elem(), &CustomDomainAssociation{})
   321  	pulumi.RegisterInputType(reflect.TypeOf((*CustomDomainAssociationArrayInput)(nil)).Elem(), CustomDomainAssociationArray{})
   322  	pulumi.RegisterInputType(reflect.TypeOf((*CustomDomainAssociationMapInput)(nil)).Elem(), CustomDomainAssociationMap{})
   323  	pulumi.RegisterOutputType(CustomDomainAssociationOutput{})
   324  	pulumi.RegisterOutputType(CustomDomainAssociationArrayOutput{})
   325  	pulumi.RegisterOutputType(CustomDomainAssociationMapOutput{})
   326  }