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),
});
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: 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 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",
Description = "string",
EnableIpv6 = false,
Ipv6CidrBlockMask = 0,
IsDefault = false,
Tags =
{
{ "string", "string" },
},
VpcId = "string",
VswitchName = "string",
ZoneId = "string",
});
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"),
})
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());
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")
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",
});
type: alicloud:vpc:Switch
properties:
cidrBlock: string
description: string
enableIpv6: false
ipv6CidrBlockMask: 0
isDefault: false
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
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:
- Availability
Zone string - Field
availability_zone
has been deprecated from provider version 1.119.0. New fieldzone_id
instead. - Cidr
Block string - The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,cidr_block
is required. - Description string
- The description of VSwitch.
- Enable
Ipv6 bool - Whether the IPv6 function is enabled in the switch. Value:
- Ipv6Cidr
Block intMask - The IPv6 CIDR block of the VSwitch.
- Is
Default 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 fieldvswitch_name
instead. - Dictionary<string, string>
- The tags of VSwitch.
- Vpc
Id string - The VPC ID. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,vpc_id
is required. - Vswitch
Name string - The name of the VSwitch.
- Zone
Id string - The AZ for the VSwitch. Note: Required for a VPC VSwitch.
- Availability
Zone string - Field
availability_zone
has been deprecated from provider version 1.119.0. New fieldzone_id
instead. - Cidr
Block string - The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,cidr_block
is required. - Description string
- The description of VSwitch.
- Enable
Ipv6 bool - Whether the IPv6 function is enabled in the switch. Value:
- Ipv6Cidr
Block intMask - The IPv6 CIDR block of the VSwitch.
- Is
Default 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 fieldvswitch_name
instead. - map[string]string
- The tags of VSwitch.
- Vpc
Id string - The VPC ID. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,vpc_id
is required. - Vswitch
Name string - The name of the VSwitch.
- Zone
Id string - The AZ for the VSwitch. Note: Required for a VPC VSwitch.
- availability
Zone String - Field
availability_zone
has been deprecated from provider version 1.119.0. New fieldzone_id
instead. - cidr
Block String - The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,cidr_block
is required. - description String
- The description of VSwitch.
- enable
Ipv6 Boolean - Whether the IPv6 function is enabled in the switch. Value:
- ipv6Cidr
Block IntegerMask - The IPv6 CIDR block of the VSwitch.
- is
Default 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 fieldvswitch_name
instead. - Map<String,String>
- The tags of VSwitch.
- vpc
Id String - The VPC ID. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,vpc_id
is required. - vswitch
Name String - The name of the VSwitch.
- zone
Id String - The AZ for the VSwitch. Note: Required for a VPC VSwitch.
- availability
Zone string - Field
availability_zone
has been deprecated from provider version 1.119.0. New fieldzone_id
instead. - cidr
Block string - The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,cidr_block
is required. - description string
- The description of VSwitch.
- enable
Ipv6 boolean - Whether the IPv6 function is enabled in the switch. Value:
- ipv6Cidr
Block numberMask - The IPv6 CIDR block of the VSwitch.
- is
Default 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 fieldvswitch_name
instead. - {[key: string]: string}
- The tags of VSwitch.
- vpc
Id string - The VPC ID. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,vpc_id
is required. - vswitch
Name string - The name of the VSwitch.
- zone
Id 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 fieldzone_id
instead. - cidr_
block str - The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,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_ intblock_ mask - 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 fieldvswitch_name
instead. - Mapping[str, str]
- The tags of VSwitch.
- vpc_
id str - The VPC ID. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,vpc_id
is required. - vswitch_
name str - The name of the VSwitch.
- zone_
id str - The AZ for the VSwitch. Note: Required for a VPC VSwitch.
- availability
Zone String - Field
availability_zone
has been deprecated from provider version 1.119.0. New fieldzone_id
instead. - cidr
Block String - The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,cidr_block
is required. - description String
- The description of VSwitch.
- enable
Ipv6 Boolean - Whether the IPv6 function is enabled in the switch. Value:
- ipv6Cidr
Block NumberMask - The IPv6 CIDR block of the VSwitch.
- is
Default 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 fieldvswitch_name
instead. - Map<String>
- The tags of VSwitch.
- vpc
Id String - The VPC ID. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,vpc_id
is required. - vswitch
Name String - The name of the VSwitch.
- zone
Id 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:
- Create
Time string - The creation time of the VSwitch.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ipv6Cidr
Block string - The IPv6 CIDR block of the VSwitch.
- Status string
- The status of the resource.
- Create
Time string - The creation time of the VSwitch.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ipv6Cidr
Block string - The IPv6 CIDR block of the VSwitch.
- Status string
- The status of the resource.
- create
Time String - The creation time of the VSwitch.
- id String
- The provider-assigned unique ID for this managed resource.
- ipv6Cidr
Block String - The IPv6 CIDR block of the VSwitch.
- status String
- The status of the resource.
- create
Time string - The creation time of the VSwitch.
- id string
- The provider-assigned unique ID for this managed resource.
- ipv6Cidr
Block 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_ strblock - The IPv6 CIDR block of the VSwitch.
- status str
- The status of the resource.
- create
Time String - The creation time of the VSwitch.
- id String
- The provider-assigned unique ID for this managed resource.
- ipv6Cidr
Block 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)
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.
- Availability
Zone string - Field
availability_zone
has been deprecated from provider version 1.119.0. New fieldzone_id
instead. - Cidr
Block string - The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,cidr_block
is required. - Create
Time string - The creation time of the VSwitch.
- Description string
- The description of VSwitch.
- Enable
Ipv6 bool - Whether the IPv6 function is enabled in the switch. Value:
- Ipv6Cidr
Block string - The IPv6 CIDR block of the VSwitch.
- Ipv6Cidr
Block intMask - The IPv6 CIDR block of the VSwitch.
- Is
Default 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 fieldvswitch_name
instead. - Status string
- The status of the resource.
- Dictionary<string, string>
- The tags of VSwitch.
- Vpc
Id string - The VPC ID. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,vpc_id
is required. - Vswitch
Name string - The name of the VSwitch.
- Zone
Id string - The AZ for the VSwitch. Note: Required for a VPC VSwitch.
- Availability
Zone string - Field
availability_zone
has been deprecated from provider version 1.119.0. New fieldzone_id
instead. - Cidr
Block string - The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,cidr_block
is required. - Create
Time string - The creation time of the VSwitch.
- Description string
- The description of VSwitch.
- Enable
Ipv6 bool - Whether the IPv6 function is enabled in the switch. Value:
- Ipv6Cidr
Block string - The IPv6 CIDR block of the VSwitch.
- Ipv6Cidr
Block intMask - The IPv6 CIDR block of the VSwitch.
- Is
Default 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 fieldvswitch_name
instead. - Status string
- The status of the resource.
- map[string]string
- The tags of VSwitch.
- Vpc
Id string - The VPC ID. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,vpc_id
is required. - Vswitch
Name string - The name of the VSwitch.
- Zone
Id string - The AZ for the VSwitch. Note: Required for a VPC VSwitch.
- availability
Zone String - Field
availability_zone
has been deprecated from provider version 1.119.0. New fieldzone_id
instead. - cidr
Block String - The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,cidr_block
is required. - create
Time String - The creation time of the VSwitch.
- description String
- The description of VSwitch.
- enable
Ipv6 Boolean - Whether the IPv6 function is enabled in the switch. Value:
- ipv6Cidr
Block String - The IPv6 CIDR block of the VSwitch.
- ipv6Cidr
Block IntegerMask - The IPv6 CIDR block of the VSwitch.
- is
Default 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 fieldvswitch_name
instead. - status String
- The status of the resource.
- Map<String,String>
- The tags of VSwitch.
- vpc
Id String - The VPC ID. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,vpc_id
is required. - vswitch
Name String - The name of the VSwitch.
- zone
Id String - The AZ for the VSwitch. Note: Required for a VPC VSwitch.
- availability
Zone string - Field
availability_zone
has been deprecated from provider version 1.119.0. New fieldzone_id
instead. - cidr
Block string - The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,cidr_block
is required. - create
Time string - The creation time of the VSwitch.
- description string
- The description of VSwitch.
- enable
Ipv6 boolean - Whether the IPv6 function is enabled in the switch. Value:
- ipv6Cidr
Block string - The IPv6 CIDR block of the VSwitch.
- ipv6Cidr
Block numberMask - The IPv6 CIDR block of the VSwitch.
- is
Default 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 fieldvswitch_name
instead. - status string
- The status of the resource.
- {[key: string]: string}
- The tags of VSwitch.
- vpc
Id string - The VPC ID. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,vpc_id
is required. - vswitch
Name string - The name of the VSwitch.
- zone
Id 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 fieldzone_id
instead. - cidr_
block str - The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,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_ strblock - The IPv6 CIDR block of the VSwitch.
- ipv6_
cidr_ intblock_ mask - 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 fieldvswitch_name
instead. - status str
- The status of the resource.
- Mapping[str, str]
- The tags of VSwitch.
- vpc_
id str - The VPC ID. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,vpc_id
is required. - vswitch_
name str - The name of the VSwitch.
- zone_
id str - The AZ for the VSwitch. Note: Required for a VPC VSwitch.
- availability
Zone String - Field
availability_zone
has been deprecated from provider version 1.119.0. New fieldzone_id
instead. - cidr
Block String - The IPv4 CIDR block of the VSwitch. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,cidr_block
is required. - create
Time String - The creation time of the VSwitch.
- description String
- The description of VSwitch.
- enable
Ipv6 Boolean - Whether the IPv6 function is enabled in the switch. Value:
- ipv6Cidr
Block String - The IPv6 CIDR block of the VSwitch.
- ipv6Cidr
Block NumberMask - The IPv6 CIDR block of the VSwitch.
- is
Default 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 fieldvswitch_name
instead. - status String
- The status of the resource.
- Map<String>
- The tags of VSwitch.
- vpc
Id String - The VPC ID. NOTE: From version 1.233.0, if you do not set
is_default
, or setis_default
tofalse
,vpc_id
is required. - vswitch
Name String - The name of the VSwitch.
- zone
Id 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.