aws.ec2.VpcIpv4CidrBlockAssociation
Explore with Pulumi AI
Provides a resource to associate additional IPv4 CIDR blocks with a VPC.
When a VPC is created, a primary IPv4 CIDR block for the VPC must be specified.
The aws.ec2.VpcIpv4CidrBlockAssociation
resource allows further IPv4 CIDR blocks to be added to the VPC.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const main = new aws.ec2.Vpc("main", {cidrBlock: "10.0.0.0/16"});
const secondaryCidr = new aws.ec2.VpcIpv4CidrBlockAssociation("secondary_cidr", {
vpcId: main.id,
cidrBlock: "172.20.0.0/16",
});
import pulumi
import pulumi_aws as aws
main = aws.ec2.Vpc("main", cidr_block="10.0.0.0/16")
secondary_cidr = aws.ec2.VpcIpv4CidrBlockAssociation("secondary_cidr",
vpc_id=main.id,
cidr_block="172.20.0.0/16")
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
main, err := ec2.NewVpc(ctx, "main", &ec2.VpcArgs{
CidrBlock: pulumi.String("10.0.0.0/16"),
})
if err != nil {
return err
}
_, err = ec2.NewVpcIpv4CidrBlockAssociation(ctx, "secondary_cidr", &ec2.VpcIpv4CidrBlockAssociationArgs{
VpcId: main.ID(),
CidrBlock: pulumi.String("172.20.0.0/16"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var main = new Aws.Ec2.Vpc("main", new()
{
CidrBlock = "10.0.0.0/16",
});
var secondaryCidr = new Aws.Ec2.VpcIpv4CidrBlockAssociation("secondary_cidr", new()
{
VpcId = main.Id,
CidrBlock = "172.20.0.0/16",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Vpc;
import com.pulumi.aws.ec2.VpcArgs;
import com.pulumi.aws.ec2.VpcIpv4CidrBlockAssociation;
import com.pulumi.aws.ec2.VpcIpv4CidrBlockAssociationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var main = new Vpc("main", VpcArgs.builder()
.cidrBlock("10.0.0.0/16")
.build());
var secondaryCidr = new VpcIpv4CidrBlockAssociation("secondaryCidr", VpcIpv4CidrBlockAssociationArgs.builder()
.vpcId(main.id())
.cidrBlock("172.20.0.0/16")
.build());
}
}
resources:
main:
type: aws:ec2:Vpc
properties:
cidrBlock: 10.0.0.0/16
secondaryCidr:
type: aws:ec2:VpcIpv4CidrBlockAssociation
name: secondary_cidr
properties:
vpcId: ${main.id}
cidrBlock: 172.20.0.0/16
Create VpcIpv4CidrBlockAssociation Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new VpcIpv4CidrBlockAssociation(name: string, args: VpcIpv4CidrBlockAssociationArgs, opts?: CustomResourceOptions);
@overload
def VpcIpv4CidrBlockAssociation(resource_name: str,
args: VpcIpv4CidrBlockAssociationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def VpcIpv4CidrBlockAssociation(resource_name: str,
opts: Optional[ResourceOptions] = None,
vpc_id: Optional[str] = None,
cidr_block: Optional[str] = None,
ipv4_ipam_pool_id: Optional[str] = None,
ipv4_netmask_length: Optional[int] = None)
func NewVpcIpv4CidrBlockAssociation(ctx *Context, name string, args VpcIpv4CidrBlockAssociationArgs, opts ...ResourceOption) (*VpcIpv4CidrBlockAssociation, error)
public VpcIpv4CidrBlockAssociation(string name, VpcIpv4CidrBlockAssociationArgs args, CustomResourceOptions? opts = null)
public VpcIpv4CidrBlockAssociation(String name, VpcIpv4CidrBlockAssociationArgs args)
public VpcIpv4CidrBlockAssociation(String name, VpcIpv4CidrBlockAssociationArgs args, CustomResourceOptions options)
type: aws:ec2:VpcIpv4CidrBlockAssociation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args VpcIpv4CidrBlockAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args VpcIpv4CidrBlockAssociationArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args VpcIpv4CidrBlockAssociationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args VpcIpv4CidrBlockAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args VpcIpv4CidrBlockAssociationArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var vpcIpv4CidrBlockAssociationResource = new Aws.Ec2.VpcIpv4CidrBlockAssociation("vpcIpv4CidrBlockAssociationResource", new()
{
VpcId = "string",
CidrBlock = "string",
Ipv4IpamPoolId = "string",
Ipv4NetmaskLength = 0,
});
example, err := ec2.NewVpcIpv4CidrBlockAssociation(ctx, "vpcIpv4CidrBlockAssociationResource", &ec2.VpcIpv4CidrBlockAssociationArgs{
VpcId: pulumi.String("string"),
CidrBlock: pulumi.String("string"),
Ipv4IpamPoolId: pulumi.String("string"),
Ipv4NetmaskLength: pulumi.Int(0),
})
var vpcIpv4CidrBlockAssociationResource = new VpcIpv4CidrBlockAssociation("vpcIpv4CidrBlockAssociationResource", VpcIpv4CidrBlockAssociationArgs.builder()
.vpcId("string")
.cidrBlock("string")
.ipv4IpamPoolId("string")
.ipv4NetmaskLength(0)
.build());
vpc_ipv4_cidr_block_association_resource = aws.ec2.VpcIpv4CidrBlockAssociation("vpcIpv4CidrBlockAssociationResource",
vpc_id="string",
cidr_block="string",
ipv4_ipam_pool_id="string",
ipv4_netmask_length=0)
const vpcIpv4CidrBlockAssociationResource = new aws.ec2.VpcIpv4CidrBlockAssociation("vpcIpv4CidrBlockAssociationResource", {
vpcId: "string",
cidrBlock: "string",
ipv4IpamPoolId: "string",
ipv4NetmaskLength: 0,
});
type: aws:ec2:VpcIpv4CidrBlockAssociation
properties:
cidrBlock: string
ipv4IpamPoolId: string
ipv4NetmaskLength: 0
vpcId: string
VpcIpv4CidrBlockAssociation Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The VpcIpv4CidrBlockAssociation resource accepts the following input properties:
- Vpc
Id string - The ID of the VPC to make the association with.
- Cidr
Block string - The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using
ipv4_netmask_length
. - Ipv4Ipam
Pool stringId - 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.
- Ipv4Netmask
Length int - The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a
ipv4_ipam_pool_id
.
- Vpc
Id string - The ID of the VPC to make the association with.
- Cidr
Block string - The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using
ipv4_netmask_length
. - Ipv4Ipam
Pool stringId - 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.
- Ipv4Netmask
Length int - The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a
ipv4_ipam_pool_id
.
- vpc
Id String - The ID of the VPC to make the association with.
- cidr
Block String - The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using
ipv4_netmask_length
. - ipv4Ipam
Pool StringId - 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.
- ipv4Netmask
Length Integer - The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a
ipv4_ipam_pool_id
.
- vpc
Id string - The ID of the VPC to make the association with.
- cidr
Block string - The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using
ipv4_netmask_length
. - ipv4Ipam
Pool stringId - 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.
- ipv4Netmask
Length number - The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a
ipv4_ipam_pool_id
.
- vpc_
id str - The ID of the VPC to make the association with.
- cidr_
block str - The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using
ipv4_netmask_length
. - ipv4_
ipam_ strpool_ id - 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.
- ipv4_
netmask_ intlength - The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a
ipv4_ipam_pool_id
.
- vpc
Id String - The ID of the VPC to make the association with.
- cidr
Block String - The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using
ipv4_netmask_length
. - ipv4Ipam
Pool StringId - 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.
- ipv4Netmask
Length Number - The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a
ipv4_ipam_pool_id
.
Outputs
All input properties are implicitly available as output properties. Additionally, the VpcIpv4CidrBlockAssociation resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing VpcIpv4CidrBlockAssociation Resource
Get an existing VpcIpv4CidrBlockAssociation resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: VpcIpv4CidrBlockAssociationState, opts?: CustomResourceOptions): VpcIpv4CidrBlockAssociation
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
cidr_block: Optional[str] = None,
ipv4_ipam_pool_id: Optional[str] = None,
ipv4_netmask_length: Optional[int] = None,
vpc_id: Optional[str] = None) -> VpcIpv4CidrBlockAssociation
func GetVpcIpv4CidrBlockAssociation(ctx *Context, name string, id IDInput, state *VpcIpv4CidrBlockAssociationState, opts ...ResourceOption) (*VpcIpv4CidrBlockAssociation, error)
public static VpcIpv4CidrBlockAssociation Get(string name, Input<string> id, VpcIpv4CidrBlockAssociationState? state, CustomResourceOptions? opts = null)
public static VpcIpv4CidrBlockAssociation get(String name, Output<String> id, VpcIpv4CidrBlockAssociationState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Cidr
Block string - The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using
ipv4_netmask_length
. - Ipv4Ipam
Pool stringId - 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.
- Ipv4Netmask
Length int - The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a
ipv4_ipam_pool_id
. - Vpc
Id string - The ID of the VPC to make the association with.
- Cidr
Block string - The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using
ipv4_netmask_length
. - Ipv4Ipam
Pool stringId - 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.
- Ipv4Netmask
Length int - The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a
ipv4_ipam_pool_id
. - Vpc
Id string - The ID of the VPC to make the association with.
- cidr
Block String - The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using
ipv4_netmask_length
. - ipv4Ipam
Pool StringId - 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.
- ipv4Netmask
Length Integer - The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a
ipv4_ipam_pool_id
. - vpc
Id String - The ID of the VPC to make the association with.
- cidr
Block string - The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using
ipv4_netmask_length
. - ipv4Ipam
Pool stringId - 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.
- ipv4Netmask
Length number - The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a
ipv4_ipam_pool_id
. - vpc
Id string - The ID of the VPC to make the association with.
- cidr_
block str - The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using
ipv4_netmask_length
. - ipv4_
ipam_ strpool_ id - 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.
- ipv4_
netmask_ intlength - The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a
ipv4_ipam_pool_id
. - vpc_
id str - The ID of the VPC to make the association with.
- cidr
Block String - The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using
ipv4_netmask_length
. - ipv4Ipam
Pool StringId - 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.
- ipv4Netmask
Length Number - The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a
ipv4_ipam_pool_id
. - vpc
Id String - The ID of the VPC to make the association with.
Import
Using pulumi import
, import aws_vpc_ipv4_cidr_block_association
using the VPC CIDR Association ID. For example:
$ pulumi import aws:ec2/vpcIpv4CidrBlockAssociation:VpcIpv4CidrBlockAssociation example vpc-cidr-assoc-xxxxxxxx
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.