github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/vpcIpv4CidrBlockAssociation.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 ec2
     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 resource to associate additional IPv4 CIDR blocks with a VPC.
    16  //
    17  // When a VPC is created, a primary IPv4 CIDR block for the VPC must be specified.
    18  // The `ec2.VpcIpv4CidrBlockAssociation` resource allows further IPv4 CIDR blocks to be added to the VPC.
    19  //
    20  // ## Example Usage
    21  //
    22  // <!--Start PulumiCodeChooser -->
    23  // ```go
    24  // package main
    25  //
    26  // import (
    27  //
    28  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    29  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    30  //
    31  // )
    32  //
    33  //	func main() {
    34  //		pulumi.Run(func(ctx *pulumi.Context) error {
    35  //			main, err := ec2.NewVpc(ctx, "main", &ec2.VpcArgs{
    36  //				CidrBlock: pulumi.String("10.0.0.0/16"),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			_, err = ec2.NewVpcIpv4CidrBlockAssociation(ctx, "secondary_cidr", &ec2.VpcIpv4CidrBlockAssociationArgs{
    42  //				VpcId:     main.ID(),
    43  //				CidrBlock: pulumi.String("172.20.0.0/16"),
    44  //			})
    45  //			if err != nil {
    46  //				return err
    47  //			}
    48  //			return nil
    49  //		})
    50  //	}
    51  //
    52  // ```
    53  // <!--End PulumiCodeChooser -->
    54  //
    55  // ## Import
    56  //
    57  // Using `pulumi import`, import `aws_vpc_ipv4_cidr_block_association` using the VPC CIDR Association ID. For example:
    58  //
    59  // ```sh
    60  // $ pulumi import aws:ec2/vpcIpv4CidrBlockAssociation:VpcIpv4CidrBlockAssociation example vpc-cidr-assoc-xxxxxxxx
    61  // ```
    62  type VpcIpv4CidrBlockAssociation struct {
    63  	pulumi.CustomResourceState
    64  
    65  	// The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4NetmaskLength`.
    66  	CidrBlock pulumi.StringOutput `pulumi:"cidrBlock"`
    67  	// The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR. IPAM is a VPC feature that you can use to automate your IP address management workflows including assigning, tracking, troubleshooting, and auditing IP addresses across AWS Regions and accounts. Using IPAM you can monitor IP address usage throughout your AWS Organization.
    68  	Ipv4IpamPoolId pulumi.StringPtrOutput `pulumi:"ipv4IpamPoolId"`
    69  	// The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a `ipv4IpamPoolId`.
    70  	Ipv4NetmaskLength pulumi.IntPtrOutput `pulumi:"ipv4NetmaskLength"`
    71  	// The ID of the VPC to make the association with.
    72  	VpcId pulumi.StringOutput `pulumi:"vpcId"`
    73  }
    74  
    75  // NewVpcIpv4CidrBlockAssociation registers a new resource with the given unique name, arguments, and options.
    76  func NewVpcIpv4CidrBlockAssociation(ctx *pulumi.Context,
    77  	name string, args *VpcIpv4CidrBlockAssociationArgs, opts ...pulumi.ResourceOption) (*VpcIpv4CidrBlockAssociation, error) {
    78  	if args == nil {
    79  		return nil, errors.New("missing one or more required arguments")
    80  	}
    81  
    82  	if args.VpcId == nil {
    83  		return nil, errors.New("invalid value for required argument 'VpcId'")
    84  	}
    85  	opts = internal.PkgResourceDefaultOpts(opts)
    86  	var resource VpcIpv4CidrBlockAssociation
    87  	err := ctx.RegisterResource("aws:ec2/vpcIpv4CidrBlockAssociation:VpcIpv4CidrBlockAssociation", name, args, &resource, opts...)
    88  	if err != nil {
    89  		return nil, err
    90  	}
    91  	return &resource, nil
    92  }
    93  
    94  // GetVpcIpv4CidrBlockAssociation gets an existing VpcIpv4CidrBlockAssociation 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 GetVpcIpv4CidrBlockAssociation(ctx *pulumi.Context,
    97  	name string, id pulumi.IDInput, state *VpcIpv4CidrBlockAssociationState, opts ...pulumi.ResourceOption) (*VpcIpv4CidrBlockAssociation, error) {
    98  	var resource VpcIpv4CidrBlockAssociation
    99  	err := ctx.ReadResource("aws:ec2/vpcIpv4CidrBlockAssociation:VpcIpv4CidrBlockAssociation", 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 VpcIpv4CidrBlockAssociation resources.
   107  type vpcIpv4CidrBlockAssociationState struct {
   108  	// The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4NetmaskLength`.
   109  	CidrBlock *string `pulumi:"cidrBlock"`
   110  	// The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR. IPAM is a VPC feature that you can use to automate your IP address management workflows including assigning, tracking, troubleshooting, and auditing IP addresses across AWS Regions and accounts. Using IPAM you can monitor IP address usage throughout your AWS Organization.
   111  	Ipv4IpamPoolId *string `pulumi:"ipv4IpamPoolId"`
   112  	// The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a `ipv4IpamPoolId`.
   113  	Ipv4NetmaskLength *int `pulumi:"ipv4NetmaskLength"`
   114  	// The ID of the VPC to make the association with.
   115  	VpcId *string `pulumi:"vpcId"`
   116  }
   117  
   118  type VpcIpv4CidrBlockAssociationState struct {
   119  	// The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4NetmaskLength`.
   120  	CidrBlock pulumi.StringPtrInput
   121  	// The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR. IPAM is a VPC feature that you can use to automate your IP address management workflows including assigning, tracking, troubleshooting, and auditing IP addresses across AWS Regions and accounts. Using IPAM you can monitor IP address usage throughout your AWS Organization.
   122  	Ipv4IpamPoolId pulumi.StringPtrInput
   123  	// The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a `ipv4IpamPoolId`.
   124  	Ipv4NetmaskLength pulumi.IntPtrInput
   125  	// The ID of the VPC to make the association with.
   126  	VpcId pulumi.StringPtrInput
   127  }
   128  
   129  func (VpcIpv4CidrBlockAssociationState) ElementType() reflect.Type {
   130  	return reflect.TypeOf((*vpcIpv4CidrBlockAssociationState)(nil)).Elem()
   131  }
   132  
   133  type vpcIpv4CidrBlockAssociationArgs struct {
   134  	// The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4NetmaskLength`.
   135  	CidrBlock *string `pulumi:"cidrBlock"`
   136  	// The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR. IPAM is a VPC feature that you can use to automate your IP address management workflows including assigning, tracking, troubleshooting, and auditing IP addresses across AWS Regions and accounts. Using IPAM you can monitor IP address usage throughout your AWS Organization.
   137  	Ipv4IpamPoolId *string `pulumi:"ipv4IpamPoolId"`
   138  	// The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a `ipv4IpamPoolId`.
   139  	Ipv4NetmaskLength *int `pulumi:"ipv4NetmaskLength"`
   140  	// The ID of the VPC to make the association with.
   141  	VpcId string `pulumi:"vpcId"`
   142  }
   143  
   144  // The set of arguments for constructing a VpcIpv4CidrBlockAssociation resource.
   145  type VpcIpv4CidrBlockAssociationArgs struct {
   146  	// The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4NetmaskLength`.
   147  	CidrBlock pulumi.StringPtrInput
   148  	// The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR. IPAM is a VPC feature that you can use to automate your IP address management workflows including assigning, tracking, troubleshooting, and auditing IP addresses across AWS Regions and accounts. Using IPAM you can monitor IP address usage throughout your AWS Organization.
   149  	Ipv4IpamPoolId pulumi.StringPtrInput
   150  	// The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a `ipv4IpamPoolId`.
   151  	Ipv4NetmaskLength pulumi.IntPtrInput
   152  	// The ID of the VPC to make the association with.
   153  	VpcId pulumi.StringInput
   154  }
   155  
   156  func (VpcIpv4CidrBlockAssociationArgs) ElementType() reflect.Type {
   157  	return reflect.TypeOf((*vpcIpv4CidrBlockAssociationArgs)(nil)).Elem()
   158  }
   159  
   160  type VpcIpv4CidrBlockAssociationInput interface {
   161  	pulumi.Input
   162  
   163  	ToVpcIpv4CidrBlockAssociationOutput() VpcIpv4CidrBlockAssociationOutput
   164  	ToVpcIpv4CidrBlockAssociationOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationOutput
   165  }
   166  
   167  func (*VpcIpv4CidrBlockAssociation) ElementType() reflect.Type {
   168  	return reflect.TypeOf((**VpcIpv4CidrBlockAssociation)(nil)).Elem()
   169  }
   170  
   171  func (i *VpcIpv4CidrBlockAssociation) ToVpcIpv4CidrBlockAssociationOutput() VpcIpv4CidrBlockAssociationOutput {
   172  	return i.ToVpcIpv4CidrBlockAssociationOutputWithContext(context.Background())
   173  }
   174  
   175  func (i *VpcIpv4CidrBlockAssociation) ToVpcIpv4CidrBlockAssociationOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationOutput {
   176  	return pulumi.ToOutputWithContext(ctx, i).(VpcIpv4CidrBlockAssociationOutput)
   177  }
   178  
   179  // VpcIpv4CidrBlockAssociationArrayInput is an input type that accepts VpcIpv4CidrBlockAssociationArray and VpcIpv4CidrBlockAssociationArrayOutput values.
   180  // You can construct a concrete instance of `VpcIpv4CidrBlockAssociationArrayInput` via:
   181  //
   182  //	VpcIpv4CidrBlockAssociationArray{ VpcIpv4CidrBlockAssociationArgs{...} }
   183  type VpcIpv4CidrBlockAssociationArrayInput interface {
   184  	pulumi.Input
   185  
   186  	ToVpcIpv4CidrBlockAssociationArrayOutput() VpcIpv4CidrBlockAssociationArrayOutput
   187  	ToVpcIpv4CidrBlockAssociationArrayOutputWithContext(context.Context) VpcIpv4CidrBlockAssociationArrayOutput
   188  }
   189  
   190  type VpcIpv4CidrBlockAssociationArray []VpcIpv4CidrBlockAssociationInput
   191  
   192  func (VpcIpv4CidrBlockAssociationArray) ElementType() reflect.Type {
   193  	return reflect.TypeOf((*[]*VpcIpv4CidrBlockAssociation)(nil)).Elem()
   194  }
   195  
   196  func (i VpcIpv4CidrBlockAssociationArray) ToVpcIpv4CidrBlockAssociationArrayOutput() VpcIpv4CidrBlockAssociationArrayOutput {
   197  	return i.ToVpcIpv4CidrBlockAssociationArrayOutputWithContext(context.Background())
   198  }
   199  
   200  func (i VpcIpv4CidrBlockAssociationArray) ToVpcIpv4CidrBlockAssociationArrayOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationArrayOutput {
   201  	return pulumi.ToOutputWithContext(ctx, i).(VpcIpv4CidrBlockAssociationArrayOutput)
   202  }
   203  
   204  // VpcIpv4CidrBlockAssociationMapInput is an input type that accepts VpcIpv4CidrBlockAssociationMap and VpcIpv4CidrBlockAssociationMapOutput values.
   205  // You can construct a concrete instance of `VpcIpv4CidrBlockAssociationMapInput` via:
   206  //
   207  //	VpcIpv4CidrBlockAssociationMap{ "key": VpcIpv4CidrBlockAssociationArgs{...} }
   208  type VpcIpv4CidrBlockAssociationMapInput interface {
   209  	pulumi.Input
   210  
   211  	ToVpcIpv4CidrBlockAssociationMapOutput() VpcIpv4CidrBlockAssociationMapOutput
   212  	ToVpcIpv4CidrBlockAssociationMapOutputWithContext(context.Context) VpcIpv4CidrBlockAssociationMapOutput
   213  }
   214  
   215  type VpcIpv4CidrBlockAssociationMap map[string]VpcIpv4CidrBlockAssociationInput
   216  
   217  func (VpcIpv4CidrBlockAssociationMap) ElementType() reflect.Type {
   218  	return reflect.TypeOf((*map[string]*VpcIpv4CidrBlockAssociation)(nil)).Elem()
   219  }
   220  
   221  func (i VpcIpv4CidrBlockAssociationMap) ToVpcIpv4CidrBlockAssociationMapOutput() VpcIpv4CidrBlockAssociationMapOutput {
   222  	return i.ToVpcIpv4CidrBlockAssociationMapOutputWithContext(context.Background())
   223  }
   224  
   225  func (i VpcIpv4CidrBlockAssociationMap) ToVpcIpv4CidrBlockAssociationMapOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationMapOutput {
   226  	return pulumi.ToOutputWithContext(ctx, i).(VpcIpv4CidrBlockAssociationMapOutput)
   227  }
   228  
   229  type VpcIpv4CidrBlockAssociationOutput struct{ *pulumi.OutputState }
   230  
   231  func (VpcIpv4CidrBlockAssociationOutput) ElementType() reflect.Type {
   232  	return reflect.TypeOf((**VpcIpv4CidrBlockAssociation)(nil)).Elem()
   233  }
   234  
   235  func (o VpcIpv4CidrBlockAssociationOutput) ToVpcIpv4CidrBlockAssociationOutput() VpcIpv4CidrBlockAssociationOutput {
   236  	return o
   237  }
   238  
   239  func (o VpcIpv4CidrBlockAssociationOutput) ToVpcIpv4CidrBlockAssociationOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationOutput {
   240  	return o
   241  }
   242  
   243  // The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using `ipv4NetmaskLength`.
   244  func (o VpcIpv4CidrBlockAssociationOutput) CidrBlock() pulumi.StringOutput {
   245  	return o.ApplyT(func(v *VpcIpv4CidrBlockAssociation) pulumi.StringOutput { return v.CidrBlock }).(pulumi.StringOutput)
   246  }
   247  
   248  // The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR. IPAM is a VPC feature that you can use to automate your IP address management workflows including assigning, tracking, troubleshooting, and auditing IP addresses across AWS Regions and accounts. Using IPAM you can monitor IP address usage throughout your AWS Organization.
   249  func (o VpcIpv4CidrBlockAssociationOutput) Ipv4IpamPoolId() pulumi.StringPtrOutput {
   250  	return o.ApplyT(func(v *VpcIpv4CidrBlockAssociation) pulumi.StringPtrOutput { return v.Ipv4IpamPoolId }).(pulumi.StringPtrOutput)
   251  }
   252  
   253  // The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a `ipv4IpamPoolId`.
   254  func (o VpcIpv4CidrBlockAssociationOutput) Ipv4NetmaskLength() pulumi.IntPtrOutput {
   255  	return o.ApplyT(func(v *VpcIpv4CidrBlockAssociation) pulumi.IntPtrOutput { return v.Ipv4NetmaskLength }).(pulumi.IntPtrOutput)
   256  }
   257  
   258  // The ID of the VPC to make the association with.
   259  func (o VpcIpv4CidrBlockAssociationOutput) VpcId() pulumi.StringOutput {
   260  	return o.ApplyT(func(v *VpcIpv4CidrBlockAssociation) pulumi.StringOutput { return v.VpcId }).(pulumi.StringOutput)
   261  }
   262  
   263  type VpcIpv4CidrBlockAssociationArrayOutput struct{ *pulumi.OutputState }
   264  
   265  func (VpcIpv4CidrBlockAssociationArrayOutput) ElementType() reflect.Type {
   266  	return reflect.TypeOf((*[]*VpcIpv4CidrBlockAssociation)(nil)).Elem()
   267  }
   268  
   269  func (o VpcIpv4CidrBlockAssociationArrayOutput) ToVpcIpv4CidrBlockAssociationArrayOutput() VpcIpv4CidrBlockAssociationArrayOutput {
   270  	return o
   271  }
   272  
   273  func (o VpcIpv4CidrBlockAssociationArrayOutput) ToVpcIpv4CidrBlockAssociationArrayOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationArrayOutput {
   274  	return o
   275  }
   276  
   277  func (o VpcIpv4CidrBlockAssociationArrayOutput) Index(i pulumi.IntInput) VpcIpv4CidrBlockAssociationOutput {
   278  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VpcIpv4CidrBlockAssociation {
   279  		return vs[0].([]*VpcIpv4CidrBlockAssociation)[vs[1].(int)]
   280  	}).(VpcIpv4CidrBlockAssociationOutput)
   281  }
   282  
   283  type VpcIpv4CidrBlockAssociationMapOutput struct{ *pulumi.OutputState }
   284  
   285  func (VpcIpv4CidrBlockAssociationMapOutput) ElementType() reflect.Type {
   286  	return reflect.TypeOf((*map[string]*VpcIpv4CidrBlockAssociation)(nil)).Elem()
   287  }
   288  
   289  func (o VpcIpv4CidrBlockAssociationMapOutput) ToVpcIpv4CidrBlockAssociationMapOutput() VpcIpv4CidrBlockAssociationMapOutput {
   290  	return o
   291  }
   292  
   293  func (o VpcIpv4CidrBlockAssociationMapOutput) ToVpcIpv4CidrBlockAssociationMapOutputWithContext(ctx context.Context) VpcIpv4CidrBlockAssociationMapOutput {
   294  	return o
   295  }
   296  
   297  func (o VpcIpv4CidrBlockAssociationMapOutput) MapIndex(k pulumi.StringInput) VpcIpv4CidrBlockAssociationOutput {
   298  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VpcIpv4CidrBlockAssociation {
   299  		return vs[0].(map[string]*VpcIpv4CidrBlockAssociation)[vs[1].(string)]
   300  	}).(VpcIpv4CidrBlockAssociationOutput)
   301  }
   302  
   303  func init() {
   304  	pulumi.RegisterInputType(reflect.TypeOf((*VpcIpv4CidrBlockAssociationInput)(nil)).Elem(), &VpcIpv4CidrBlockAssociation{})
   305  	pulumi.RegisterInputType(reflect.TypeOf((*VpcIpv4CidrBlockAssociationArrayInput)(nil)).Elem(), VpcIpv4CidrBlockAssociationArray{})
   306  	pulumi.RegisterInputType(reflect.TypeOf((*VpcIpv4CidrBlockAssociationMapInput)(nil)).Elem(), VpcIpv4CidrBlockAssociationMap{})
   307  	pulumi.RegisterOutputType(VpcIpv4CidrBlockAssociationOutput{})
   308  	pulumi.RegisterOutputType(VpcIpv4CidrBlockAssociationArrayOutput{})
   309  	pulumi.RegisterOutputType(VpcIpv4CidrBlockAssociationMapOutput{})
   310  }