1. Packages
  2. Alicloud Provider
  3. API Docs
  4. vpc
  5. Switch
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

alicloud.vpc.Switch

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

    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),
    });
    
    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)
    
    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
    	})
    }
    
    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),
        });
    
    });
    
    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());
    
        }
    }
    
    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
    
    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",
        },
    });
    
    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",
        })
    
    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
    	})
    }
    
    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" },
            },
        });
    
    });
    
    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());
    
        }
    }
    
    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
    

    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),
    });
    
    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)
    
    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
    	})
    }
    
    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),
        });
    
    });
    
    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());
    
        }
    }
    
    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
    

    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: SwitchArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Switch(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               cidr_block: Optional[str] = None,
               vpc_id: Optional[str] = None,
               availability_zone: Optional[str] = None,
               description: Optional[str] = None,
               enable_ipv6: Optional[bool] = None,
               ipv6_cidr_block_mask: Optional[int] = None,
               name: Optional[str] = None,
               tags: Optional[Mapping[str, 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, 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 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 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 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 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 String
    The unique name of the resource.
    args 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",
        VpcId = "string",
        Description = "string",
        EnableIpv6 = false,
        Ipv6CidrBlockMask = 0,
        Tags = 
        {
            { "string", "string" },
        },
        VswitchName = "string",
        ZoneId = "string",
    });
    
    example, err := vpc.NewSwitch(ctx, "switchResource", &vpc.SwitchArgs{
    	CidrBlock:         pulumi.String("string"),
    	VpcId:             pulumi.String("string"),
    	Description:       pulumi.String("string"),
    	EnableIpv6:        pulumi.Bool(false),
    	Ipv6CidrBlockMask: pulumi.Int(0),
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	VswitchName: pulumi.String("string"),
    	ZoneId:      pulumi.String("string"),
    })
    
    var switchResource = new Switch("switchResource", SwitchArgs.builder()
        .cidrBlock("string")
        .vpcId("string")
        .description("string")
        .enableIpv6(false)
        .ipv6CidrBlockMask(0)
        .tags(Map.of("string", "string"))
        .vswitchName("string")
        .zoneId("string")
        .build());
    
    switch_resource = alicloud.vpc.Switch("switchResource",
        cidr_block="string",
        vpc_id="string",
        description="string",
        enable_ipv6=False,
        ipv6_cidr_block_mask=0,
        tags={
            "string": "string",
        },
        vswitch_name="string",
        zone_id="string")
    
    const switchResource = new alicloud.vpc.Switch("switchResource", {
        cidrBlock: "string",
        vpcId: "string",
        description: "string",
        enableIpv6: false,
        ipv6CidrBlockMask: 0,
        tags: {
            string: "string",
        },
        vswitchName: "string",
        zoneId: "string",
    });
    
    type: alicloud:vpc:Switch
    properties:
        cidrBlock: string
        description: string
        enableIpv6: false
        ipv6CidrBlockMask: 0
        tags:
            string: string
        vpcId: string
        vswitchName: string
        zoneId: string
    

    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

    The Switch resource accepts the following input properties:

    CidrBlock string
    The IPv4 CIDR block of the VSwitch.
    VpcId string

    The VPC ID.

    The following arguments will be discarded. Please use new fields as soon as possible:

    AvailabilityZone 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.

    Description string
    The description of VSwitch.
    EnableIpv6 bool
    Whether the IPv6 function is enabled in the switch. Value:

    • true: enables IPv6.
    • false (default): IPv6 is not enabled.
    Ipv6CidrBlockMask int
    The IPv6 CIDR block of the VSwitch.
    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.
    VswitchName string
    The name of the VSwitch.
    ZoneId string
    The AZ for the VSwitch. Note: Required for a VPC VSwitch.
    CidrBlock string
    The IPv4 CIDR block of the VSwitch.
    VpcId string

    The VPC ID.

    The following arguments will be discarded. Please use new fields as soon as possible:

    AvailabilityZone 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.

    Description string
    The description of VSwitch.
    EnableIpv6 bool
    Whether the IPv6 function is enabled in the switch. Value:

    • true: enables IPv6.
    • false (default): IPv6 is not enabled.
    Ipv6CidrBlockMask int
    The IPv6 CIDR block of the VSwitch.
    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.
    VswitchName string
    The name of the VSwitch.
    ZoneId string
    The AZ for the VSwitch. Note: Required for a VPC VSwitch.
    cidrBlock String
    The IPv4 CIDR block of the VSwitch.
    vpcId String

    The VPC ID.

    The following arguments will be discarded. Please use new fields as soon as possible:

    availabilityZone 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.

    description String
    The description of VSwitch.
    enableIpv6 Boolean
    Whether the IPv6 function is enabled in the switch. Value:

    • true: enables IPv6.
    • false (default): IPv6 is not enabled.
    ipv6CidrBlockMask Integer
    The IPv6 CIDR block of the VSwitch.
    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.
    vswitchName String
    The name of the VSwitch.
    zoneId String
    The AZ for the VSwitch. Note: Required for a VPC VSwitch.
    cidrBlock string
    The IPv4 CIDR block of the VSwitch.
    vpcId string

    The VPC ID.

    The following arguments will be discarded. Please use new fields as soon as possible:

    availabilityZone 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.

    description string
    The description of VSwitch.
    enableIpv6 boolean
    Whether the IPv6 function is enabled in the switch. Value:

    • true: enables IPv6.
    • false (default): IPv6 is not enabled.
    ipv6CidrBlockMask number
    The IPv6 CIDR block of the VSwitch.
    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.
    vswitchName string
    The name of the VSwitch.
    zoneId string
    The AZ for the VSwitch. Note: Required for a VPC VSwitch.
    cidr_block str
    The IPv4 CIDR block of the VSwitch.
    vpc_id str

    The VPC ID.

    The following arguments will be discarded. Please use new fields as soon as possible:

    availability_zone 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.

    description str
    The description of VSwitch.
    enable_ipv6 bool
    Whether the IPv6 function is enabled in the switch. Value:

    • true: enables IPv6.
    • false (default): IPv6 is not enabled.
    ipv6_cidr_block_mask int
    The IPv6 CIDR block of the VSwitch.
    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.
    vswitch_name str
    The name of the VSwitch.
    zone_id str
    The AZ for the VSwitch. Note: Required for a VPC VSwitch.
    cidrBlock String
    The IPv4 CIDR block of the VSwitch.
    vpcId String

    The VPC ID.

    The following arguments will be discarded. Please use new fields as soon as possible:

    availabilityZone 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.

    description String
    The description of VSwitch.
    enableIpv6 Boolean
    Whether the IPv6 function is enabled in the switch. Value:

    • true: enables IPv6.
    • false (default): IPv6 is not enabled.
    ipv6CidrBlockMask Number
    The IPv6 CIDR block of the VSwitch.
    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.
    vswitchName String
    The name of the VSwitch.
    zoneId 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,
            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)
    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:
    AvailabilityZone 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 string
    The IPv4 CIDR block of the VSwitch.
    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:

    • true: enables IPv6.
    • false (default): IPv6 is not enabled.
    Ipv6CidrBlock string
    The IPv6 CIDR block of the VSwitch.
    Ipv6CidrBlockMask int
    The IPv6 CIDR block of the VSwitch.
    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 string

    The VPC ID.

    The following arguments will be discarded. Please use new fields as soon as possible:

    VswitchName string
    The name of the VSwitch.
    ZoneId string
    The AZ for the VSwitch. Note: Required for a VPC VSwitch.
    AvailabilityZone 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 string
    The IPv4 CIDR block of the VSwitch.
    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:

    • true: enables IPv6.
    • false (default): IPv6 is not enabled.
    Ipv6CidrBlock string
    The IPv6 CIDR block of the VSwitch.
    Ipv6CidrBlockMask int
    The IPv6 CIDR block of the VSwitch.
    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 string

    The VPC ID.

    The following arguments will be discarded. Please use new fields as soon as possible:

    VswitchName string
    The name of the VSwitch.
    ZoneId string
    The AZ for the VSwitch. Note: Required for a VPC VSwitch.
    availabilityZone 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 String
    The IPv4 CIDR block of the VSwitch.
    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:

    • true: enables IPv6.
    • false (default): IPv6 is not enabled.
    ipv6CidrBlock String
    The IPv6 CIDR block of the VSwitch.
    ipv6CidrBlockMask Integer
    The IPv6 CIDR block of the VSwitch.
    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 String

    The VPC ID.

    The following arguments will be discarded. Please use new fields as soon as possible:

    vswitchName String
    The name of the VSwitch.
    zoneId String
    The AZ for the VSwitch. Note: Required for a VPC VSwitch.
    availabilityZone 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 string
    The IPv4 CIDR block of the VSwitch.
    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:

    • true: enables IPv6.
    • false (default): IPv6 is not enabled.
    ipv6CidrBlock string
    The IPv6 CIDR block of the VSwitch.
    ipv6CidrBlockMask number
    The IPv6 CIDR block of the VSwitch.
    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 string

    The VPC ID.

    The following arguments will be discarded. Please use new fields as soon as possible:

    vswitchName string
    The name of the VSwitch.
    zoneId string
    The AZ for the VSwitch. Note: Required for a VPC VSwitch.
    availability_zone 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 str
    The IPv4 CIDR block of the VSwitch.
    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:

    • true: enables IPv6.
    • false (default): IPv6 is not enabled.
    ipv6_cidr_block str
    The IPv6 CIDR block of the VSwitch.
    ipv6_cidr_block_mask int
    The IPv6 CIDR block of the VSwitch.
    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 str

    The VPC ID.

    The following arguments will be discarded. Please use new fields as soon as possible:

    vswitch_name str
    The name of the VSwitch.
    zone_id str
    The AZ for the VSwitch. Note: Required for a VPC VSwitch.
    availabilityZone 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 String
    The IPv4 CIDR block of the VSwitch.
    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:

    • true: enables IPv6.
    • false (default): IPv6 is not enabled.
    ipv6CidrBlock String
    The IPv6 CIDR block of the VSwitch.
    ipv6CidrBlockMask Number
    The IPv6 CIDR block of the VSwitch.
    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 String

    The VPC ID.

    The following arguments will be discarded. Please use new fields as soon as possible:

    vswitchName String
    The name of the VSwitch.
    zoneId 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>
    

    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.62.1 published on Monday, Sep 16, 2024 by Pulumi