flexibleengine.getVpcSubnets
Explore with Pulumi AI
Use this data source to get a list of VPC subnet.
Example Usage
An example filter by name and tag
import * as pulumi from "@pulumi/pulumi";
import * as flexibleengine from "@pulumi/flexibleengine";
const subnet = flexibleengine.getVpcSubnets({
name: _var.subnet_name,
tags: {
foo: "bar",
},
});
export const subnetVpcIds = subnet.then(subnet => subnet.subnets.map(__item => __item.vpcId));
import pulumi
import pulumi_flexibleengine as flexibleengine
subnet = flexibleengine.get_vpc_subnets(name=var["subnet_name"],
tags={
"foo": "bar",
})
pulumi.export("subnetVpcIds", [__item.vpc_id for __item in subnet.subnets])
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/flexibleengine/flexibleengine"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
subnet, err := flexibleengine.GetVpcSubnets(ctx, &flexibleengine.GetVpcSubnetsArgs{
Name: pulumi.StringRef(_var.Subnet_name),
Tags: map[string]interface{}{
"foo": "bar",
},
}, nil);
if err != nil {
return err
}
ctx.Export("subnetVpcIds", pulumi.StringArray(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ #-functions-%sflexibleengine:index-getVpcSubnets:getVpcSubnets.pp:7,11-34)))
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Flexibleengine = Pulumi.Flexibleengine;
return await Deployment.RunAsync(() =>
{
var subnet = Flexibleengine.GetVpcSubnets.Invoke(new()
{
Name = @var.Subnet_name,
Tags =
{
{ "foo", "bar" },
},
});
return new Dictionary<string, object?>
{
["subnetVpcIds"] = subnet.Apply(getVpcSubnetsResult => getVpcSubnetsResult.Subnets).Select(__item => __item.VpcId).ToList(),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.flexibleengine.FlexibleengineFunctions;
import com.pulumi.flexibleengine.inputs.GetVpcSubnetsArgs;
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 subnet = FlexibleengineFunctions.getVpcSubnets(GetVpcSubnetsArgs.builder()
.name(var_.subnet_name())
.tags(Map.of("foo", "bar"))
.build());
ctx.export("subnetVpcIds", subnet.applyValue(getVpcSubnetsResult -> getVpcSubnetsResult.subnets()).stream().map(element -> element.vpcId()).collect(toList()));
}
}
Coming soon!
Attributes Reference
The following attributes are exported:
id
- Indicates a data source ID.subnets
- Indicates a list of all subnets found. The subnets structure is documented below.
id
- Indicates the ID of the subnet.name
- Indicates the name of the subnet.description
- Indicates the description of the subnet.cidr
- Indicates the cidr block of the subnet.status
- Indicates the current status of the subnet.vpc_id
- Indicates the Id of the VPC that the subnet belongs to.gateway_ip
- Indicates the subnet gateway address of the subnet.primary_dns
- Indicates the IP address of DNS server 1 on the subnet.secondary_dns
- Indicates the IP address of DNS server 2 on the subnet.availability_zone
- Indicates the availability zone (AZ) to which the subnet belongs to.dhcp_enable
- Indicates whether the DHCP is enabled.dns_list
- Indicates The IP address list of DNS servers on the subnet.ipv4_subnet_id
- Indicates the ID of the IPv4 subnet (Native OpenStack API).ipv6_enable
- Indicates whether the IPv6 is enabled.ipv6_subnet_id
- Indicates the ID of the IPv6 subnet (Native OpenStack API).ipv6_cidr
- Indicates the IPv6 subnet CIDR block.ipv6_gateway
- Indicates the IPv6 subnet gateway.tags
- Indicates the key/value pairs which associated with the subnet.
Using getVpcSubnets
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getVpcSubnets(args: GetVpcSubnetsArgs, opts?: InvokeOptions): Promise<GetVpcSubnetsResult>
function getVpcSubnetsOutput(args: GetVpcSubnetsOutputArgs, opts?: InvokeOptions): Output<GetVpcSubnetsResult>
def get_vpc_subnets(availability_zone: Optional[str] = None,
cidr: Optional[str] = None,
gateway_ip: Optional[str] = None,
id: Optional[str] = None,
name: Optional[str] = None,
primary_dns: Optional[str] = None,
region: Optional[str] = None,
secondary_dns: Optional[str] = None,
status: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
vpc_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetVpcSubnetsResult
def get_vpc_subnets_output(availability_zone: Optional[pulumi.Input[str]] = None,
cidr: Optional[pulumi.Input[str]] = None,
gateway_ip: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
primary_dns: Optional[pulumi.Input[str]] = None,
region: Optional[pulumi.Input[str]] = None,
secondary_dns: Optional[pulumi.Input[str]] = None,
status: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
vpc_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetVpcSubnetsResult]
func GetVpcSubnets(ctx *Context, args *GetVpcSubnetsArgs, opts ...InvokeOption) (*GetVpcSubnetsResult, error)
func GetVpcSubnetsOutput(ctx *Context, args *GetVpcSubnetsOutputArgs, opts ...InvokeOption) GetVpcSubnetsResultOutput
> Note: This function is named GetVpcSubnets
in the Go SDK.
public static class GetVpcSubnets
{
public static Task<GetVpcSubnetsResult> InvokeAsync(GetVpcSubnetsArgs args, InvokeOptions? opts = null)
public static Output<GetVpcSubnetsResult> Invoke(GetVpcSubnetsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetVpcSubnetsResult> getVpcSubnets(GetVpcSubnetsArgs args, InvokeOptions options)
public static Output<GetVpcSubnetsResult> getVpcSubnets(GetVpcSubnetsArgs args, InvokeOptions options)
fn::invoke:
function: flexibleengine:index/getVpcSubnets:getVpcSubnets
arguments:
# arguments dictionary
The following arguments are supported:
- Availability
Zone string - Specifies the availability zone (AZ) to which the desired subnet belongs to.
- Cidr string
- Specifies the network segment of desired subnet. The value must be in CIDR format.
- Gateway
Ip string - Specifies the subnet gateway address of desired subnet.
- Id string
- Specifies the id of the desired subnet.
- Name string
- Specifies the name of the desired subnet.
- Primary
Dns string - Specifies the IP address of DNS server 1 on the desired subnet.
- Region string
- Specifies the region in which to obtain the subnet. If omitted, the provider-level region will be used.
- Secondary
Dns string - Specifies the IP address of DNS server 2 on the desired subnet.
- Status string
- Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.
- Dictionary<string, string>
Specifies the included key/value pairs which associated with the desired subnet.
A maximum of 10 tag keys are allowed for each query operation. Each tag key can have up to 10 tag values. The tag key cannot be left blank or set to an empty string. Each tag key must be unique, and each tag value in a tag must be unique, use commas(,) to separate the multiple values. An empty for values indicates any value. The values are in the OR relationship.
- Vpc
Id string - Specifies the id of the VPC that the desired subnet belongs to.
- Availability
Zone string - Specifies the availability zone (AZ) to which the desired subnet belongs to.
- Cidr string
- Specifies the network segment of desired subnet. The value must be in CIDR format.
- Gateway
Ip string - Specifies the subnet gateway address of desired subnet.
- Id string
- Specifies the id of the desired subnet.
- Name string
- Specifies the name of the desired subnet.
- Primary
Dns string - Specifies the IP address of DNS server 1 on the desired subnet.
- Region string
- Specifies the region in which to obtain the subnet. If omitted, the provider-level region will be used.
- Secondary
Dns string - Specifies the IP address of DNS server 2 on the desired subnet.
- Status string
- Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.
- map[string]string
Specifies the included key/value pairs which associated with the desired subnet.
A maximum of 10 tag keys are allowed for each query operation. Each tag key can have up to 10 tag values. The tag key cannot be left blank or set to an empty string. Each tag key must be unique, and each tag value in a tag must be unique, use commas(,) to separate the multiple values. An empty for values indicates any value. The values are in the OR relationship.
- Vpc
Id string - Specifies the id of the VPC that the desired subnet belongs to.
- availability
Zone String - Specifies the availability zone (AZ) to which the desired subnet belongs to.
- cidr String
- Specifies the network segment of desired subnet. The value must be in CIDR format.
- gateway
Ip String - Specifies the subnet gateway address of desired subnet.
- id String
- Specifies the id of the desired subnet.
- name String
- Specifies the name of the desired subnet.
- primary
Dns String - Specifies the IP address of DNS server 1 on the desired subnet.
- region String
- Specifies the region in which to obtain the subnet. If omitted, the provider-level region will be used.
- secondary
Dns String - Specifies the IP address of DNS server 2 on the desired subnet.
- status String
- Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.
- Map<String,String>
Specifies the included key/value pairs which associated with the desired subnet.
A maximum of 10 tag keys are allowed for each query operation. Each tag key can have up to 10 tag values. The tag key cannot be left blank or set to an empty string. Each tag key must be unique, and each tag value in a tag must be unique, use commas(,) to separate the multiple values. An empty for values indicates any value. The values are in the OR relationship.
- vpc
Id String - Specifies the id of the VPC that the desired subnet belongs to.
- availability
Zone string - Specifies the availability zone (AZ) to which the desired subnet belongs to.
- cidr string
- Specifies the network segment of desired subnet. The value must be in CIDR format.
- gateway
Ip string - Specifies the subnet gateway address of desired subnet.
- id string
- Specifies the id of the desired subnet.
- name string
- Specifies the name of the desired subnet.
- primary
Dns string - Specifies the IP address of DNS server 1 on the desired subnet.
- region string
- Specifies the region in which to obtain the subnet. If omitted, the provider-level region will be used.
- secondary
Dns string - Specifies the IP address of DNS server 2 on the desired subnet.
- status string
- Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.
- {[key: string]: string}
Specifies the included key/value pairs which associated with the desired subnet.
A maximum of 10 tag keys are allowed for each query operation. Each tag key can have up to 10 tag values. The tag key cannot be left blank or set to an empty string. Each tag key must be unique, and each tag value in a tag must be unique, use commas(,) to separate the multiple values. An empty for values indicates any value. The values are in the OR relationship.
- vpc
Id string - Specifies the id of the VPC that the desired subnet belongs to.
- availability_
zone str - Specifies the availability zone (AZ) to which the desired subnet belongs to.
- cidr str
- Specifies the network segment of desired subnet. The value must be in CIDR format.
- gateway_
ip str - Specifies the subnet gateway address of desired subnet.
- id str
- Specifies the id of the desired subnet.
- name str
- Specifies the name of the desired subnet.
- primary_
dns str - Specifies the IP address of DNS server 1 on the desired subnet.
- region str
- Specifies the region in which to obtain the subnet. If omitted, the provider-level region will be used.
- secondary_
dns str - Specifies the IP address of DNS server 2 on the desired subnet.
- status str
- Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.
- Mapping[str, str]
Specifies the included key/value pairs which associated with the desired subnet.
A maximum of 10 tag keys are allowed for each query operation. Each tag key can have up to 10 tag values. The tag key cannot be left blank or set to an empty string. Each tag key must be unique, and each tag value in a tag must be unique, use commas(,) to separate the multiple values. An empty for values indicates any value. The values are in the OR relationship.
- vpc_
id str - Specifies the id of the VPC that the desired subnet belongs to.
- availability
Zone String - Specifies the availability zone (AZ) to which the desired subnet belongs to.
- cidr String
- Specifies the network segment of desired subnet. The value must be in CIDR format.
- gateway
Ip String - Specifies the subnet gateway address of desired subnet.
- id String
- Specifies the id of the desired subnet.
- name String
- Specifies the name of the desired subnet.
- primary
Dns String - Specifies the IP address of DNS server 1 on the desired subnet.
- region String
- Specifies the region in which to obtain the subnet. If omitted, the provider-level region will be used.
- secondary
Dns String - Specifies the IP address of DNS server 2 on the desired subnet.
- status String
- Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.
- Map<String>
Specifies the included key/value pairs which associated with the desired subnet.
A maximum of 10 tag keys are allowed for each query operation. Each tag key can have up to 10 tag values. The tag key cannot be left blank or set to an empty string. Each tag key must be unique, and each tag value in a tag must be unique, use commas(,) to separate the multiple values. An empty for values indicates any value. The values are in the OR relationship.
- vpc
Id String - Specifies the id of the VPC that the desired subnet belongs to.
getVpcSubnets Result
The following output properties are available:
- Id string
- Region string
- Subnets
List<Get
Vpc Subnets Subnet> - Availability
Zone string - Cidr string
- Gateway
Ip string - Name string
- Primary
Dns string - Secondary
Dns string - Status string
- Dictionary<string, string>
- Vpc
Id string
- Id string
- Region string
- Subnets
[]Get
Vpc Subnets Subnet - Availability
Zone string - Cidr string
- Gateway
Ip string - Name string
- Primary
Dns string - Secondary
Dns string - Status string
- map[string]string
- Vpc
Id string
- id String
- region String
- subnets
List<Get
Vpc Subnets Subnet> - availability
Zone String - cidr String
- gateway
Ip String - name String
- primary
Dns String - secondary
Dns String - status String
- Map<String,String>
- vpc
Id String
- id string
- region string
- subnets
Get
Vpc Subnets Subnet[] - availability
Zone string - cidr string
- gateway
Ip string - name string
- primary
Dns string - secondary
Dns string - status string
- {[key: string]: string}
- vpc
Id string
- id str
- region str
- subnets
Sequence[Get
Vpc Subnets Subnet] - availability_
zone str - cidr str
- gateway_
ip str - name str
- primary_
dns str - secondary_
dns str - status str
- Mapping[str, str]
- vpc_
id str
- id String
- region String
- subnets List<Property Map>
- availability
Zone String - cidr String
- gateway
Ip String - name String
- primary
Dns String - secondary
Dns String - status String
- Map<String>
- vpc
Id String
Supporting Types
GetVpcSubnetsSubnet
- Availability
Zone string - Specifies the availability zone (AZ) to which the desired subnet belongs to.
- Cidr string
- Specifies the network segment of desired subnet. The value must be in CIDR format.
- Description string
- Dhcp
Enable bool - Dns
Lists List<string> - Gateway
Ip string - Specifies the subnet gateway address of desired subnet.
- Id string
- Specifies the id of the desired subnet.
- Ipv4Subnet
Id string - Ipv6Cidr string
- Ipv6Enable bool
- Ipv6Gateway string
- Ipv6Subnet
Id string - Name string
- Specifies the name of the desired subnet.
- Primary
Dns string - Specifies the IP address of DNS server 1 on the desired subnet.
- Secondary
Dns string - Specifies the IP address of DNS server 2 on the desired subnet.
- Status string
- Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.
- Subnet
Id string - Dictionary<string, string>
Specifies the included key/value pairs which associated with the desired subnet.
A maximum of 10 tag keys are allowed for each query operation. Each tag key can have up to 10 tag values. The tag key cannot be left blank or set to an empty string. Each tag key must be unique, and each tag value in a tag must be unique, use commas(,) to separate the multiple values. An empty for values indicates any value. The values are in the OR relationship.
- Vpc
Id string - Specifies the id of the VPC that the desired subnet belongs to.
- Availability
Zone string - Specifies the availability zone (AZ) to which the desired subnet belongs to.
- Cidr string
- Specifies the network segment of desired subnet. The value must be in CIDR format.
- Description string
- Dhcp
Enable bool - Dns
Lists []string - Gateway
Ip string - Specifies the subnet gateway address of desired subnet.
- Id string
- Specifies the id of the desired subnet.
- Ipv4Subnet
Id string - Ipv6Cidr string
- Ipv6Enable bool
- Ipv6Gateway string
- Ipv6Subnet
Id string - Name string
- Specifies the name of the desired subnet.
- Primary
Dns string - Specifies the IP address of DNS server 1 on the desired subnet.
- Secondary
Dns string - Specifies the IP address of DNS server 2 on the desired subnet.
- Status string
- Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.
- Subnet
Id string - map[string]string
Specifies the included key/value pairs which associated with the desired subnet.
A maximum of 10 tag keys are allowed for each query operation. Each tag key can have up to 10 tag values. The tag key cannot be left blank or set to an empty string. Each tag key must be unique, and each tag value in a tag must be unique, use commas(,) to separate the multiple values. An empty for values indicates any value. The values are in the OR relationship.
- Vpc
Id string - Specifies the id of the VPC that the desired subnet belongs to.
- availability
Zone String - Specifies the availability zone (AZ) to which the desired subnet belongs to.
- cidr String
- Specifies the network segment of desired subnet. The value must be in CIDR format.
- description String
- dhcp
Enable Boolean - dns
Lists List<String> - gateway
Ip String - Specifies the subnet gateway address of desired subnet.
- id String
- Specifies the id of the desired subnet.
- ipv4Subnet
Id String - ipv6Cidr String
- ipv6Enable Boolean
- ipv6Gateway String
- ipv6Subnet
Id String - name String
- Specifies the name of the desired subnet.
- primary
Dns String - Specifies the IP address of DNS server 1 on the desired subnet.
- secondary
Dns String - Specifies the IP address of DNS server 2 on the desired subnet.
- status String
- Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.
- subnet
Id String - Map<String,String>
Specifies the included key/value pairs which associated with the desired subnet.
A maximum of 10 tag keys are allowed for each query operation. Each tag key can have up to 10 tag values. The tag key cannot be left blank or set to an empty string. Each tag key must be unique, and each tag value in a tag must be unique, use commas(,) to separate the multiple values. An empty for values indicates any value. The values are in the OR relationship.
- vpc
Id String - Specifies the id of the VPC that the desired subnet belongs to.
- availability
Zone string - Specifies the availability zone (AZ) to which the desired subnet belongs to.
- cidr string
- Specifies the network segment of desired subnet. The value must be in CIDR format.
- description string
- dhcp
Enable boolean - dns
Lists string[] - gateway
Ip string - Specifies the subnet gateway address of desired subnet.
- id string
- Specifies the id of the desired subnet.
- ipv4Subnet
Id string - ipv6Cidr string
- ipv6Enable boolean
- ipv6Gateway string
- ipv6Subnet
Id string - name string
- Specifies the name of the desired subnet.
- primary
Dns string - Specifies the IP address of DNS server 1 on the desired subnet.
- secondary
Dns string - Specifies the IP address of DNS server 2 on the desired subnet.
- status string
- Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.
- subnet
Id string - {[key: string]: string}
Specifies the included key/value pairs which associated with the desired subnet.
A maximum of 10 tag keys are allowed for each query operation. Each tag key can have up to 10 tag values. The tag key cannot be left blank or set to an empty string. Each tag key must be unique, and each tag value in a tag must be unique, use commas(,) to separate the multiple values. An empty for values indicates any value. The values are in the OR relationship.
- vpc
Id string - Specifies the id of the VPC that the desired subnet belongs to.
- availability_
zone str - Specifies the availability zone (AZ) to which the desired subnet belongs to.
- cidr str
- Specifies the network segment of desired subnet. The value must be in CIDR format.
- description str
- dhcp_
enable bool - dns_
lists Sequence[str] - gateway_
ip str - Specifies the subnet gateway address of desired subnet.
- id str
- Specifies the id of the desired subnet.
- ipv4_
subnet_ strid - ipv6_
cidr str - ipv6_
enable bool - ipv6_
gateway str - ipv6_
subnet_ strid - name str
- Specifies the name of the desired subnet.
- primary_
dns str - Specifies the IP address of DNS server 1 on the desired subnet.
- secondary_
dns str - Specifies the IP address of DNS server 2 on the desired subnet.
- status str
- Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.
- subnet_
id str - Mapping[str, str]
Specifies the included key/value pairs which associated with the desired subnet.
A maximum of 10 tag keys are allowed for each query operation. Each tag key can have up to 10 tag values. The tag key cannot be left blank or set to an empty string. Each tag key must be unique, and each tag value in a tag must be unique, use commas(,) to separate the multiple values. An empty for values indicates any value. The values are in the OR relationship.
- vpc_
id str - Specifies the id of the VPC that the desired subnet belongs to.
- availability
Zone String - Specifies the availability zone (AZ) to which the desired subnet belongs to.
- cidr String
- Specifies the network segment of desired subnet. The value must be in CIDR format.
- description String
- dhcp
Enable Boolean - dns
Lists List<String> - gateway
Ip String - Specifies the subnet gateway address of desired subnet.
- id String
- Specifies the id of the desired subnet.
- ipv4Subnet
Id String - ipv6Cidr String
- ipv6Enable Boolean
- ipv6Gateway String
- ipv6Subnet
Id String - name String
- Specifies the name of the desired subnet.
- primary
Dns String - Specifies the IP address of DNS server 1 on the desired subnet.
- secondary
Dns String - Specifies the IP address of DNS server 2 on the desired subnet.
- status String
- Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.
- subnet
Id String - Map<String>
Specifies the included key/value pairs which associated with the desired subnet.
A maximum of 10 tag keys are allowed for each query operation. Each tag key can have up to 10 tag values. The tag key cannot be left blank or set to an empty string. Each tag key must be unique, and each tag value in a tag must be unique, use commas(,) to separate the multiple values. An empty for values indicates any value. The values are in the OR relationship.
- vpc
Id String - Specifies the id of the VPC that the desired subnet belongs to.
Package Details
- Repository
- flexibleengine flexibleenginecloud/terraform-provider-flexibleengine
- License
- Notes
- This Pulumi package is based on the
flexibleengine
Terraform Provider.