alicloud logo
Alibaba Cloud v3.34.0, Mar 17 23

alicloud.vpc.Ipv4CidrBlock

Provides a VPC Ipv4 Cidr Block resource.

For information about VPC Ipv4 Cidr Block and how to use it, see What is Ipv4 Cidr Block.

NOTE: Available in v1.185.0+.

Example Usage

Basic Usage

using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var @default = new AliCloud.Vpc.Network("default", new()
    {
        CidrBlock = "192.168.0.0/24",
        VpcName = @var.Name,
    });

    var example = new AliCloud.Vpc.Ipv4CidrBlock("example", new()
    {
        VpcId = @default.Id,
        SecondaryCidrBlock = "192.163.0.0/16",
    });

});
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
			CidrBlock: pulumi.String("192.168.0.0/24"),
			VpcName:   pulumi.Any(_var.Name),
		})
		if err != nil {
			return err
		}
		_, err = vpc.NewIpv4CidrBlock(ctx, "example", &vpc.Ipv4CidrBlockArgs{
			VpcId:              _default.ID(),
			SecondaryCidrBlock: pulumi.String("192.163.0.0/16"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Ipv4CidrBlock;
import com.pulumi.alicloud.vpc.Ipv4CidrBlockArgs;
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 default_ = new Network("default", NetworkArgs.builder()        
            .cidrBlock("192.168.0.0/24")
            .vpcName(var_.name())
            .build());

        var example = new Ipv4CidrBlock("example", Ipv4CidrBlockArgs.builder()        
            .vpcId(default_.id())
            .secondaryCidrBlock("192.163.0.0/16")
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

default = alicloud.vpc.Network("default",
    cidr_block="192.168.0.0/24",
    vpc_name=var["name"])
example = alicloud.vpc.Ipv4CidrBlock("example",
    vpc_id=default.id,
    secondary_cidr_block="192.163.0.0/16")
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const _default = new alicloud.vpc.Network("default", {
    cidrBlock: "192.168.0.0/24",
    vpcName: _var.name,
});
const example = new alicloud.vpc.Ipv4CidrBlock("example", {
    vpcId: _default.id,
    secondaryCidrBlock: "192.163.0.0/16",
});
resources:
  default:
    type: alicloud:vpc:Network
    properties:
      cidrBlock: 192.168.0.0/24
      vpcName: ${var.name}
  example:
    type: alicloud:vpc:Ipv4CidrBlock
    properties:
      vpcId: ${default.id}
      secondaryCidrBlock: 192.163.0.0/16

Create Ipv4CidrBlock Resource

new Ipv4CidrBlock(name: string, args: Ipv4CidrBlockArgs, opts?: CustomResourceOptions);
@overload
def Ipv4CidrBlock(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  secondary_cidr_block: Optional[str] = None,
                  vpc_id: Optional[str] = None)
@overload
def Ipv4CidrBlock(resource_name: str,
                  args: Ipv4CidrBlockArgs,
                  opts: Optional[ResourceOptions] = None)
func NewIpv4CidrBlock(ctx *Context, name string, args Ipv4CidrBlockArgs, opts ...ResourceOption) (*Ipv4CidrBlock, error)
public Ipv4CidrBlock(string name, Ipv4CidrBlockArgs args, CustomResourceOptions? opts = null)
public Ipv4CidrBlock(String name, Ipv4CidrBlockArgs args)
public Ipv4CidrBlock(String name, Ipv4CidrBlockArgs args, CustomResourceOptions options)
type: alicloud:vpc:Ipv4CidrBlock
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args Ipv4CidrBlockArgs
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 Ipv4CidrBlockArgs
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 Ipv4CidrBlockArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args Ipv4CidrBlockArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args Ipv4CidrBlockArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Ipv4CidrBlock Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Ipv4CidrBlock resource accepts the following input properties:

SecondaryCidrBlock string

The IPv4 CIDR block. Take note of the following requirements:

  • You can specify one of the following standard IPv4 CIDR blocks or their subnets as the secondary IPv4 CIDR block: 192.168.0.0/16, 172.16.0.0/12, and 10.0.0.0/8.
  • You can also use a custom CIDR block other than 100.64.0.0/10, 224.0.0.0/4, 127.0.0.0/8, 169.254.0.0/16, or their subnets as the secondary IPv4 CIDR block of the VPC.
  • The CIDR block cannot start with 0. The subnet mask must be 8 to 28 bits in length.
  • The secondary CIDR block cannot overlap with the primary CIDR block or an existing secondary CIDR block.
VpcId string

The ID of the VPC.

SecondaryCidrBlock string

The IPv4 CIDR block. Take note of the following requirements:

  • You can specify one of the following standard IPv4 CIDR blocks or their subnets as the secondary IPv4 CIDR block: 192.168.0.0/16, 172.16.0.0/12, and 10.0.0.0/8.
  • You can also use a custom CIDR block other than 100.64.0.0/10, 224.0.0.0/4, 127.0.0.0/8, 169.254.0.0/16, or their subnets as the secondary IPv4 CIDR block of the VPC.
  • The CIDR block cannot start with 0. The subnet mask must be 8 to 28 bits in length.
  • The secondary CIDR block cannot overlap with the primary CIDR block or an existing secondary CIDR block.
VpcId string

The ID of the VPC.

secondaryCidrBlock String

The IPv4 CIDR block. Take note of the following requirements:

  • You can specify one of the following standard IPv4 CIDR blocks or their subnets as the secondary IPv4 CIDR block: 192.168.0.0/16, 172.16.0.0/12, and 10.0.0.0/8.
  • You can also use a custom CIDR block other than 100.64.0.0/10, 224.0.0.0/4, 127.0.0.0/8, 169.254.0.0/16, or their subnets as the secondary IPv4 CIDR block of the VPC.
  • The CIDR block cannot start with 0. The subnet mask must be 8 to 28 bits in length.
  • The secondary CIDR block cannot overlap with the primary CIDR block or an existing secondary CIDR block.
vpcId String

The ID of the VPC.

secondaryCidrBlock string

The IPv4 CIDR block. Take note of the following requirements:

  • You can specify one of the following standard IPv4 CIDR blocks or their subnets as the secondary IPv4 CIDR block: 192.168.0.0/16, 172.16.0.0/12, and 10.0.0.0/8.
  • You can also use a custom CIDR block other than 100.64.0.0/10, 224.0.0.0/4, 127.0.0.0/8, 169.254.0.0/16, or their subnets as the secondary IPv4 CIDR block of the VPC.
  • The CIDR block cannot start with 0. The subnet mask must be 8 to 28 bits in length.
  • The secondary CIDR block cannot overlap with the primary CIDR block or an existing secondary CIDR block.
vpcId string

The ID of the VPC.

secondary_cidr_block str

The IPv4 CIDR block. Take note of the following requirements:

  • You can specify one of the following standard IPv4 CIDR blocks or their subnets as the secondary IPv4 CIDR block: 192.168.0.0/16, 172.16.0.0/12, and 10.0.0.0/8.
  • You can also use a custom CIDR block other than 100.64.0.0/10, 224.0.0.0/4, 127.0.0.0/8, 169.254.0.0/16, or their subnets as the secondary IPv4 CIDR block of the VPC.
  • The CIDR block cannot start with 0. The subnet mask must be 8 to 28 bits in length.
  • The secondary CIDR block cannot overlap with the primary CIDR block or an existing secondary CIDR block.
vpc_id str

The ID of the VPC.

secondaryCidrBlock String

The IPv4 CIDR block. Take note of the following requirements:

  • You can specify one of the following standard IPv4 CIDR blocks or their subnets as the secondary IPv4 CIDR block: 192.168.0.0/16, 172.16.0.0/12, and 10.0.0.0/8.
  • You can also use a custom CIDR block other than 100.64.0.0/10, 224.0.0.0/4, 127.0.0.0/8, 169.254.0.0/16, or their subnets as the secondary IPv4 CIDR block of the VPC.
  • The CIDR block cannot start with 0. The subnet mask must be 8 to 28 bits in length.
  • The secondary CIDR block cannot overlap with the primary CIDR block or an existing secondary CIDR block.
vpcId String

The ID of the VPC.

Outputs

All input properties are implicitly available as output properties. Additionally, the Ipv4CidrBlock 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 Ipv4CidrBlock Resource

Get an existing Ipv4CidrBlock 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?: Ipv4CidrBlockState, opts?: CustomResourceOptions): Ipv4CidrBlock
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        secondary_cidr_block: Optional[str] = None,
        vpc_id: Optional[str] = None) -> Ipv4CidrBlock
func GetIpv4CidrBlock(ctx *Context, name string, id IDInput, state *Ipv4CidrBlockState, opts ...ResourceOption) (*Ipv4CidrBlock, error)
public static Ipv4CidrBlock Get(string name, Input<string> id, Ipv4CidrBlockState? state, CustomResourceOptions? opts = null)
public static Ipv4CidrBlock get(String name, Output<String> id, Ipv4CidrBlockState 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.
The following state arguments are supported:
SecondaryCidrBlock string

The IPv4 CIDR block. Take note of the following requirements:

  • You can specify one of the following standard IPv4 CIDR blocks or their subnets as the secondary IPv4 CIDR block: 192.168.0.0/16, 172.16.0.0/12, and 10.0.0.0/8.
  • You can also use a custom CIDR block other than 100.64.0.0/10, 224.0.0.0/4, 127.0.0.0/8, 169.254.0.0/16, or their subnets as the secondary IPv4 CIDR block of the VPC.
  • The CIDR block cannot start with 0. The subnet mask must be 8 to 28 bits in length.
  • The secondary CIDR block cannot overlap with the primary CIDR block or an existing secondary CIDR block.
VpcId string

The ID of the VPC.

SecondaryCidrBlock string

The IPv4 CIDR block. Take note of the following requirements:

  • You can specify one of the following standard IPv4 CIDR blocks or their subnets as the secondary IPv4 CIDR block: 192.168.0.0/16, 172.16.0.0/12, and 10.0.0.0/8.
  • You can also use a custom CIDR block other than 100.64.0.0/10, 224.0.0.0/4, 127.0.0.0/8, 169.254.0.0/16, or their subnets as the secondary IPv4 CIDR block of the VPC.
  • The CIDR block cannot start with 0. The subnet mask must be 8 to 28 bits in length.
  • The secondary CIDR block cannot overlap with the primary CIDR block or an existing secondary CIDR block.
VpcId string

The ID of the VPC.

secondaryCidrBlock String

The IPv4 CIDR block. Take note of the following requirements:

  • You can specify one of the following standard IPv4 CIDR blocks or their subnets as the secondary IPv4 CIDR block: 192.168.0.0/16, 172.16.0.0/12, and 10.0.0.0/8.
  • You can also use a custom CIDR block other than 100.64.0.0/10, 224.0.0.0/4, 127.0.0.0/8, 169.254.0.0/16, or their subnets as the secondary IPv4 CIDR block of the VPC.
  • The CIDR block cannot start with 0. The subnet mask must be 8 to 28 bits in length.
  • The secondary CIDR block cannot overlap with the primary CIDR block or an existing secondary CIDR block.
vpcId String

The ID of the VPC.

secondaryCidrBlock string

The IPv4 CIDR block. Take note of the following requirements:

  • You can specify one of the following standard IPv4 CIDR blocks or their subnets as the secondary IPv4 CIDR block: 192.168.0.0/16, 172.16.0.0/12, and 10.0.0.0/8.
  • You can also use a custom CIDR block other than 100.64.0.0/10, 224.0.0.0/4, 127.0.0.0/8, 169.254.0.0/16, or their subnets as the secondary IPv4 CIDR block of the VPC.
  • The CIDR block cannot start with 0. The subnet mask must be 8 to 28 bits in length.
  • The secondary CIDR block cannot overlap with the primary CIDR block or an existing secondary CIDR block.
vpcId string

The ID of the VPC.

secondary_cidr_block str

The IPv4 CIDR block. Take note of the following requirements:

  • You can specify one of the following standard IPv4 CIDR blocks or their subnets as the secondary IPv4 CIDR block: 192.168.0.0/16, 172.16.0.0/12, and 10.0.0.0/8.
  • You can also use a custom CIDR block other than 100.64.0.0/10, 224.0.0.0/4, 127.0.0.0/8, 169.254.0.0/16, or their subnets as the secondary IPv4 CIDR block of the VPC.
  • The CIDR block cannot start with 0. The subnet mask must be 8 to 28 bits in length.
  • The secondary CIDR block cannot overlap with the primary CIDR block or an existing secondary CIDR block.
vpc_id str

The ID of the VPC.

secondaryCidrBlock String

The IPv4 CIDR block. Take note of the following requirements:

  • You can specify one of the following standard IPv4 CIDR blocks or their subnets as the secondary IPv4 CIDR block: 192.168.0.0/16, 172.16.0.0/12, and 10.0.0.0/8.
  • You can also use a custom CIDR block other than 100.64.0.0/10, 224.0.0.0/4, 127.0.0.0/8, 169.254.0.0/16, or their subnets as the secondary IPv4 CIDR block of the VPC.
  • The CIDR block cannot start with 0. The subnet mask must be 8 to 28 bits in length.
  • The secondary CIDR block cannot overlap with the primary CIDR block or an existing secondary CIDR block.
vpcId String

The ID of the VPC.

Import

VPC Ipv4 Cidr Block can be imported using the id, e.g.

 $ pulumi import alicloud:vpc/ipv4CidrBlock:Ipv4CidrBlock example <vpc_id>:<secondary_cidr_block>

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.