GetSwitches
This data source provides a list of VSwitches owned by an Alibaba Cloud account.
Example Usage
using Pulumi;
using AliCloud = Pulumi.AliCloud;
class MyStack : Stack
{
public MyStack()
{
var config = new Config();
var name = config.Get("name") ?? "vswitchDatasourceName";
var defaultZones = Output.Create(AliCloud.GetZones.InvokeAsync());
var vpc = new AliCloud.Vpc.Network("vpc", new AliCloud.Vpc.NetworkArgs
{
CidrBlock = "172.16.0.0/16",
});
var vswitch = new AliCloud.Vpc.Switch("vswitch", new AliCloud.Vpc.SwitchArgs
{
AvailabilityZone = defaultZones.Apply(defaultZones => defaultZones.Zones[0].Id),
CidrBlock = "172.16.0.0/24",
VpcId = vpc.Id,
});
var defaultSwitches = vswitch.Name.Apply(name => AliCloud.Vpc.GetSwitches.InvokeAsync(new AliCloud.Vpc.GetSwitchesArgs
{
NameRegex = name,
}));
}
}
Coming soon!
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "vswitchDatasourceName"
default_zones = alicloud.get_zones()
vpc = alicloud.vpc.Network("vpc", cidr_block="172.16.0.0/16")
vswitch = alicloud.vpc.Switch("vswitch",
availability_zone=default_zones.zones[0]["id"],
cidr_block="172.16.0.0/24",
vpc_id=vpc.id)
default_switches = vswitch.name.apply(lambda name: alicloud.vpc.get_switches(name_regex=name))import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "vswitchDatasourceName";
const defaultZones = pulumi.output(alicloud.getZones({ async: true }));
const vpc = new alicloud.vpc.Network("vpc", {
cidrBlock: "172.16.0.0/16",
});
const vswitch = new alicloud.vpc.Switch("vswitch", {
availabilityZone: defaultZones.zones[0].id,
cidrBlock: "172.16.0.0/24",
vpcId: vpc.id,
});
const defaultSwitches = vswitch.name.apply(name => alicloud.vpc.getSwitches({
nameRegex: name,
}, { async: true }));Using GetSwitches
function getSwitches(args: GetSwitchesArgs, opts?: InvokeOptions): Promise<GetSwitchesResult>function get_switches(cidr_block=None, ids=None, is_default=None, name_regex=None, output_file=None, resource_group_id=None, tags=None, vpc_id=None, zone_id=None, opts=None)func GetSwitches(ctx *Context, args *GetSwitchesArgs, opts ...InvokeOption) (*GetSwitchesResult, error)public static class GetSwitches {
public static Task<GetSwitchesResult> InvokeAsync(GetSwitchesArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
- Cidr
Block string Filter results by a specific CIDR block. For example: “172.16.0.0/12”.
- Ids List<string>
A list of VSwitch IDs.
- Is
Default bool Indicate whether the VSwitch is created by the system.
- Name
Regex string A regex string to filter results by name.
- Output
File string - Resource
Group stringId The Id of resource group which VSWitch belongs.
- Dictionary<string, object>
A mapping of tags to assign to the resource.
- Vpc
Id string ID of the VPC that owns the VSwitch.
- Zone
Id string The availability zone of the VSwitch.
- Cidr
Block string Filter results by a specific CIDR block. For example: “172.16.0.0/12”.
- Ids []string
A list of VSwitch IDs.
- Is
Default bool Indicate whether the VSwitch is created by the system.
- Name
Regex string A regex string to filter results by name.
- Output
File string - Resource
Group stringId The Id of resource group which VSWitch belongs.
- map[string]interface{}
A mapping of tags to assign to the resource.
- Vpc
Id string ID of the VPC that owns the VSwitch.
- Zone
Id string The availability zone of the VSwitch.
- cidr
Block string Filter results by a specific CIDR block. For example: “172.16.0.0/12”.
- ids string[]
A list of VSwitch IDs.
- is
Default boolean Indicate whether the VSwitch is created by the system.
- name
Regex string A regex string to filter results by name.
- output
File string - resource
Group stringId The Id of resource group which VSWitch belongs.
- {[key: string]: any}
A mapping of tags to assign to the resource.
- vpc
Id string ID of the VPC that owns the VSwitch.
- zone
Id string The availability zone of the VSwitch.
- cidr_
block str Filter results by a specific CIDR block. For example: “172.16.0.0/12”.
- ids List[str]
A list of VSwitch IDs.
- is_
default bool Indicate whether the VSwitch is created by the system.
- name_
regex str A regex string to filter results by name.
- output_
file str - resource_
group_ strid The Id of resource group which VSWitch belongs.
- Dict[str, Any]
A mapping of tags to assign to the resource.
- vpc_
id str ID of the VPC that owns the VSwitch.
- zone_
id str The availability zone of the VSwitch.
GetSwitches Result
The following output properties are available:
- Id string
The provider-assigned unique ID for this managed resource.
- Ids List<string>
A list of VSwitch IDs.
- Names List<string>
A list of VSwitch names.
- Vswitches
List<Pulumi.
Ali Cloud. Vpc. Outputs. Get Switches Vswitch> A list of VSwitches. Each element contains the following attributes:
- Cidr
Block string CIDR block of the VSwitch.
- Is
Default bool Whether the VSwitch is the default one in the region.
- Name
Regex string - Output
File string - Resource
Group stringId - Dictionary<string, object>
- Vpc
Id string ID of the VPC that owns the VSwitch.
- Zone
Id string ID of the availability zone where the VSwitch is located.
- Id string
The provider-assigned unique ID for this managed resource.
- Ids []string
A list of VSwitch IDs.
- Names []string
A list of VSwitch names.
- Vswitches
[]Get
Switches Vswitch A list of VSwitches. Each element contains the following attributes:
- Cidr
Block string CIDR block of the VSwitch.
- Is
Default bool Whether the VSwitch is the default one in the region.
- Name
Regex string - Output
File string - Resource
Group stringId - map[string]interface{}
- Vpc
Id string ID of the VPC that owns the VSwitch.
- Zone
Id string ID of the availability zone where the VSwitch is located.
- id string
The provider-assigned unique ID for this managed resource.
- ids string[]
A list of VSwitch IDs.
- names string[]
A list of VSwitch names.
- vswitches
Get
Switches Vswitch[] A list of VSwitches. Each element contains the following attributes:
- cidr
Block string CIDR block of the VSwitch.
- is
Default boolean Whether the VSwitch is the default one in the region.
- name
Regex string - output
File string - resource
Group stringId - {[key: string]: any}
- vpc
Id string ID of the VPC that owns the VSwitch.
- zone
Id string ID of the availability zone where the VSwitch is located.
- id str
The provider-assigned unique ID for this managed resource.
- ids List[str]
A list of VSwitch IDs.
- names List[str]
A list of VSwitch names.
- vswitches
List[Get
Switches Vswitch] A list of VSwitches. Each element contains the following attributes:
- cidr_
block str CIDR block of the VSwitch.
- is_
default bool Whether the VSwitch is the default one in the region.
- name_
regex str - output_
file str - resource_
group_ strid - Dict[str, Any]
- vpc_
id str ID of the VPC that owns the VSwitch.
- zone_
id str ID of the availability zone where the VSwitch is located.
Supporting Types
GetSwitchesVswitch
See the output API doc for this type.
See the output API doc for this type.
See the output API doc for this type.
- Cidr
Block string Filter results by a specific CIDR block. For example: “172.16.0.0/12”.
- Creation
Time string Time of creation.
- Description string
Description of the VSwitch.
- Id string
ID of the VSwitch.
- Instance
Ids List<string> List of ECS instance IDs in the specified VSwitch.
- Is
Default bool Indicate whether the VSwitch is created by the system.
- Name string
Name of the VSwitch.
- Vpc
Id string ID of the VPC that owns the VSwitch.
- Zone
Id string The availability zone of the VSwitch.
- Cidr
Block string Filter results by a specific CIDR block. For example: “172.16.0.0/12”.
- Creation
Time string Time of creation.
- Description string
Description of the VSwitch.
- Id string
ID of the VSwitch.
- Instance
Ids []string List of ECS instance IDs in the specified VSwitch.
- Is
Default bool Indicate whether the VSwitch is created by the system.
- Name string
Name of the VSwitch.
- Vpc
Id string ID of the VPC that owns the VSwitch.
- Zone
Id string The availability zone of the VSwitch.
- cidr
Block string Filter results by a specific CIDR block. For example: “172.16.0.0/12”.
- creation
Time string Time of creation.
- description string
Description of the VSwitch.
- id string
ID of the VSwitch.
- instance
Ids string[] List of ECS instance IDs in the specified VSwitch.
- is
Default boolean Indicate whether the VSwitch is created by the system.
- name string
Name of the VSwitch.
- vpc
Id string ID of the VPC that owns the VSwitch.
- zone
Id string The availability zone of the VSwitch.
- cidr_
block str Filter results by a specific CIDR block. For example: “172.16.0.0/12”.
- creation_
time str Time of creation.
- description str
Description of the VSwitch.
- id str
ID of the VSwitch.
- instance_
ids List[str] List of ECS instance IDs in the specified VSwitch.
- is_
default bool Indicate whether the VSwitch is created by the system.
- name str
Name of the VSwitch.
- vpc_
id str ID of the VPC that owns the VSwitch.
- zone_
id str The availability zone of the VSwitch.
Package Details
- Repository
- https://github.com/pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloudTerraform Provider.