github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/amplify/domainAssociation.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 amplify
     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 an Amplify Domain Association resource.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/amplify"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			example, err := amplify.NewApp(ctx, "example", &amplify.AppArgs{
    33  //				Name: pulumi.String("app"),
    34  //				CustomRules: amplify.AppCustomRuleArray{
    35  //					&amplify.AppCustomRuleArgs{
    36  //						Source: pulumi.String("https://example.com"),
    37  //						Status: pulumi.String("302"),
    38  //						Target: pulumi.String("https://www.example.com"),
    39  //					},
    40  //				},
    41  //			})
    42  //			if err != nil {
    43  //				return err
    44  //			}
    45  //			master, err := amplify.NewBranch(ctx, "master", &amplify.BranchArgs{
    46  //				AppId:      example.ID(),
    47  //				BranchName: pulumi.String("master"),
    48  //			})
    49  //			if err != nil {
    50  //				return err
    51  //			}
    52  //			_, err = amplify.NewDomainAssociation(ctx, "example", &amplify.DomainAssociationArgs{
    53  //				AppId:      example.ID(),
    54  //				DomainName: pulumi.String("example.com"),
    55  //				SubDomains: amplify.DomainAssociationSubDomainArray{
    56  //					&amplify.DomainAssociationSubDomainArgs{
    57  //						BranchName: master.BranchName,
    58  //						Prefix:     pulumi.String(""),
    59  //					},
    60  //					&amplify.DomainAssociationSubDomainArgs{
    61  //						BranchName: master.BranchName,
    62  //						Prefix:     pulumi.String("www"),
    63  //					},
    64  //				},
    65  //			})
    66  //			if err != nil {
    67  //				return err
    68  //			}
    69  //			return nil
    70  //		})
    71  //	}
    72  //
    73  // ```
    74  // <!--End PulumiCodeChooser -->
    75  //
    76  // ## Import
    77  //
    78  // Using `pulumi import`, import Amplify domain association using `app_id` and `domain_name`. For example:
    79  //
    80  // ```sh
    81  // $ pulumi import aws:amplify/domainAssociation:DomainAssociation app d2ypk4k47z8u6/example.com
    82  // ```
    83  type DomainAssociation struct {
    84  	pulumi.CustomResourceState
    85  
    86  	// Unique ID for an Amplify app.
    87  	AppId pulumi.StringOutput `pulumi:"appId"`
    88  	// ARN for the domain association.
    89  	Arn pulumi.StringOutput `pulumi:"arn"`
    90  	// The DNS record for certificate verification.
    91  	CertificateVerificationDnsRecord pulumi.StringOutput `pulumi:"certificateVerificationDnsRecord"`
    92  	// Domain name for the domain association.
    93  	DomainName pulumi.StringOutput `pulumi:"domainName"`
    94  	// Enables the automated creation of subdomains for branches.
    95  	EnableAutoSubDomain pulumi.BoolPtrOutput `pulumi:"enableAutoSubDomain"`
    96  	// Setting for the subdomain. Documented below.
    97  	SubDomains DomainAssociationSubDomainArrayOutput `pulumi:"subDomains"`
    98  	// If enabled, the resource will wait for the domain association status to change to `PENDING_DEPLOYMENT` or `AVAILABLE`. Setting this to `false` will skip the process. Default: `true`.
    99  	WaitForVerification pulumi.BoolPtrOutput `pulumi:"waitForVerification"`
   100  }
   101  
   102  // NewDomainAssociation registers a new resource with the given unique name, arguments, and options.
   103  func NewDomainAssociation(ctx *pulumi.Context,
   104  	name string, args *DomainAssociationArgs, opts ...pulumi.ResourceOption) (*DomainAssociation, error) {
   105  	if args == nil {
   106  		return nil, errors.New("missing one or more required arguments")
   107  	}
   108  
   109  	if args.AppId == nil {
   110  		return nil, errors.New("invalid value for required argument 'AppId'")
   111  	}
   112  	if args.DomainName == nil {
   113  		return nil, errors.New("invalid value for required argument 'DomainName'")
   114  	}
   115  	if args.SubDomains == nil {
   116  		return nil, errors.New("invalid value for required argument 'SubDomains'")
   117  	}
   118  	opts = internal.PkgResourceDefaultOpts(opts)
   119  	var resource DomainAssociation
   120  	err := ctx.RegisterResource("aws:amplify/domainAssociation:DomainAssociation", name, args, &resource, opts...)
   121  	if err != nil {
   122  		return nil, err
   123  	}
   124  	return &resource, nil
   125  }
   126  
   127  // GetDomainAssociation gets an existing DomainAssociation resource's state with the given name, ID, and optional
   128  // state properties that are used to uniquely qualify the lookup (nil if not required).
   129  func GetDomainAssociation(ctx *pulumi.Context,
   130  	name string, id pulumi.IDInput, state *DomainAssociationState, opts ...pulumi.ResourceOption) (*DomainAssociation, error) {
   131  	var resource DomainAssociation
   132  	err := ctx.ReadResource("aws:amplify/domainAssociation:DomainAssociation", name, id, state, &resource, opts...)
   133  	if err != nil {
   134  		return nil, err
   135  	}
   136  	return &resource, nil
   137  }
   138  
   139  // Input properties used for looking up and filtering DomainAssociation resources.
   140  type domainAssociationState struct {
   141  	// Unique ID for an Amplify app.
   142  	AppId *string `pulumi:"appId"`
   143  	// ARN for the domain association.
   144  	Arn *string `pulumi:"arn"`
   145  	// The DNS record for certificate verification.
   146  	CertificateVerificationDnsRecord *string `pulumi:"certificateVerificationDnsRecord"`
   147  	// Domain name for the domain association.
   148  	DomainName *string `pulumi:"domainName"`
   149  	// Enables the automated creation of subdomains for branches.
   150  	EnableAutoSubDomain *bool `pulumi:"enableAutoSubDomain"`
   151  	// Setting for the subdomain. Documented below.
   152  	SubDomains []DomainAssociationSubDomain `pulumi:"subDomains"`
   153  	// If enabled, the resource will wait for the domain association status to change to `PENDING_DEPLOYMENT` or `AVAILABLE`. Setting this to `false` will skip the process. Default: `true`.
   154  	WaitForVerification *bool `pulumi:"waitForVerification"`
   155  }
   156  
   157  type DomainAssociationState struct {
   158  	// Unique ID for an Amplify app.
   159  	AppId pulumi.StringPtrInput
   160  	// ARN for the domain association.
   161  	Arn pulumi.StringPtrInput
   162  	// The DNS record for certificate verification.
   163  	CertificateVerificationDnsRecord pulumi.StringPtrInput
   164  	// Domain name for the domain association.
   165  	DomainName pulumi.StringPtrInput
   166  	// Enables the automated creation of subdomains for branches.
   167  	EnableAutoSubDomain pulumi.BoolPtrInput
   168  	// Setting for the subdomain. Documented below.
   169  	SubDomains DomainAssociationSubDomainArrayInput
   170  	// If enabled, the resource will wait for the domain association status to change to `PENDING_DEPLOYMENT` or `AVAILABLE`. Setting this to `false` will skip the process. Default: `true`.
   171  	WaitForVerification pulumi.BoolPtrInput
   172  }
   173  
   174  func (DomainAssociationState) ElementType() reflect.Type {
   175  	return reflect.TypeOf((*domainAssociationState)(nil)).Elem()
   176  }
   177  
   178  type domainAssociationArgs struct {
   179  	// Unique ID for an Amplify app.
   180  	AppId string `pulumi:"appId"`
   181  	// Domain name for the domain association.
   182  	DomainName string `pulumi:"domainName"`
   183  	// Enables the automated creation of subdomains for branches.
   184  	EnableAutoSubDomain *bool `pulumi:"enableAutoSubDomain"`
   185  	// Setting for the subdomain. Documented below.
   186  	SubDomains []DomainAssociationSubDomain `pulumi:"subDomains"`
   187  	// If enabled, the resource will wait for the domain association status to change to `PENDING_DEPLOYMENT` or `AVAILABLE`. Setting this to `false` will skip the process. Default: `true`.
   188  	WaitForVerification *bool `pulumi:"waitForVerification"`
   189  }
   190  
   191  // The set of arguments for constructing a DomainAssociation resource.
   192  type DomainAssociationArgs struct {
   193  	// Unique ID for an Amplify app.
   194  	AppId pulumi.StringInput
   195  	// Domain name for the domain association.
   196  	DomainName pulumi.StringInput
   197  	// Enables the automated creation of subdomains for branches.
   198  	EnableAutoSubDomain pulumi.BoolPtrInput
   199  	// Setting for the subdomain. Documented below.
   200  	SubDomains DomainAssociationSubDomainArrayInput
   201  	// If enabled, the resource will wait for the domain association status to change to `PENDING_DEPLOYMENT` or `AVAILABLE`. Setting this to `false` will skip the process. Default: `true`.
   202  	WaitForVerification pulumi.BoolPtrInput
   203  }
   204  
   205  func (DomainAssociationArgs) ElementType() reflect.Type {
   206  	return reflect.TypeOf((*domainAssociationArgs)(nil)).Elem()
   207  }
   208  
   209  type DomainAssociationInput interface {
   210  	pulumi.Input
   211  
   212  	ToDomainAssociationOutput() DomainAssociationOutput
   213  	ToDomainAssociationOutputWithContext(ctx context.Context) DomainAssociationOutput
   214  }
   215  
   216  func (*DomainAssociation) ElementType() reflect.Type {
   217  	return reflect.TypeOf((**DomainAssociation)(nil)).Elem()
   218  }
   219  
   220  func (i *DomainAssociation) ToDomainAssociationOutput() DomainAssociationOutput {
   221  	return i.ToDomainAssociationOutputWithContext(context.Background())
   222  }
   223  
   224  func (i *DomainAssociation) ToDomainAssociationOutputWithContext(ctx context.Context) DomainAssociationOutput {
   225  	return pulumi.ToOutputWithContext(ctx, i).(DomainAssociationOutput)
   226  }
   227  
   228  // DomainAssociationArrayInput is an input type that accepts DomainAssociationArray and DomainAssociationArrayOutput values.
   229  // You can construct a concrete instance of `DomainAssociationArrayInput` via:
   230  //
   231  //	DomainAssociationArray{ DomainAssociationArgs{...} }
   232  type DomainAssociationArrayInput interface {
   233  	pulumi.Input
   234  
   235  	ToDomainAssociationArrayOutput() DomainAssociationArrayOutput
   236  	ToDomainAssociationArrayOutputWithContext(context.Context) DomainAssociationArrayOutput
   237  }
   238  
   239  type DomainAssociationArray []DomainAssociationInput
   240  
   241  func (DomainAssociationArray) ElementType() reflect.Type {
   242  	return reflect.TypeOf((*[]*DomainAssociation)(nil)).Elem()
   243  }
   244  
   245  func (i DomainAssociationArray) ToDomainAssociationArrayOutput() DomainAssociationArrayOutput {
   246  	return i.ToDomainAssociationArrayOutputWithContext(context.Background())
   247  }
   248  
   249  func (i DomainAssociationArray) ToDomainAssociationArrayOutputWithContext(ctx context.Context) DomainAssociationArrayOutput {
   250  	return pulumi.ToOutputWithContext(ctx, i).(DomainAssociationArrayOutput)
   251  }
   252  
   253  // DomainAssociationMapInput is an input type that accepts DomainAssociationMap and DomainAssociationMapOutput values.
   254  // You can construct a concrete instance of `DomainAssociationMapInput` via:
   255  //
   256  //	DomainAssociationMap{ "key": DomainAssociationArgs{...} }
   257  type DomainAssociationMapInput interface {
   258  	pulumi.Input
   259  
   260  	ToDomainAssociationMapOutput() DomainAssociationMapOutput
   261  	ToDomainAssociationMapOutputWithContext(context.Context) DomainAssociationMapOutput
   262  }
   263  
   264  type DomainAssociationMap map[string]DomainAssociationInput
   265  
   266  func (DomainAssociationMap) ElementType() reflect.Type {
   267  	return reflect.TypeOf((*map[string]*DomainAssociation)(nil)).Elem()
   268  }
   269  
   270  func (i DomainAssociationMap) ToDomainAssociationMapOutput() DomainAssociationMapOutput {
   271  	return i.ToDomainAssociationMapOutputWithContext(context.Background())
   272  }
   273  
   274  func (i DomainAssociationMap) ToDomainAssociationMapOutputWithContext(ctx context.Context) DomainAssociationMapOutput {
   275  	return pulumi.ToOutputWithContext(ctx, i).(DomainAssociationMapOutput)
   276  }
   277  
   278  type DomainAssociationOutput struct{ *pulumi.OutputState }
   279  
   280  func (DomainAssociationOutput) ElementType() reflect.Type {
   281  	return reflect.TypeOf((**DomainAssociation)(nil)).Elem()
   282  }
   283  
   284  func (o DomainAssociationOutput) ToDomainAssociationOutput() DomainAssociationOutput {
   285  	return o
   286  }
   287  
   288  func (o DomainAssociationOutput) ToDomainAssociationOutputWithContext(ctx context.Context) DomainAssociationOutput {
   289  	return o
   290  }
   291  
   292  // Unique ID for an Amplify app.
   293  func (o DomainAssociationOutput) AppId() pulumi.StringOutput {
   294  	return o.ApplyT(func(v *DomainAssociation) pulumi.StringOutput { return v.AppId }).(pulumi.StringOutput)
   295  }
   296  
   297  // ARN for the domain association.
   298  func (o DomainAssociationOutput) Arn() pulumi.StringOutput {
   299  	return o.ApplyT(func(v *DomainAssociation) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   300  }
   301  
   302  // The DNS record for certificate verification.
   303  func (o DomainAssociationOutput) CertificateVerificationDnsRecord() pulumi.StringOutput {
   304  	return o.ApplyT(func(v *DomainAssociation) pulumi.StringOutput { return v.CertificateVerificationDnsRecord }).(pulumi.StringOutput)
   305  }
   306  
   307  // Domain name for the domain association.
   308  func (o DomainAssociationOutput) DomainName() pulumi.StringOutput {
   309  	return o.ApplyT(func(v *DomainAssociation) pulumi.StringOutput { return v.DomainName }).(pulumi.StringOutput)
   310  }
   311  
   312  // Enables the automated creation of subdomains for branches.
   313  func (o DomainAssociationOutput) EnableAutoSubDomain() pulumi.BoolPtrOutput {
   314  	return o.ApplyT(func(v *DomainAssociation) pulumi.BoolPtrOutput { return v.EnableAutoSubDomain }).(pulumi.BoolPtrOutput)
   315  }
   316  
   317  // Setting for the subdomain. Documented below.
   318  func (o DomainAssociationOutput) SubDomains() DomainAssociationSubDomainArrayOutput {
   319  	return o.ApplyT(func(v *DomainAssociation) DomainAssociationSubDomainArrayOutput { return v.SubDomains }).(DomainAssociationSubDomainArrayOutput)
   320  }
   321  
   322  // If enabled, the resource will wait for the domain association status to change to `PENDING_DEPLOYMENT` or `AVAILABLE`. Setting this to `false` will skip the process. Default: `true`.
   323  func (o DomainAssociationOutput) WaitForVerification() pulumi.BoolPtrOutput {
   324  	return o.ApplyT(func(v *DomainAssociation) pulumi.BoolPtrOutput { return v.WaitForVerification }).(pulumi.BoolPtrOutput)
   325  }
   326  
   327  type DomainAssociationArrayOutput struct{ *pulumi.OutputState }
   328  
   329  func (DomainAssociationArrayOutput) ElementType() reflect.Type {
   330  	return reflect.TypeOf((*[]*DomainAssociation)(nil)).Elem()
   331  }
   332  
   333  func (o DomainAssociationArrayOutput) ToDomainAssociationArrayOutput() DomainAssociationArrayOutput {
   334  	return o
   335  }
   336  
   337  func (o DomainAssociationArrayOutput) ToDomainAssociationArrayOutputWithContext(ctx context.Context) DomainAssociationArrayOutput {
   338  	return o
   339  }
   340  
   341  func (o DomainAssociationArrayOutput) Index(i pulumi.IntInput) DomainAssociationOutput {
   342  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *DomainAssociation {
   343  		return vs[0].([]*DomainAssociation)[vs[1].(int)]
   344  	}).(DomainAssociationOutput)
   345  }
   346  
   347  type DomainAssociationMapOutput struct{ *pulumi.OutputState }
   348  
   349  func (DomainAssociationMapOutput) ElementType() reflect.Type {
   350  	return reflect.TypeOf((*map[string]*DomainAssociation)(nil)).Elem()
   351  }
   352  
   353  func (o DomainAssociationMapOutput) ToDomainAssociationMapOutput() DomainAssociationMapOutput {
   354  	return o
   355  }
   356  
   357  func (o DomainAssociationMapOutput) ToDomainAssociationMapOutputWithContext(ctx context.Context) DomainAssociationMapOutput {
   358  	return o
   359  }
   360  
   361  func (o DomainAssociationMapOutput) MapIndex(k pulumi.StringInput) DomainAssociationOutput {
   362  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *DomainAssociation {
   363  		return vs[0].(map[string]*DomainAssociation)[vs[1].(string)]
   364  	}).(DomainAssociationOutput)
   365  }
   366  
   367  func init() {
   368  	pulumi.RegisterInputType(reflect.TypeOf((*DomainAssociationInput)(nil)).Elem(), &DomainAssociation{})
   369  	pulumi.RegisterInputType(reflect.TypeOf((*DomainAssociationArrayInput)(nil)).Elem(), DomainAssociationArray{})
   370  	pulumi.RegisterInputType(reflect.TypeOf((*DomainAssociationMapInput)(nil)).Elem(), DomainAssociationMap{})
   371  	pulumi.RegisterOutputType(DomainAssociationOutput{})
   372  	pulumi.RegisterOutputType(DomainAssociationArrayOutput{})
   373  	pulumi.RegisterOutputType(DomainAssociationMapOutput{})
   374  }