github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/networkmanager/vpcAttachment.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 networkmanager
     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  // Resource for managing an AWS Network Manager VPC Attachment.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/networkmanager"
    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 := networkmanager.NewVpcAttachment(ctx, "example", &networkmanager.VpcAttachmentArgs{
    35  //				SubnetArns: pulumi.StringArray{
    36  //					exampleAwsSubnet.Arn,
    37  //				},
    38  //				CoreNetworkId: pulumi.Any(exampleAwsccNetworkmanagerCoreNetwork.Id),
    39  //				VpcArn:        pulumi.Any(exampleAwsVpc.Arn),
    40  //			})
    41  //			if err != nil {
    42  //				return err
    43  //			}
    44  //			return nil
    45  //		})
    46  //	}
    47  //
    48  // ```
    49  // <!--End PulumiCodeChooser -->
    50  //
    51  // ## Import
    52  //
    53  // Using `pulumi import`, import `aws_networkmanager_vpc_attachment` using the attachment ID. For example:
    54  //
    55  // ```sh
    56  // $ pulumi import aws:networkmanager/vpcAttachment:VpcAttachment example attachment-0f8fa60d2238d1bd8
    57  // ```
    58  type VpcAttachment struct {
    59  	pulumi.CustomResourceState
    60  
    61  	// The ARN of the attachment.
    62  	Arn pulumi.StringOutput `pulumi:"arn"`
    63  	// The policy rule number associated with the attachment.
    64  	AttachmentPolicyRuleNumber pulumi.IntOutput `pulumi:"attachmentPolicyRuleNumber"`
    65  	// The type of attachment.
    66  	AttachmentType pulumi.StringOutput `pulumi:"attachmentType"`
    67  	// The ARN of a core network.
    68  	CoreNetworkArn pulumi.StringOutput `pulumi:"coreNetworkArn"`
    69  	// The ID of a core network for the VPC attachment.
    70  	CoreNetworkId pulumi.StringOutput `pulumi:"coreNetworkId"`
    71  	// The Region where the edge is located.
    72  	EdgeLocation pulumi.StringOutput `pulumi:"edgeLocation"`
    73  	// Options for the VPC attachment.
    74  	Options VpcAttachmentOptionsPtrOutput `pulumi:"options"`
    75  	// The ID of the attachment account owner.
    76  	OwnerAccountId pulumi.StringOutput `pulumi:"ownerAccountId"`
    77  	// The attachment resource ARN.
    78  	ResourceArn pulumi.StringOutput `pulumi:"resourceArn"`
    79  	// The name of the segment attachment.
    80  	SegmentName pulumi.StringOutput `pulumi:"segmentName"`
    81  	// The state of the attachment.
    82  	State pulumi.StringOutput `pulumi:"state"`
    83  	// The subnet ARN of the VPC attachment.
    84  	SubnetArns pulumi.StringArrayOutput `pulumi:"subnetArns"`
    85  	// Key-value tags for the attachment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    86  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    87  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    88  	//
    89  	// Deprecated: Please use `tags` instead.
    90  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    91  	// The ARN of the VPC.
    92  	//
    93  	// The following arguments are optional:
    94  	VpcArn pulumi.StringOutput `pulumi:"vpcArn"`
    95  }
    96  
    97  // NewVpcAttachment registers a new resource with the given unique name, arguments, and options.
    98  func NewVpcAttachment(ctx *pulumi.Context,
    99  	name string, args *VpcAttachmentArgs, opts ...pulumi.ResourceOption) (*VpcAttachment, error) {
   100  	if args == nil {
   101  		return nil, errors.New("missing one or more required arguments")
   102  	}
   103  
   104  	if args.CoreNetworkId == nil {
   105  		return nil, errors.New("invalid value for required argument 'CoreNetworkId'")
   106  	}
   107  	if args.SubnetArns == nil {
   108  		return nil, errors.New("invalid value for required argument 'SubnetArns'")
   109  	}
   110  	if args.VpcArn == nil {
   111  		return nil, errors.New("invalid value for required argument 'VpcArn'")
   112  	}
   113  	opts = internal.PkgResourceDefaultOpts(opts)
   114  	var resource VpcAttachment
   115  	err := ctx.RegisterResource("aws:networkmanager/vpcAttachment:VpcAttachment", name, args, &resource, opts...)
   116  	if err != nil {
   117  		return nil, err
   118  	}
   119  	return &resource, nil
   120  }
   121  
   122  // GetVpcAttachment gets an existing VpcAttachment resource's state with the given name, ID, and optional
   123  // state properties that are used to uniquely qualify the lookup (nil if not required).
   124  func GetVpcAttachment(ctx *pulumi.Context,
   125  	name string, id pulumi.IDInput, state *VpcAttachmentState, opts ...pulumi.ResourceOption) (*VpcAttachment, error) {
   126  	var resource VpcAttachment
   127  	err := ctx.ReadResource("aws:networkmanager/vpcAttachment:VpcAttachment", name, id, state, &resource, opts...)
   128  	if err != nil {
   129  		return nil, err
   130  	}
   131  	return &resource, nil
   132  }
   133  
   134  // Input properties used for looking up and filtering VpcAttachment resources.
   135  type vpcAttachmentState struct {
   136  	// The ARN of the attachment.
   137  	Arn *string `pulumi:"arn"`
   138  	// The policy rule number associated with the attachment.
   139  	AttachmentPolicyRuleNumber *int `pulumi:"attachmentPolicyRuleNumber"`
   140  	// The type of attachment.
   141  	AttachmentType *string `pulumi:"attachmentType"`
   142  	// The ARN of a core network.
   143  	CoreNetworkArn *string `pulumi:"coreNetworkArn"`
   144  	// The ID of a core network for the VPC attachment.
   145  	CoreNetworkId *string `pulumi:"coreNetworkId"`
   146  	// The Region where the edge is located.
   147  	EdgeLocation *string `pulumi:"edgeLocation"`
   148  	// Options for the VPC attachment.
   149  	Options *VpcAttachmentOptions `pulumi:"options"`
   150  	// The ID of the attachment account owner.
   151  	OwnerAccountId *string `pulumi:"ownerAccountId"`
   152  	// The attachment resource ARN.
   153  	ResourceArn *string `pulumi:"resourceArn"`
   154  	// The name of the segment attachment.
   155  	SegmentName *string `pulumi:"segmentName"`
   156  	// The state of the attachment.
   157  	State *string `pulumi:"state"`
   158  	// The subnet ARN of the VPC attachment.
   159  	SubnetArns []string `pulumi:"subnetArns"`
   160  	// Key-value tags for the attachment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   161  	Tags map[string]string `pulumi:"tags"`
   162  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   163  	//
   164  	// Deprecated: Please use `tags` instead.
   165  	TagsAll map[string]string `pulumi:"tagsAll"`
   166  	// The ARN of the VPC.
   167  	//
   168  	// The following arguments are optional:
   169  	VpcArn *string `pulumi:"vpcArn"`
   170  }
   171  
   172  type VpcAttachmentState struct {
   173  	// The ARN of the attachment.
   174  	Arn pulumi.StringPtrInput
   175  	// The policy rule number associated with the attachment.
   176  	AttachmentPolicyRuleNumber pulumi.IntPtrInput
   177  	// The type of attachment.
   178  	AttachmentType pulumi.StringPtrInput
   179  	// The ARN of a core network.
   180  	CoreNetworkArn pulumi.StringPtrInput
   181  	// The ID of a core network for the VPC attachment.
   182  	CoreNetworkId pulumi.StringPtrInput
   183  	// The Region where the edge is located.
   184  	EdgeLocation pulumi.StringPtrInput
   185  	// Options for the VPC attachment.
   186  	Options VpcAttachmentOptionsPtrInput
   187  	// The ID of the attachment account owner.
   188  	OwnerAccountId pulumi.StringPtrInput
   189  	// The attachment resource ARN.
   190  	ResourceArn pulumi.StringPtrInput
   191  	// The name of the segment attachment.
   192  	SegmentName pulumi.StringPtrInput
   193  	// The state of the attachment.
   194  	State pulumi.StringPtrInput
   195  	// The subnet ARN of the VPC attachment.
   196  	SubnetArns pulumi.StringArrayInput
   197  	// Key-value tags for the attachment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   198  	Tags pulumi.StringMapInput
   199  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   200  	//
   201  	// Deprecated: Please use `tags` instead.
   202  	TagsAll pulumi.StringMapInput
   203  	// The ARN of the VPC.
   204  	//
   205  	// The following arguments are optional:
   206  	VpcArn pulumi.StringPtrInput
   207  }
   208  
   209  func (VpcAttachmentState) ElementType() reflect.Type {
   210  	return reflect.TypeOf((*vpcAttachmentState)(nil)).Elem()
   211  }
   212  
   213  type vpcAttachmentArgs struct {
   214  	// The ID of a core network for the VPC attachment.
   215  	CoreNetworkId string `pulumi:"coreNetworkId"`
   216  	// Options for the VPC attachment.
   217  	Options *VpcAttachmentOptions `pulumi:"options"`
   218  	// The subnet ARN of the VPC attachment.
   219  	SubnetArns []string `pulumi:"subnetArns"`
   220  	// Key-value tags for the attachment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   221  	Tags map[string]string `pulumi:"tags"`
   222  	// The ARN of the VPC.
   223  	//
   224  	// The following arguments are optional:
   225  	VpcArn string `pulumi:"vpcArn"`
   226  }
   227  
   228  // The set of arguments for constructing a VpcAttachment resource.
   229  type VpcAttachmentArgs struct {
   230  	// The ID of a core network for the VPC attachment.
   231  	CoreNetworkId pulumi.StringInput
   232  	// Options for the VPC attachment.
   233  	Options VpcAttachmentOptionsPtrInput
   234  	// The subnet ARN of the VPC attachment.
   235  	SubnetArns pulumi.StringArrayInput
   236  	// Key-value tags for the attachment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   237  	Tags pulumi.StringMapInput
   238  	// The ARN of the VPC.
   239  	//
   240  	// The following arguments are optional:
   241  	VpcArn pulumi.StringInput
   242  }
   243  
   244  func (VpcAttachmentArgs) ElementType() reflect.Type {
   245  	return reflect.TypeOf((*vpcAttachmentArgs)(nil)).Elem()
   246  }
   247  
   248  type VpcAttachmentInput interface {
   249  	pulumi.Input
   250  
   251  	ToVpcAttachmentOutput() VpcAttachmentOutput
   252  	ToVpcAttachmentOutputWithContext(ctx context.Context) VpcAttachmentOutput
   253  }
   254  
   255  func (*VpcAttachment) ElementType() reflect.Type {
   256  	return reflect.TypeOf((**VpcAttachment)(nil)).Elem()
   257  }
   258  
   259  func (i *VpcAttachment) ToVpcAttachmentOutput() VpcAttachmentOutput {
   260  	return i.ToVpcAttachmentOutputWithContext(context.Background())
   261  }
   262  
   263  func (i *VpcAttachment) ToVpcAttachmentOutputWithContext(ctx context.Context) VpcAttachmentOutput {
   264  	return pulumi.ToOutputWithContext(ctx, i).(VpcAttachmentOutput)
   265  }
   266  
   267  // VpcAttachmentArrayInput is an input type that accepts VpcAttachmentArray and VpcAttachmentArrayOutput values.
   268  // You can construct a concrete instance of `VpcAttachmentArrayInput` via:
   269  //
   270  //	VpcAttachmentArray{ VpcAttachmentArgs{...} }
   271  type VpcAttachmentArrayInput interface {
   272  	pulumi.Input
   273  
   274  	ToVpcAttachmentArrayOutput() VpcAttachmentArrayOutput
   275  	ToVpcAttachmentArrayOutputWithContext(context.Context) VpcAttachmentArrayOutput
   276  }
   277  
   278  type VpcAttachmentArray []VpcAttachmentInput
   279  
   280  func (VpcAttachmentArray) ElementType() reflect.Type {
   281  	return reflect.TypeOf((*[]*VpcAttachment)(nil)).Elem()
   282  }
   283  
   284  func (i VpcAttachmentArray) ToVpcAttachmentArrayOutput() VpcAttachmentArrayOutput {
   285  	return i.ToVpcAttachmentArrayOutputWithContext(context.Background())
   286  }
   287  
   288  func (i VpcAttachmentArray) ToVpcAttachmentArrayOutputWithContext(ctx context.Context) VpcAttachmentArrayOutput {
   289  	return pulumi.ToOutputWithContext(ctx, i).(VpcAttachmentArrayOutput)
   290  }
   291  
   292  // VpcAttachmentMapInput is an input type that accepts VpcAttachmentMap and VpcAttachmentMapOutput values.
   293  // You can construct a concrete instance of `VpcAttachmentMapInput` via:
   294  //
   295  //	VpcAttachmentMap{ "key": VpcAttachmentArgs{...} }
   296  type VpcAttachmentMapInput interface {
   297  	pulumi.Input
   298  
   299  	ToVpcAttachmentMapOutput() VpcAttachmentMapOutput
   300  	ToVpcAttachmentMapOutputWithContext(context.Context) VpcAttachmentMapOutput
   301  }
   302  
   303  type VpcAttachmentMap map[string]VpcAttachmentInput
   304  
   305  func (VpcAttachmentMap) ElementType() reflect.Type {
   306  	return reflect.TypeOf((*map[string]*VpcAttachment)(nil)).Elem()
   307  }
   308  
   309  func (i VpcAttachmentMap) ToVpcAttachmentMapOutput() VpcAttachmentMapOutput {
   310  	return i.ToVpcAttachmentMapOutputWithContext(context.Background())
   311  }
   312  
   313  func (i VpcAttachmentMap) ToVpcAttachmentMapOutputWithContext(ctx context.Context) VpcAttachmentMapOutput {
   314  	return pulumi.ToOutputWithContext(ctx, i).(VpcAttachmentMapOutput)
   315  }
   316  
   317  type VpcAttachmentOutput struct{ *pulumi.OutputState }
   318  
   319  func (VpcAttachmentOutput) ElementType() reflect.Type {
   320  	return reflect.TypeOf((**VpcAttachment)(nil)).Elem()
   321  }
   322  
   323  func (o VpcAttachmentOutput) ToVpcAttachmentOutput() VpcAttachmentOutput {
   324  	return o
   325  }
   326  
   327  func (o VpcAttachmentOutput) ToVpcAttachmentOutputWithContext(ctx context.Context) VpcAttachmentOutput {
   328  	return o
   329  }
   330  
   331  // The ARN of the attachment.
   332  func (o VpcAttachmentOutput) Arn() pulumi.StringOutput {
   333  	return o.ApplyT(func(v *VpcAttachment) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   334  }
   335  
   336  // The policy rule number associated with the attachment.
   337  func (o VpcAttachmentOutput) AttachmentPolicyRuleNumber() pulumi.IntOutput {
   338  	return o.ApplyT(func(v *VpcAttachment) pulumi.IntOutput { return v.AttachmentPolicyRuleNumber }).(pulumi.IntOutput)
   339  }
   340  
   341  // The type of attachment.
   342  func (o VpcAttachmentOutput) AttachmentType() pulumi.StringOutput {
   343  	return o.ApplyT(func(v *VpcAttachment) pulumi.StringOutput { return v.AttachmentType }).(pulumi.StringOutput)
   344  }
   345  
   346  // The ARN of a core network.
   347  func (o VpcAttachmentOutput) CoreNetworkArn() pulumi.StringOutput {
   348  	return o.ApplyT(func(v *VpcAttachment) pulumi.StringOutput { return v.CoreNetworkArn }).(pulumi.StringOutput)
   349  }
   350  
   351  // The ID of a core network for the VPC attachment.
   352  func (o VpcAttachmentOutput) CoreNetworkId() pulumi.StringOutput {
   353  	return o.ApplyT(func(v *VpcAttachment) pulumi.StringOutput { return v.CoreNetworkId }).(pulumi.StringOutput)
   354  }
   355  
   356  // The Region where the edge is located.
   357  func (o VpcAttachmentOutput) EdgeLocation() pulumi.StringOutput {
   358  	return o.ApplyT(func(v *VpcAttachment) pulumi.StringOutput { return v.EdgeLocation }).(pulumi.StringOutput)
   359  }
   360  
   361  // Options for the VPC attachment.
   362  func (o VpcAttachmentOutput) Options() VpcAttachmentOptionsPtrOutput {
   363  	return o.ApplyT(func(v *VpcAttachment) VpcAttachmentOptionsPtrOutput { return v.Options }).(VpcAttachmentOptionsPtrOutput)
   364  }
   365  
   366  // The ID of the attachment account owner.
   367  func (o VpcAttachmentOutput) OwnerAccountId() pulumi.StringOutput {
   368  	return o.ApplyT(func(v *VpcAttachment) pulumi.StringOutput { return v.OwnerAccountId }).(pulumi.StringOutput)
   369  }
   370  
   371  // The attachment resource ARN.
   372  func (o VpcAttachmentOutput) ResourceArn() pulumi.StringOutput {
   373  	return o.ApplyT(func(v *VpcAttachment) pulumi.StringOutput { return v.ResourceArn }).(pulumi.StringOutput)
   374  }
   375  
   376  // The name of the segment attachment.
   377  func (o VpcAttachmentOutput) SegmentName() pulumi.StringOutput {
   378  	return o.ApplyT(func(v *VpcAttachment) pulumi.StringOutput { return v.SegmentName }).(pulumi.StringOutput)
   379  }
   380  
   381  // The state of the attachment.
   382  func (o VpcAttachmentOutput) State() pulumi.StringOutput {
   383  	return o.ApplyT(func(v *VpcAttachment) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)
   384  }
   385  
   386  // The subnet ARN of the VPC attachment.
   387  func (o VpcAttachmentOutput) SubnetArns() pulumi.StringArrayOutput {
   388  	return o.ApplyT(func(v *VpcAttachment) pulumi.StringArrayOutput { return v.SubnetArns }).(pulumi.StringArrayOutput)
   389  }
   390  
   391  // Key-value tags for the attachment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   392  func (o VpcAttachmentOutput) Tags() pulumi.StringMapOutput {
   393  	return o.ApplyT(func(v *VpcAttachment) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   394  }
   395  
   396  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   397  //
   398  // Deprecated: Please use `tags` instead.
   399  func (o VpcAttachmentOutput) TagsAll() pulumi.StringMapOutput {
   400  	return o.ApplyT(func(v *VpcAttachment) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   401  }
   402  
   403  // The ARN of the VPC.
   404  //
   405  // The following arguments are optional:
   406  func (o VpcAttachmentOutput) VpcArn() pulumi.StringOutput {
   407  	return o.ApplyT(func(v *VpcAttachment) pulumi.StringOutput { return v.VpcArn }).(pulumi.StringOutput)
   408  }
   409  
   410  type VpcAttachmentArrayOutput struct{ *pulumi.OutputState }
   411  
   412  func (VpcAttachmentArrayOutput) ElementType() reflect.Type {
   413  	return reflect.TypeOf((*[]*VpcAttachment)(nil)).Elem()
   414  }
   415  
   416  func (o VpcAttachmentArrayOutput) ToVpcAttachmentArrayOutput() VpcAttachmentArrayOutput {
   417  	return o
   418  }
   419  
   420  func (o VpcAttachmentArrayOutput) ToVpcAttachmentArrayOutputWithContext(ctx context.Context) VpcAttachmentArrayOutput {
   421  	return o
   422  }
   423  
   424  func (o VpcAttachmentArrayOutput) Index(i pulumi.IntInput) VpcAttachmentOutput {
   425  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VpcAttachment {
   426  		return vs[0].([]*VpcAttachment)[vs[1].(int)]
   427  	}).(VpcAttachmentOutput)
   428  }
   429  
   430  type VpcAttachmentMapOutput struct{ *pulumi.OutputState }
   431  
   432  func (VpcAttachmentMapOutput) ElementType() reflect.Type {
   433  	return reflect.TypeOf((*map[string]*VpcAttachment)(nil)).Elem()
   434  }
   435  
   436  func (o VpcAttachmentMapOutput) ToVpcAttachmentMapOutput() VpcAttachmentMapOutput {
   437  	return o
   438  }
   439  
   440  func (o VpcAttachmentMapOutput) ToVpcAttachmentMapOutputWithContext(ctx context.Context) VpcAttachmentMapOutput {
   441  	return o
   442  }
   443  
   444  func (o VpcAttachmentMapOutput) MapIndex(k pulumi.StringInput) VpcAttachmentOutput {
   445  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VpcAttachment {
   446  		return vs[0].(map[string]*VpcAttachment)[vs[1].(string)]
   447  	}).(VpcAttachmentOutput)
   448  }
   449  
   450  func init() {
   451  	pulumi.RegisterInputType(reflect.TypeOf((*VpcAttachmentInput)(nil)).Elem(), &VpcAttachment{})
   452  	pulumi.RegisterInputType(reflect.TypeOf((*VpcAttachmentArrayInput)(nil)).Elem(), VpcAttachmentArray{})
   453  	pulumi.RegisterInputType(reflect.TypeOf((*VpcAttachmentMapInput)(nil)).Elem(), VpcAttachmentMap{})
   454  	pulumi.RegisterOutputType(VpcAttachmentOutput{})
   455  	pulumi.RegisterOutputType(VpcAttachmentArrayOutput{})
   456  	pulumi.RegisterOutputType(VpcAttachmentMapOutput{})
   457  }