1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. vpc
  5. Switch
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.vpc.Switch

Explore with Pulumi AI

Provides a VPC Vswitch resource. ## Module Support

You can use to the existing vpc module to create a VPC and several VSwitches one-click.

For information about VPC Vswitch and how to use it, see What is Vswitch.

NOTE: Available since v1.0.0.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const foo = alicloud.getZones({
    availableResourceCreation: "VSwitch",
});
const fooNetwork = new alicloud.vpc.Network("foo", {
    vpcName: "terraform-example",
    cidrBlock: "172.16.0.0/12",
});
const fooSwitch = new alicloud.vpc.Switch("foo", {
    vswitchName: "terraform-example",
    cidrBlock: "172.16.0.0/21",
    vpcId: fooNetwork.id,
    zoneId: foo.then(foo => foo.zones?.[0]?.id),
});
Copy
import pulumi
import pulumi_alicloud as alicloud

foo = alicloud.get_zones(available_resource_creation="VSwitch")
foo_network = alicloud.vpc.Network("foo",
    vpc_name="terraform-example",
    cidr_block="172.16.0.0/12")
foo_switch = alicloud.vpc.Switch("foo",
    vswitch_name="terraform-example",
    cidr_block="172.16.0.0/21",
    vpc_id=foo_network.id,
    zone_id=foo.zones[0].id)
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
	"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 {
		foo, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
			AvailableResourceCreation: pulumi.StringRef("VSwitch"),
		}, nil)
		if err != nil {
			return err
		}
		fooNetwork, err := vpc.NewNetwork(ctx, "foo", &vpc.NetworkArgs{
			VpcName:   pulumi.String("terraform-example"),
			CidrBlock: pulumi.String("172.16.0.0/12"),
		})
		if err != nil {
			return err
		}
		_, err = vpc.NewSwitch(ctx, "foo", &vpc.SwitchArgs{
			VswitchName: pulumi.String("terraform-example"),
			CidrBlock:   pulumi.String("172.16.0.0/21"),
			VpcId:       fooNetwork.ID(),
			ZoneId:      pulumi.String(foo.Zones[0].Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var foo = AliCloud.GetZones.Invoke(new()
    {
        AvailableResourceCreation = "VSwitch",
    });

    var fooNetwork = new AliCloud.Vpc.Network("foo", new()
    {
        VpcName = "terraform-example",
        CidrBlock = "172.16.0.0/12",
    });

    var fooSwitch = new AliCloud.Vpc.Switch("foo", new()
    {
        VswitchName = "terraform-example",
        CidrBlock = "172.16.0.0/21",
        VpcId = fooNetwork.Id,
        ZoneId = foo.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetZonesArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
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 foo = AlicloudFunctions.getZones(GetZonesArgs.builder()
            .availableResourceCreation("VSwitch")
            .build());

        var fooNetwork = new Network("fooNetwork", NetworkArgs.builder()
            .vpcName("terraform-example")
            .cidrBlock("172.16.0.0/12")
            .build());

        var fooSwitch = new Switch("fooSwitch", SwitchArgs.builder()
            .vswitchName("terraform-example")
            .cidrBlock("172.16.0.0/21")
            .vpcId(fooNetwork.id())
            .zoneId(foo.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
            .build());

    }
}
Copy
resources:
  fooNetwork:
    type: alicloud:vpc:Network
    name: foo
    properties:
      vpcName: terraform-example
      cidrBlock: 172.16.0.0/12
  fooSwitch:
    type: alicloud:vpc:Switch
    name: foo
    properties:
      vswitchName: terraform-example
      cidrBlock: 172.16.0.0/21
      vpcId: ${fooNetwork.id}
      zoneId: ${foo.zones[0].id}
variables:
  foo:
    fn::invoke:
      function: alicloud:getZones
      arguments:
        availableResourceCreation: VSwitch
Copy
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const foo = alicloud.getZones({
    availableResourceCreation: "VSwitch",
});
const vpc = new alicloud.vpc.Network("vpc", {
    vpcName: "terraform-example",
    cidrBlock: "172.16.0.0/12",
});
const cidrBlocks = new alicloud.vpc.Ipv4CidrBlock("cidr_blocks", {
    vpcId: vpc.id,
    secondaryCidrBlock: "192.163.0.0/16",
});
const island_nat = new alicloud.vpc.Switch("island-nat", {
    vpcId: cidrBlocks.vpcId,
    cidrBlock: "172.16.0.0/21",
    zoneId: foo.then(foo => foo.zones?.[0]?.id),
    vswitchName: "terraform-example",
    tags: {
        BuiltBy: "example_value",
        cnm_version: "example_value",
        Environment: "example_value",
        ManagedBy: "example_value",
    },
});
Copy
import pulumi
import pulumi_alicloud as alicloud

foo = alicloud.get_zones(available_resource_creation="VSwitch")
vpc = alicloud.vpc.Network("vpc",
    vpc_name="terraform-example",
    cidr_block="172.16.0.0/12")
cidr_blocks = alicloud.vpc.Ipv4CidrBlock("cidr_blocks",
    vpc_id=vpc.id,
    secondary_cidr_block="192.163.0.0/16")
island_nat = alicloud.vpc.Switch("island-nat",
    vpc_id=cidr_blocks.vpc_id,
    cidr_block="172.16.0.0/21",
    zone_id=foo.zones[0].id,
    vswitch_name="terraform-example",
    tags={
        "BuiltBy": "example_value",
        "cnm_version": "example_value",
        "Environment": "example_value",
        "ManagedBy": "example_value",
    })
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
	"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 {
		foo, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
			AvailableResourceCreation: pulumi.StringRef("VSwitch"),
		}, nil)
		if err != nil {
			return err
		}
		vpc, err := vpc.NewNetwork(ctx, "vpc", &vpc.NetworkArgs{
			VpcName:   pulumi.String("terraform-example"),
			CidrBlock: pulumi.String("172.16.0.0/12"),
		})
		if err != nil {
			return err
		}
		cidrBlocks, err := vpc.NewIpv4CidrBlock(ctx, "cidr_blocks", &vpc.Ipv4CidrBlockArgs{
			VpcId:              vpc.ID(),
			SecondaryCidrBlock: pulumi.String("192.163.0.0/16"),
		})
		if err != nil {
			return err
		}
		_, err = vpc.NewSwitch(ctx, "island-nat", &vpc.SwitchArgs{
			VpcId:       cidrBlocks.VpcId,
			CidrBlock:   pulumi.String("172.16.0.0/21"),
			ZoneId:      pulumi.String(foo.Zones[0].Id),
			VswitchName: pulumi.String("terraform-example"),
			Tags: pulumi.StringMap{
				"BuiltBy":     pulumi.String("example_value"),
				"cnm_version": pulumi.String("example_value"),
				"Environment": pulumi.String("example_value"),
				"ManagedBy":   pulumi.String("example_value"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var foo = AliCloud.GetZones.Invoke(new()
    {
        AvailableResourceCreation = "VSwitch",
    });

    var vpc = new AliCloud.Vpc.Network("vpc", new()
    {
        VpcName = "terraform-example",
        CidrBlock = "172.16.0.0/12",
    });

    var cidrBlocks = new AliCloud.Vpc.Ipv4CidrBlock("cidr_blocks", new()
    {
        VpcId = vpc.Id,
        SecondaryCidrBlock = "192.163.0.0/16",
    });

    var island_nat = new AliCloud.Vpc.Switch("island-nat", new()
    {
        VpcId = cidrBlocks.VpcId,
        CidrBlock = "172.16.0.0/21",
        ZoneId = foo.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
        VswitchName = "terraform-example",
        Tags = 
        {
            { "BuiltBy", "example_value" },
            { "cnm_version", "example_value" },
            { "Environment", "example_value" },
            { "ManagedBy", "example_value" },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetZonesArgs;
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 com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
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 foo = AlicloudFunctions.getZones(GetZonesArgs.builder()
            .availableResourceCreation("VSwitch")
            .build());

        var vpc = new Network("vpc", NetworkArgs.builder()
            .vpcName("terraform-example")
            .cidrBlock("172.16.0.0/12")
            .build());

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

        var island_nat = new Switch("island-nat", SwitchArgs.builder()
            .vpcId(cidrBlocks.vpcId())
            .cidrBlock("172.16.0.0/21")
            .zoneId(foo.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
            .vswitchName("terraform-example")
            .tags(Map.ofEntries(
                Map.entry("BuiltBy", "example_value"),
                Map.entry("cnm_version", "example_value"),
                Map.entry("Environment", "example_value"),
                Map.entry("ManagedBy", "example_value")
            ))
            .build());

    }
}
Copy
resources:
  vpc:
    type: alicloud:vpc:Network
    properties:
      vpcName: terraform-example
      cidrBlock: 172.16.0.0/12
  cidrBlocks:
    type: alicloud:vpc:Ipv4CidrBlock
    name: cidr_blocks
    properties:
      vpcId: ${vpc.id}
      secondaryCidrBlock: 192.163.0.0/16
  island-nat:
    type: alicloud:vpc:Switch
    properties:
      vpcId: ${cidrBlocks.vpcId}
      cidrBlock: 172.16.0.0/21
      zoneId: ${foo.zones[0].id}
      vswitchName: terraform-example
      tags:
        BuiltBy: example_value
        cnm_version: example_value
        Environment: example_value
        ManagedBy: example_value
variables:
  foo:
    fn::invoke:
      function: alicloud:getZones
      arguments:
        availableResourceCreation: VSwitch
Copy

Create a switch associated with the additional network segment

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const foo = alicloud.getZones({
    availableResourceCreation: "VSwitch",
});
const fooNetwork = new alicloud.vpc.Network("foo", {
    vpcName: "terraform-example",
    cidrBlock: "172.16.0.0/12",
});
const fooIpv4CidrBlock = new alicloud.vpc.Ipv4CidrBlock("foo", {
    vpcId: fooNetwork.id,
    secondaryCidrBlock: "192.163.0.0/16",
});
const fooSwitch = new alicloud.vpc.Switch("foo", {
    vpcId: fooIpv4CidrBlock.vpcId,
    cidrBlock: "192.163.0.0/24",
    zoneId: foo.then(foo => foo.zones?.[0]?.id),
});
Copy
import pulumi
import pulumi_alicloud as alicloud

foo = alicloud.get_zones(available_resource_creation="VSwitch")
foo_network = alicloud.vpc.Network("foo",
    vpc_name="terraform-example",
    cidr_block="172.16.0.0/12")
foo_ipv4_cidr_block = alicloud.vpc.Ipv4CidrBlock("foo",
    vpc_id=foo_network.id,
    secondary_cidr_block="192.163.0.0/16")
foo_switch = alicloud.vpc.Switch("foo",
    vpc_id=foo_ipv4_cidr_block.vpc_id,
    cidr_block="192.163.0.0/24",
    zone_id=foo.zones[0].id)
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
	"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 {
		foo, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
			AvailableResourceCreation: pulumi.StringRef("VSwitch"),
		}, nil)
		if err != nil {
			return err
		}
		fooNetwork, err := vpc.NewNetwork(ctx, "foo", &vpc.NetworkArgs{
			VpcName:   pulumi.String("terraform-example"),
			CidrBlock: pulumi.String("172.16.0.0/12"),
		})
		if err != nil {
			return err
		}
		fooIpv4CidrBlock, err := vpc.NewIpv4CidrBlock(ctx, "foo", &vpc.Ipv4CidrBlockArgs{
			VpcId:              fooNetwork.ID(),
			SecondaryCidrBlock: pulumi.String("192.163.0.0/16"),
		})
		if err != nil {
			return err
		}
		_, err = vpc.NewSwitch(ctx, "foo", &vpc.SwitchArgs{
			VpcId:     fooIpv4CidrBlock.VpcId,
			CidrBlock: pulumi.String("192.163.0.0/24"),
			ZoneId:    pulumi.String(foo.Zones[0].Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var foo = AliCloud.GetZones.Invoke(new()
    {
        AvailableResourceCreation = "VSwitch",
    });

    var fooNetwork = new AliCloud.Vpc.Network("foo", new()
    {
        VpcName = "terraform-example",
        CidrBlock = "172.16.0.0/12",
    });

    var fooIpv4CidrBlock = new AliCloud.Vpc.Ipv4CidrBlock("foo", new()
    {
        VpcId = fooNetwork.Id,
        SecondaryCidrBlock = "192.163.0.0/16",
    });

    var fooSwitch = new AliCloud.Vpc.Switch("foo", new()
    {
        VpcId = fooIpv4CidrBlock.VpcId,
        CidrBlock = "192.163.0.0/24",
        ZoneId = foo.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetZonesArgs;
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 com.pulumi.alicloud.vpc.Switch;
import com.pulumi.alicloud.vpc.SwitchArgs;
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 foo = AlicloudFunctions.getZones(GetZonesArgs.builder()
            .availableResourceCreation("VSwitch")
            .build());

        var fooNetwork = new Network("fooNetwork", NetworkArgs.builder()
            .vpcName("terraform-example")
            .cidrBlock("172.16.0.0/12")
            .build());

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

        var fooSwitch = new Switch("fooSwitch", SwitchArgs.builder()
            .vpcId(fooIpv4CidrBlock.vpcId())
            .cidrBlock("192.163.0.0/24")
            .zoneId(foo.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
            .build());

    }
}
Copy
resources:
  fooNetwork:
    type: alicloud:vpc:Network
    name: foo
    properties:
      vpcName: terraform-example
      cidrBlock: 172.16.0.0/12
  fooIpv4CidrBlock:
    type: alicloud:vpc:Ipv4CidrBlock
    name: foo
    properties:
      vpcId: ${fooNetwork.id}
      secondaryCidrBlock: 192.163.0.0/16
  fooSwitch:
    type: alicloud:vpc:Switch
    name: foo
    properties:
      vpcId: ${fooIpv4CidrBlock.vpcId}
      cidrBlock: 192.163.0.0/24
      zoneId: ${foo.zones[0].id}
variables:
  foo:
    fn::invoke:
      function: alicloud:getZones
      arguments:
        availableResourceCreation: VSwitch
Copy

Create Switch Resource

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

Constructor syntax

new Switch(name: string, args?: SwitchArgs, opts?: CustomResourceOptions);
@overload
def Switch(resource_name: str,
           args: Optional[SwitchArgs] = None,
           opts: Optional[ResourceOptions] = None)

@overload
def Switch(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           availability_zone: Optional[str] = None,
           cidr_block: Optional[str] = None,
           description: Optional[str] = None,
           enable_ipv6: Optional[bool] = None,
           ipv6_cidr_block_mask: Optional[int] = None,
           is_default: Optional[bool] = None,
           name: Optional[str] = None,
           tags: Optional[Mapping[str, str]] = None,
           vpc_id: Optional[str] = None,
           vswitch_name: Optional[str] = None,
           zone_id: Optional[str] = None)
func NewSwitch(ctx *Context, name string, args *SwitchArgs, opts ...ResourceOption) (*Switch, error)
public Switch(string name, SwitchArgs? args = null, CustomResourceOptions? opts = null)
public Switch(String name, SwitchArgs args)
public Switch(String name, SwitchArgs args, CustomResourceOptions options)
type: alicloud:vpc:Switch
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args SwitchArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args SwitchArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args SwitchArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args SwitchArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. SwitchArgs
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 switchResource = new AliCloud.Vpc.Switch("switchResource", new()
{
    CidrBlock = "string",
    Description = "string",
    EnableIpv6 = false,
    Ipv6CidrBlockMask = 0,
    IsDefault = false,
    Tags = 
    {
        { "string", "string" },
    },
    VpcId = "string",
    VswitchName = "string",
    ZoneId = "string",
});
Copy
example, err := vpc.NewSwitch(ctx, "switchResource", &vpc.SwitchArgs{
	CidrBlock:         pulumi.String("string"),
	Description:       pulumi.String("string"),
	EnableIpv6:        pulumi.Bool(false),
	Ipv6CidrBlockMask: pulumi.Int(0),
	IsDefault:         pulumi.Bool(false),
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	VpcId:       pulumi.String("string"),
	VswitchName: pulumi.String("string"),
	ZoneId:      pulumi.String("string"),
})
Copy
var switchResource = new Switch("switchResource", SwitchArgs.builder()
    .cidrBlock("string")
    .description("string")
    .enableIpv6(false)
    .ipv6CidrBlockMask(0)
    .isDefault(false)
    .tags(Map.of("string", "string"))
    .vpcId("string")
    .vswitchName("string")
    .zoneId("string")
    .build());
Copy
switch_resource = alicloud.vpc.Switch("switchResource",
    cidr_block="string",
    description="string",
    enable_ipv6=False,
    ipv6_cidr_block_mask=0,
    is_default=False,
    tags={
        "string": "string",
    },
    vpc_id="string",
    vswitch_name="string",
    zone_id="string")
Copy
const switchResource = new alicloud.vpc.Switch("switchResource", {
    cidrBlock: "string",
    description: "string",
    enableIpv6: false,
    ipv6CidrBlockMask: 0,
    isDefault: false,
    tags: {
        string: "string",
    },
    vpcId: "string",
    vswitchName: "string",
    zoneId: "string",
});
Copy
type: alicloud:vpc:Switch
properties:
    cidrBlock: string
    description: string
    enableIpv6: false
    ipv6CidrBlockMask: 0
    isDefault: false
    tags:
        string: string
    vpcId: string
    vswitchName: string
    zoneId: string
Copy

Switch 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 Switch resource accepts the following input properties:

AvailabilityZone Changes to this property will trigger replacement. string
Field availability_zone has been deprecated from provider version 1.119.0. New field zone_id instead.

Deprecated: Field 'availability_zone' has been deprecated from provider version 1.119.0. New field 'zone_id' instead.

CidrBlock Changes to this property will trigger replacement. string
The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, cidr_block is required.
Description string
The description of VSwitch.
EnableIpv6 bool
Whether the IPv6 function is enabled in the switch. Value:
Ipv6CidrBlockMask int
The IPv6 CIDR block of the VSwitch.
IsDefault bool
Specifies whether to create the default VSwitch. Default value: false. Valid values:
Name string
Field name has been deprecated from provider version 1.119.0. New field vswitch_name instead.

Deprecated: Field 'name' has been deprecated from provider version 1.119.0. New field 'vswitch_name' instead.

Tags Dictionary<string, string>
The tags of VSwitch.
VpcId Changes to this property will trigger replacement. string
The VPC ID. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, vpc_id is required.
VswitchName string
The name of the VSwitch.
ZoneId Changes to this property will trigger replacement. string
The AZ for the VSwitch. Note: Required for a VPC VSwitch.
AvailabilityZone Changes to this property will trigger replacement. string
Field availability_zone has been deprecated from provider version 1.119.0. New field zone_id instead.

Deprecated: Field 'availability_zone' has been deprecated from provider version 1.119.0. New field 'zone_id' instead.

CidrBlock Changes to this property will trigger replacement. string
The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, cidr_block is required.
Description string
The description of VSwitch.
EnableIpv6 bool
Whether the IPv6 function is enabled in the switch. Value:
Ipv6CidrBlockMask int
The IPv6 CIDR block of the VSwitch.
IsDefault bool
Specifies whether to create the default VSwitch. Default value: false. Valid values:
Name string
Field name has been deprecated from provider version 1.119.0. New field vswitch_name instead.

Deprecated: Field 'name' has been deprecated from provider version 1.119.0. New field 'vswitch_name' instead.

Tags map[string]string
The tags of VSwitch.
VpcId Changes to this property will trigger replacement. string
The VPC ID. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, vpc_id is required.
VswitchName string
The name of the VSwitch.
ZoneId Changes to this property will trigger replacement. string
The AZ for the VSwitch. Note: Required for a VPC VSwitch.
availabilityZone Changes to this property will trigger replacement. String
Field availability_zone has been deprecated from provider version 1.119.0. New field zone_id instead.

Deprecated: Field 'availability_zone' has been deprecated from provider version 1.119.0. New field 'zone_id' instead.

cidrBlock Changes to this property will trigger replacement. String
The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, cidr_block is required.
description String
The description of VSwitch.
enableIpv6 Boolean
Whether the IPv6 function is enabled in the switch. Value:
ipv6CidrBlockMask Integer
The IPv6 CIDR block of the VSwitch.
isDefault Boolean
Specifies whether to create the default VSwitch. Default value: false. Valid values:
name String
Field name has been deprecated from provider version 1.119.0. New field vswitch_name instead.

Deprecated: Field 'name' has been deprecated from provider version 1.119.0. New field 'vswitch_name' instead.

tags Map<String,String>
The tags of VSwitch.
vpcId Changes to this property will trigger replacement. String
The VPC ID. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, vpc_id is required.
vswitchName String
The name of the VSwitch.
zoneId Changes to this property will trigger replacement. String
The AZ for the VSwitch. Note: Required for a VPC VSwitch.
availabilityZone Changes to this property will trigger replacement. string
Field availability_zone has been deprecated from provider version 1.119.0. New field zone_id instead.

Deprecated: Field 'availability_zone' has been deprecated from provider version 1.119.0. New field 'zone_id' instead.

cidrBlock Changes to this property will trigger replacement. string
The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, cidr_block is required.
description string
The description of VSwitch.
enableIpv6 boolean
Whether the IPv6 function is enabled in the switch. Value:
ipv6CidrBlockMask number
The IPv6 CIDR block of the VSwitch.
isDefault boolean
Specifies whether to create the default VSwitch. Default value: false. Valid values:
name string
Field name has been deprecated from provider version 1.119.0. New field vswitch_name instead.

Deprecated: Field 'name' has been deprecated from provider version 1.119.0. New field 'vswitch_name' instead.

tags {[key: string]: string}
The tags of VSwitch.
vpcId Changes to this property will trigger replacement. string
The VPC ID. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, vpc_id is required.
vswitchName string
The name of the VSwitch.
zoneId Changes to this property will trigger replacement. string
The AZ for the VSwitch. Note: Required for a VPC VSwitch.
availability_zone Changes to this property will trigger replacement. str
Field availability_zone has been deprecated from provider version 1.119.0. New field zone_id instead.

Deprecated: Field 'availability_zone' has been deprecated from provider version 1.119.0. New field 'zone_id' instead.

cidr_block Changes to this property will trigger replacement. str
The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, cidr_block is required.
description str
The description of VSwitch.
enable_ipv6 bool
Whether the IPv6 function is enabled in the switch. Value:
ipv6_cidr_block_mask int
The IPv6 CIDR block of the VSwitch.
is_default bool
Specifies whether to create the default VSwitch. Default value: false. Valid values:
name str
Field name has been deprecated from provider version 1.119.0. New field vswitch_name instead.

Deprecated: Field 'name' has been deprecated from provider version 1.119.0. New field 'vswitch_name' instead.

tags Mapping[str, str]
The tags of VSwitch.
vpc_id Changes to this property will trigger replacement. str
The VPC ID. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, vpc_id is required.
vswitch_name str
The name of the VSwitch.
zone_id Changes to this property will trigger replacement. str
The AZ for the VSwitch. Note: Required for a VPC VSwitch.
availabilityZone Changes to this property will trigger replacement. String
Field availability_zone has been deprecated from provider version 1.119.0. New field zone_id instead.

Deprecated: Field 'availability_zone' has been deprecated from provider version 1.119.0. New field 'zone_id' instead.

cidrBlock Changes to this property will trigger replacement. String
The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, cidr_block is required.
description String
The description of VSwitch.
enableIpv6 Boolean
Whether the IPv6 function is enabled in the switch. Value:
ipv6CidrBlockMask Number
The IPv6 CIDR block of the VSwitch.
isDefault Boolean
Specifies whether to create the default VSwitch. Default value: false. Valid values:
name String
Field name has been deprecated from provider version 1.119.0. New field vswitch_name instead.

Deprecated: Field 'name' has been deprecated from provider version 1.119.0. New field 'vswitch_name' instead.

tags Map<String>
The tags of VSwitch.
vpcId Changes to this property will trigger replacement. String
The VPC ID. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, vpc_id is required.
vswitchName String
The name of the VSwitch.
zoneId Changes to this property will trigger replacement. String
The AZ for the VSwitch. Note: Required for a VPC VSwitch.

Outputs

All input properties are implicitly available as output properties. Additionally, the Switch resource produces the following output properties:

CreateTime string
The creation time of the VSwitch.
Id string
The provider-assigned unique ID for this managed resource.
Ipv6CidrBlock string
The IPv6 CIDR block of the VSwitch.
Status string
The status of the resource.
CreateTime string
The creation time of the VSwitch.
Id string
The provider-assigned unique ID for this managed resource.
Ipv6CidrBlock string
The IPv6 CIDR block of the VSwitch.
Status string
The status of the resource.
createTime String
The creation time of the VSwitch.
id String
The provider-assigned unique ID for this managed resource.
ipv6CidrBlock String
The IPv6 CIDR block of the VSwitch.
status String
The status of the resource.
createTime string
The creation time of the VSwitch.
id string
The provider-assigned unique ID for this managed resource.
ipv6CidrBlock string
The IPv6 CIDR block of the VSwitch.
status string
The status of the resource.
create_time str
The creation time of the VSwitch.
id str
The provider-assigned unique ID for this managed resource.
ipv6_cidr_block str
The IPv6 CIDR block of the VSwitch.
status str
The status of the resource.
createTime String
The creation time of the VSwitch.
id String
The provider-assigned unique ID for this managed resource.
ipv6CidrBlock String
The IPv6 CIDR block of the VSwitch.
status String
The status of the resource.

Look up Existing Switch Resource

Get an existing Switch 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?: SwitchState, opts?: CustomResourceOptions): Switch
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        availability_zone: Optional[str] = None,
        cidr_block: Optional[str] = None,
        create_time: Optional[str] = None,
        description: Optional[str] = None,
        enable_ipv6: Optional[bool] = None,
        ipv6_cidr_block: Optional[str] = None,
        ipv6_cidr_block_mask: Optional[int] = None,
        is_default: Optional[bool] = None,
        name: Optional[str] = None,
        status: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        vpc_id: Optional[str] = None,
        vswitch_name: Optional[str] = None,
        zone_id: Optional[str] = None) -> Switch
func GetSwitch(ctx *Context, name string, id IDInput, state *SwitchState, opts ...ResourceOption) (*Switch, error)
public static Switch Get(string name, Input<string> id, SwitchState? state, CustomResourceOptions? opts = null)
public static Switch get(String name, Output<String> id, SwitchState state, CustomResourceOptions options)
resources:  _:    type: alicloud:vpc:Switch    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
AvailabilityZone Changes to this property will trigger replacement. string
Field availability_zone has been deprecated from provider version 1.119.0. New field zone_id instead.

Deprecated: Field 'availability_zone' has been deprecated from provider version 1.119.0. New field 'zone_id' instead.

CidrBlock Changes to this property will trigger replacement. string
The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, cidr_block is required.
CreateTime string
The creation time of the VSwitch.
Description string
The description of VSwitch.
EnableIpv6 bool
Whether the IPv6 function is enabled in the switch. Value:
Ipv6CidrBlock string
The IPv6 CIDR block of the VSwitch.
Ipv6CidrBlockMask int
The IPv6 CIDR block of the VSwitch.
IsDefault bool
Specifies whether to create the default VSwitch. Default value: false. Valid values:
Name string
Field name has been deprecated from provider version 1.119.0. New field vswitch_name instead.

Deprecated: Field 'name' has been deprecated from provider version 1.119.0. New field 'vswitch_name' instead.

Status string
The status of the resource.
Tags Dictionary<string, string>
The tags of VSwitch.
VpcId Changes to this property will trigger replacement. string
The VPC ID. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, vpc_id is required.
VswitchName string
The name of the VSwitch.
ZoneId Changes to this property will trigger replacement. string
The AZ for the VSwitch. Note: Required for a VPC VSwitch.
AvailabilityZone Changes to this property will trigger replacement. string
Field availability_zone has been deprecated from provider version 1.119.0. New field zone_id instead.

Deprecated: Field 'availability_zone' has been deprecated from provider version 1.119.0. New field 'zone_id' instead.

CidrBlock Changes to this property will trigger replacement. string
The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, cidr_block is required.
CreateTime string
The creation time of the VSwitch.
Description string
The description of VSwitch.
EnableIpv6 bool
Whether the IPv6 function is enabled in the switch. Value:
Ipv6CidrBlock string
The IPv6 CIDR block of the VSwitch.
Ipv6CidrBlockMask int
The IPv6 CIDR block of the VSwitch.
IsDefault bool
Specifies whether to create the default VSwitch. Default value: false. Valid values:
Name string
Field name has been deprecated from provider version 1.119.0. New field vswitch_name instead.

Deprecated: Field 'name' has been deprecated from provider version 1.119.0. New field 'vswitch_name' instead.

Status string
The status of the resource.
Tags map[string]string
The tags of VSwitch.
VpcId Changes to this property will trigger replacement. string
The VPC ID. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, vpc_id is required.
VswitchName string
The name of the VSwitch.
ZoneId Changes to this property will trigger replacement. string
The AZ for the VSwitch. Note: Required for a VPC VSwitch.
availabilityZone Changes to this property will trigger replacement. String
Field availability_zone has been deprecated from provider version 1.119.0. New field zone_id instead.

Deprecated: Field 'availability_zone' has been deprecated from provider version 1.119.0. New field 'zone_id' instead.

cidrBlock Changes to this property will trigger replacement. String
The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, cidr_block is required.
createTime String
The creation time of the VSwitch.
description String
The description of VSwitch.
enableIpv6 Boolean
Whether the IPv6 function is enabled in the switch. Value:
ipv6CidrBlock String
The IPv6 CIDR block of the VSwitch.
ipv6CidrBlockMask Integer
The IPv6 CIDR block of the VSwitch.
isDefault Boolean
Specifies whether to create the default VSwitch. Default value: false. Valid values:
name String
Field name has been deprecated from provider version 1.119.0. New field vswitch_name instead.

Deprecated: Field 'name' has been deprecated from provider version 1.119.0. New field 'vswitch_name' instead.

status String
The status of the resource.
tags Map<String,String>
The tags of VSwitch.
vpcId Changes to this property will trigger replacement. String
The VPC ID. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, vpc_id is required.
vswitchName String
The name of the VSwitch.
zoneId Changes to this property will trigger replacement. String
The AZ for the VSwitch. Note: Required for a VPC VSwitch.
availabilityZone Changes to this property will trigger replacement. string
Field availability_zone has been deprecated from provider version 1.119.0. New field zone_id instead.

Deprecated: Field 'availability_zone' has been deprecated from provider version 1.119.0. New field 'zone_id' instead.

cidrBlock Changes to this property will trigger replacement. string
The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, cidr_block is required.
createTime string
The creation time of the VSwitch.
description string
The description of VSwitch.
enableIpv6 boolean
Whether the IPv6 function is enabled in the switch. Value:
ipv6CidrBlock string
The IPv6 CIDR block of the VSwitch.
ipv6CidrBlockMask number
The IPv6 CIDR block of the VSwitch.
isDefault boolean
Specifies whether to create the default VSwitch. Default value: false. Valid values:
name string
Field name has been deprecated from provider version 1.119.0. New field vswitch_name instead.

Deprecated: Field 'name' has been deprecated from provider version 1.119.0. New field 'vswitch_name' instead.

status string
The status of the resource.
tags {[key: string]: string}
The tags of VSwitch.
vpcId Changes to this property will trigger replacement. string
The VPC ID. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, vpc_id is required.
vswitchName string
The name of the VSwitch.
zoneId Changes to this property will trigger replacement. string
The AZ for the VSwitch. Note: Required for a VPC VSwitch.
availability_zone Changes to this property will trigger replacement. str
Field availability_zone has been deprecated from provider version 1.119.0. New field zone_id instead.

Deprecated: Field 'availability_zone' has been deprecated from provider version 1.119.0. New field 'zone_id' instead.

cidr_block Changes to this property will trigger replacement. str
The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, cidr_block is required.
create_time str
The creation time of the VSwitch.
description str
The description of VSwitch.
enable_ipv6 bool
Whether the IPv6 function is enabled in the switch. Value:
ipv6_cidr_block str
The IPv6 CIDR block of the VSwitch.
ipv6_cidr_block_mask int
The IPv6 CIDR block of the VSwitch.
is_default bool
Specifies whether to create the default VSwitch. Default value: false. Valid values:
name str
Field name has been deprecated from provider version 1.119.0. New field vswitch_name instead.

Deprecated: Field 'name' has been deprecated from provider version 1.119.0. New field 'vswitch_name' instead.

status str
The status of the resource.
tags Mapping[str, str]
The tags of VSwitch.
vpc_id Changes to this property will trigger replacement. str
The VPC ID. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, vpc_id is required.
vswitch_name str
The name of the VSwitch.
zone_id Changes to this property will trigger replacement. str
The AZ for the VSwitch. Note: Required for a VPC VSwitch.
availabilityZone Changes to this property will trigger replacement. String
Field availability_zone has been deprecated from provider version 1.119.0. New field zone_id instead.

Deprecated: Field 'availability_zone' has been deprecated from provider version 1.119.0. New field 'zone_id' instead.

cidrBlock Changes to this property will trigger replacement. String
The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, cidr_block is required.
createTime String
The creation time of the VSwitch.
description String
The description of VSwitch.
enableIpv6 Boolean
Whether the IPv6 function is enabled in the switch. Value:
ipv6CidrBlock String
The IPv6 CIDR block of the VSwitch.
ipv6CidrBlockMask Number
The IPv6 CIDR block of the VSwitch.
isDefault Boolean
Specifies whether to create the default VSwitch. Default value: false. Valid values:
name String
Field name has been deprecated from provider version 1.119.0. New field vswitch_name instead.

Deprecated: Field 'name' has been deprecated from provider version 1.119.0. New field 'vswitch_name' instead.

status String
The status of the resource.
tags Map<String>
The tags of VSwitch.
vpcId Changes to this property will trigger replacement. String
The VPC ID. NOTE: From version 1.233.0, if you do not set is_default, or set is_default to false, vpc_id is required.
vswitchName String
The name of the VSwitch.
zoneId Changes to this property will trigger replacement. String
The AZ for the VSwitch. Note: Required for a VPC VSwitch.

Import

VPC Vswitch can be imported using the id, e.g.

$ pulumi import alicloud:vpc/switch:Switch example <id>
Copy

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.