1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. vpc
  5. Ipv4CidrBlock
Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi

alicloud.vpc.Ipv4CidrBlock

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi

    Provides a VPC Ipv4 Cidr Block resource. VPC IPv4 additional network segment.

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

    NOTE: Available since v1.185.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const defaultvpc = new alicloud.vpc.Network("defaultvpc", {description: name});
    const _default = new alicloud.vpc.Ipv4CidrBlock("default", {
        secondaryCidrBlock: "192.168.0.0/16",
        vpcId: defaultvpc.id,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    defaultvpc = alicloud.vpc.Network("defaultvpc", description=name)
    default = alicloud.vpc.Ipv4CidrBlock("default",
        secondary_cidr_block="192.168.0.0/16",
        vpc_id=defaultvpc.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		defaultvpc, err := vpc.NewNetwork(ctx, "defaultvpc", &vpc.NetworkArgs{
    			Description: pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = vpc.NewIpv4CidrBlock(ctx, "default", &vpc.Ipv4CidrBlockArgs{
    			SecondaryCidrBlock: pulumi.String("192.168.0.0/16"),
    			VpcId:              defaultvpc.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var defaultvpc = new AliCloud.Vpc.Network("defaultvpc", new()
        {
            Description = name,
        });
    
        var @default = new AliCloud.Vpc.Ipv4CidrBlock("default", new()
        {
            SecondaryCidrBlock = "192.168.0.0/16",
            VpcId = defaultvpc.Id,
        });
    
    });
    
    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) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            var defaultvpc = new Network("defaultvpc", NetworkArgs.builder()        
                .description(name)
                .build());
    
            var default_ = new Ipv4CidrBlock("default", Ipv4CidrBlockArgs.builder()        
                .secondaryCidrBlock("192.168.0.0/16")
                .vpcId(defaultvpc.id())
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      defaultvpc:
        type: alicloud:vpc:Network
        properties:
          description: ${name}
      default:
        type: alicloud:vpc:Ipv4CidrBlock
        properties:
          secondaryCidrBlock: 192.168.0.0/16
          vpcId: ${defaultvpc.id}
    

    Create Ipv4CidrBlock Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Ipv4CidrBlock(name: string, args: Ipv4CidrBlockArgs, opts?: CustomResourceOptions);
    @overload
    def Ipv4CidrBlock(resource_name: str,
                      args: Ipv4CidrBlockArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def Ipv4CidrBlock(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      secondary_cidr_block: Optional[str] = None,
                      vpc_id: Optional[str] = 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.
    
    

    Parameters

    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.

    Example

    The following reference example uses placeholder values for all input properties.

    var ipv4CidrBlockResource = new AliCloud.Vpc.Ipv4CidrBlock("ipv4CidrBlockResource", new()
    {
        SecondaryCidrBlock = "string",
        VpcId = "string",
    });
    
    example, err := vpc.NewIpv4CidrBlock(ctx, "ipv4CidrBlockResource", &vpc.Ipv4CidrBlockArgs{
    	SecondaryCidrBlock: pulumi.String("string"),
    	VpcId:              pulumi.String("string"),
    })
    
    var ipv4CidrBlockResource = new Ipv4CidrBlock("ipv4CidrBlockResource", Ipv4CidrBlockArgs.builder()        
        .secondaryCidrBlock("string")
        .vpcId("string")
        .build());
    
    ipv4_cidr_block_resource = alicloud.vpc.Ipv4CidrBlock("ipv4CidrBlockResource",
        secondary_cidr_block="string",
        vpc_id="string")
    
    const ipv4CidrBlockResource = new alicloud.vpc.Ipv4CidrBlock("ipv4CidrBlockResource", {
        secondaryCidrBlock: "string",
        vpcId: "string",
    });
    
    type: alicloud:vpc:Ipv4CidrBlock
    properties:
        secondaryCidrBlock: string
        vpcId: string
    

    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>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi