github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/route53/vpcAssociationAuthorization.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 route53
     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  // Authorizes a VPC in a different account to be associated with a local Route53 Hosted Zone.
    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/ec2"
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			example, err := ec2.NewVpc(ctx, "example", &ec2.VpcArgs{
    34  //				CidrBlock:          pulumi.String("10.6.0.0/16"),
    35  //				EnableDnsHostnames: pulumi.Bool(true),
    36  //				EnableDnsSupport:   pulumi.Bool(true),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			exampleZone, err := route53.NewZone(ctx, "example", &route53.ZoneArgs{
    42  //				Name: pulumi.String("example.com"),
    43  //				Vpcs: route53.ZoneVpcArray{
    44  //					&route53.ZoneVpcArgs{
    45  //						VpcId: example.ID(),
    46  //					},
    47  //				},
    48  //			})
    49  //			if err != nil {
    50  //				return err
    51  //			}
    52  //			alternate, err := ec2.NewVpc(ctx, "alternate", &ec2.VpcArgs{
    53  //				CidrBlock:          pulumi.String("10.7.0.0/16"),
    54  //				EnableDnsHostnames: pulumi.Bool(true),
    55  //				EnableDnsSupport:   pulumi.Bool(true),
    56  //			})
    57  //			if err != nil {
    58  //				return err
    59  //			}
    60  //			exampleVpcAssociationAuthorization, err := route53.NewVpcAssociationAuthorization(ctx, "example", &route53.VpcAssociationAuthorizationArgs{
    61  //				VpcId:  alternate.ID(),
    62  //				ZoneId: exampleZone.ID(),
    63  //			})
    64  //			if err != nil {
    65  //				return err
    66  //			}
    67  //			_, err = route53.NewZoneAssociation(ctx, "example", &route53.ZoneAssociationArgs{
    68  //				VpcId:  exampleVpcAssociationAuthorization.VpcId,
    69  //				ZoneId: exampleVpcAssociationAuthorization.ZoneId,
    70  //			})
    71  //			if err != nil {
    72  //				return err
    73  //			}
    74  //			return nil
    75  //		})
    76  //	}
    77  //
    78  // ```
    79  // <!--End PulumiCodeChooser -->
    80  //
    81  // ## Import
    82  //
    83  // Using `pulumi import`, import Route 53 VPC Association Authorizations using the Hosted Zone ID and VPC ID, separated by a colon (`:`). For example:
    84  //
    85  // ```sh
    86  // $ pulumi import aws:route53/vpcAssociationAuthorization:VpcAssociationAuthorization example Z123456ABCDEFG:vpc-12345678
    87  // ```
    88  type VpcAssociationAuthorization struct {
    89  	pulumi.CustomResourceState
    90  
    91  	// The VPC to authorize for association with the private hosted zone.
    92  	VpcId pulumi.StringOutput `pulumi:"vpcId"`
    93  	// The VPC's region. Defaults to the region of the AWS provider.
    94  	VpcRegion pulumi.StringOutput `pulumi:"vpcRegion"`
    95  	// The ID of the private hosted zone that you want to authorize associating a VPC with.
    96  	ZoneId pulumi.StringOutput `pulumi:"zoneId"`
    97  }
    98  
    99  // NewVpcAssociationAuthorization registers a new resource with the given unique name, arguments, and options.
   100  func NewVpcAssociationAuthorization(ctx *pulumi.Context,
   101  	name string, args *VpcAssociationAuthorizationArgs, opts ...pulumi.ResourceOption) (*VpcAssociationAuthorization, error) {
   102  	if args == nil {
   103  		return nil, errors.New("missing one or more required arguments")
   104  	}
   105  
   106  	if args.VpcId == nil {
   107  		return nil, errors.New("invalid value for required argument 'VpcId'")
   108  	}
   109  	if args.ZoneId == nil {
   110  		return nil, errors.New("invalid value for required argument 'ZoneId'")
   111  	}
   112  	opts = internal.PkgResourceDefaultOpts(opts)
   113  	var resource VpcAssociationAuthorization
   114  	err := ctx.RegisterResource("aws:route53/vpcAssociationAuthorization:VpcAssociationAuthorization", name, args, &resource, opts...)
   115  	if err != nil {
   116  		return nil, err
   117  	}
   118  	return &resource, nil
   119  }
   120  
   121  // GetVpcAssociationAuthorization gets an existing VpcAssociationAuthorization resource's state with the given name, ID, and optional
   122  // state properties that are used to uniquely qualify the lookup (nil if not required).
   123  func GetVpcAssociationAuthorization(ctx *pulumi.Context,
   124  	name string, id pulumi.IDInput, state *VpcAssociationAuthorizationState, opts ...pulumi.ResourceOption) (*VpcAssociationAuthorization, error) {
   125  	var resource VpcAssociationAuthorization
   126  	err := ctx.ReadResource("aws:route53/vpcAssociationAuthorization:VpcAssociationAuthorization", name, id, state, &resource, opts...)
   127  	if err != nil {
   128  		return nil, err
   129  	}
   130  	return &resource, nil
   131  }
   132  
   133  // Input properties used for looking up and filtering VpcAssociationAuthorization resources.
   134  type vpcAssociationAuthorizationState struct {
   135  	// The VPC to authorize for association with the private hosted zone.
   136  	VpcId *string `pulumi:"vpcId"`
   137  	// The VPC's region. Defaults to the region of the AWS provider.
   138  	VpcRegion *string `pulumi:"vpcRegion"`
   139  	// The ID of the private hosted zone that you want to authorize associating a VPC with.
   140  	ZoneId *string `pulumi:"zoneId"`
   141  }
   142  
   143  type VpcAssociationAuthorizationState struct {
   144  	// The VPC to authorize for association with the private hosted zone.
   145  	VpcId pulumi.StringPtrInput
   146  	// The VPC's region. Defaults to the region of the AWS provider.
   147  	VpcRegion pulumi.StringPtrInput
   148  	// The ID of the private hosted zone that you want to authorize associating a VPC with.
   149  	ZoneId pulumi.StringPtrInput
   150  }
   151  
   152  func (VpcAssociationAuthorizationState) ElementType() reflect.Type {
   153  	return reflect.TypeOf((*vpcAssociationAuthorizationState)(nil)).Elem()
   154  }
   155  
   156  type vpcAssociationAuthorizationArgs struct {
   157  	// The VPC to authorize for association with the private hosted zone.
   158  	VpcId string `pulumi:"vpcId"`
   159  	// The VPC's region. Defaults to the region of the AWS provider.
   160  	VpcRegion *string `pulumi:"vpcRegion"`
   161  	// The ID of the private hosted zone that you want to authorize associating a VPC with.
   162  	ZoneId string `pulumi:"zoneId"`
   163  }
   164  
   165  // The set of arguments for constructing a VpcAssociationAuthorization resource.
   166  type VpcAssociationAuthorizationArgs struct {
   167  	// The VPC to authorize for association with the private hosted zone.
   168  	VpcId pulumi.StringInput
   169  	// The VPC's region. Defaults to the region of the AWS provider.
   170  	VpcRegion pulumi.StringPtrInput
   171  	// The ID of the private hosted zone that you want to authorize associating a VPC with.
   172  	ZoneId pulumi.StringInput
   173  }
   174  
   175  func (VpcAssociationAuthorizationArgs) ElementType() reflect.Type {
   176  	return reflect.TypeOf((*vpcAssociationAuthorizationArgs)(nil)).Elem()
   177  }
   178  
   179  type VpcAssociationAuthorizationInput interface {
   180  	pulumi.Input
   181  
   182  	ToVpcAssociationAuthorizationOutput() VpcAssociationAuthorizationOutput
   183  	ToVpcAssociationAuthorizationOutputWithContext(ctx context.Context) VpcAssociationAuthorizationOutput
   184  }
   185  
   186  func (*VpcAssociationAuthorization) ElementType() reflect.Type {
   187  	return reflect.TypeOf((**VpcAssociationAuthorization)(nil)).Elem()
   188  }
   189  
   190  func (i *VpcAssociationAuthorization) ToVpcAssociationAuthorizationOutput() VpcAssociationAuthorizationOutput {
   191  	return i.ToVpcAssociationAuthorizationOutputWithContext(context.Background())
   192  }
   193  
   194  func (i *VpcAssociationAuthorization) ToVpcAssociationAuthorizationOutputWithContext(ctx context.Context) VpcAssociationAuthorizationOutput {
   195  	return pulumi.ToOutputWithContext(ctx, i).(VpcAssociationAuthorizationOutput)
   196  }
   197  
   198  // VpcAssociationAuthorizationArrayInput is an input type that accepts VpcAssociationAuthorizationArray and VpcAssociationAuthorizationArrayOutput values.
   199  // You can construct a concrete instance of `VpcAssociationAuthorizationArrayInput` via:
   200  //
   201  //	VpcAssociationAuthorizationArray{ VpcAssociationAuthorizationArgs{...} }
   202  type VpcAssociationAuthorizationArrayInput interface {
   203  	pulumi.Input
   204  
   205  	ToVpcAssociationAuthorizationArrayOutput() VpcAssociationAuthorizationArrayOutput
   206  	ToVpcAssociationAuthorizationArrayOutputWithContext(context.Context) VpcAssociationAuthorizationArrayOutput
   207  }
   208  
   209  type VpcAssociationAuthorizationArray []VpcAssociationAuthorizationInput
   210  
   211  func (VpcAssociationAuthorizationArray) ElementType() reflect.Type {
   212  	return reflect.TypeOf((*[]*VpcAssociationAuthorization)(nil)).Elem()
   213  }
   214  
   215  func (i VpcAssociationAuthorizationArray) ToVpcAssociationAuthorizationArrayOutput() VpcAssociationAuthorizationArrayOutput {
   216  	return i.ToVpcAssociationAuthorizationArrayOutputWithContext(context.Background())
   217  }
   218  
   219  func (i VpcAssociationAuthorizationArray) ToVpcAssociationAuthorizationArrayOutputWithContext(ctx context.Context) VpcAssociationAuthorizationArrayOutput {
   220  	return pulumi.ToOutputWithContext(ctx, i).(VpcAssociationAuthorizationArrayOutput)
   221  }
   222  
   223  // VpcAssociationAuthorizationMapInput is an input type that accepts VpcAssociationAuthorizationMap and VpcAssociationAuthorizationMapOutput values.
   224  // You can construct a concrete instance of `VpcAssociationAuthorizationMapInput` via:
   225  //
   226  //	VpcAssociationAuthorizationMap{ "key": VpcAssociationAuthorizationArgs{...} }
   227  type VpcAssociationAuthorizationMapInput interface {
   228  	pulumi.Input
   229  
   230  	ToVpcAssociationAuthorizationMapOutput() VpcAssociationAuthorizationMapOutput
   231  	ToVpcAssociationAuthorizationMapOutputWithContext(context.Context) VpcAssociationAuthorizationMapOutput
   232  }
   233  
   234  type VpcAssociationAuthorizationMap map[string]VpcAssociationAuthorizationInput
   235  
   236  func (VpcAssociationAuthorizationMap) ElementType() reflect.Type {
   237  	return reflect.TypeOf((*map[string]*VpcAssociationAuthorization)(nil)).Elem()
   238  }
   239  
   240  func (i VpcAssociationAuthorizationMap) ToVpcAssociationAuthorizationMapOutput() VpcAssociationAuthorizationMapOutput {
   241  	return i.ToVpcAssociationAuthorizationMapOutputWithContext(context.Background())
   242  }
   243  
   244  func (i VpcAssociationAuthorizationMap) ToVpcAssociationAuthorizationMapOutputWithContext(ctx context.Context) VpcAssociationAuthorizationMapOutput {
   245  	return pulumi.ToOutputWithContext(ctx, i).(VpcAssociationAuthorizationMapOutput)
   246  }
   247  
   248  type VpcAssociationAuthorizationOutput struct{ *pulumi.OutputState }
   249  
   250  func (VpcAssociationAuthorizationOutput) ElementType() reflect.Type {
   251  	return reflect.TypeOf((**VpcAssociationAuthorization)(nil)).Elem()
   252  }
   253  
   254  func (o VpcAssociationAuthorizationOutput) ToVpcAssociationAuthorizationOutput() VpcAssociationAuthorizationOutput {
   255  	return o
   256  }
   257  
   258  func (o VpcAssociationAuthorizationOutput) ToVpcAssociationAuthorizationOutputWithContext(ctx context.Context) VpcAssociationAuthorizationOutput {
   259  	return o
   260  }
   261  
   262  // The VPC to authorize for association with the private hosted zone.
   263  func (o VpcAssociationAuthorizationOutput) VpcId() pulumi.StringOutput {
   264  	return o.ApplyT(func(v *VpcAssociationAuthorization) pulumi.StringOutput { return v.VpcId }).(pulumi.StringOutput)
   265  }
   266  
   267  // The VPC's region. Defaults to the region of the AWS provider.
   268  func (o VpcAssociationAuthorizationOutput) VpcRegion() pulumi.StringOutput {
   269  	return o.ApplyT(func(v *VpcAssociationAuthorization) pulumi.StringOutput { return v.VpcRegion }).(pulumi.StringOutput)
   270  }
   271  
   272  // The ID of the private hosted zone that you want to authorize associating a VPC with.
   273  func (o VpcAssociationAuthorizationOutput) ZoneId() pulumi.StringOutput {
   274  	return o.ApplyT(func(v *VpcAssociationAuthorization) pulumi.StringOutput { return v.ZoneId }).(pulumi.StringOutput)
   275  }
   276  
   277  type VpcAssociationAuthorizationArrayOutput struct{ *pulumi.OutputState }
   278  
   279  func (VpcAssociationAuthorizationArrayOutput) ElementType() reflect.Type {
   280  	return reflect.TypeOf((*[]*VpcAssociationAuthorization)(nil)).Elem()
   281  }
   282  
   283  func (o VpcAssociationAuthorizationArrayOutput) ToVpcAssociationAuthorizationArrayOutput() VpcAssociationAuthorizationArrayOutput {
   284  	return o
   285  }
   286  
   287  func (o VpcAssociationAuthorizationArrayOutput) ToVpcAssociationAuthorizationArrayOutputWithContext(ctx context.Context) VpcAssociationAuthorizationArrayOutput {
   288  	return o
   289  }
   290  
   291  func (o VpcAssociationAuthorizationArrayOutput) Index(i pulumi.IntInput) VpcAssociationAuthorizationOutput {
   292  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VpcAssociationAuthorization {
   293  		return vs[0].([]*VpcAssociationAuthorization)[vs[1].(int)]
   294  	}).(VpcAssociationAuthorizationOutput)
   295  }
   296  
   297  type VpcAssociationAuthorizationMapOutput struct{ *pulumi.OutputState }
   298  
   299  func (VpcAssociationAuthorizationMapOutput) ElementType() reflect.Type {
   300  	return reflect.TypeOf((*map[string]*VpcAssociationAuthorization)(nil)).Elem()
   301  }
   302  
   303  func (o VpcAssociationAuthorizationMapOutput) ToVpcAssociationAuthorizationMapOutput() VpcAssociationAuthorizationMapOutput {
   304  	return o
   305  }
   306  
   307  func (o VpcAssociationAuthorizationMapOutput) ToVpcAssociationAuthorizationMapOutputWithContext(ctx context.Context) VpcAssociationAuthorizationMapOutput {
   308  	return o
   309  }
   310  
   311  func (o VpcAssociationAuthorizationMapOutput) MapIndex(k pulumi.StringInput) VpcAssociationAuthorizationOutput {
   312  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VpcAssociationAuthorization {
   313  		return vs[0].(map[string]*VpcAssociationAuthorization)[vs[1].(string)]
   314  	}).(VpcAssociationAuthorizationOutput)
   315  }
   316  
   317  func init() {
   318  	pulumi.RegisterInputType(reflect.TypeOf((*VpcAssociationAuthorizationInput)(nil)).Elem(), &VpcAssociationAuthorization{})
   319  	pulumi.RegisterInputType(reflect.TypeOf((*VpcAssociationAuthorizationArrayInput)(nil)).Elem(), VpcAssociationAuthorizationArray{})
   320  	pulumi.RegisterInputType(reflect.TypeOf((*VpcAssociationAuthorizationMapInput)(nil)).Elem(), VpcAssociationAuthorizationMap{})
   321  	pulumi.RegisterOutputType(VpcAssociationAuthorizationOutput{})
   322  	pulumi.RegisterOutputType(VpcAssociationAuthorizationArrayOutput{})
   323  	pulumi.RegisterOutputType(VpcAssociationAuthorizationMapOutput{})
   324  }