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

alicloud.vpc.getPrefixLists

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

This data source provides the Vpc Prefix Lists of the current Alibaba Cloud user.

NOTE: Available since v1.182.0.

Example Usage

Basic Usage

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

const ids = alicloud.vpc.getPrefixLists({});
export const vpcPrefixListId1 = ids.then(ids => ids.lists?.[0]?.id);
const nameRegex = alicloud.vpc.getPrefixLists({
    nameRegex: "^my-PrefixList",
});
export const vpcPrefixListId2 = nameRegex.then(nameRegex => nameRegex.lists?.[0]?.id);
Copy
import pulumi
import pulumi_alicloud as alicloud

ids = alicloud.vpc.get_prefix_lists()
pulumi.export("vpcPrefixListId1", ids.lists[0].id)
name_regex = alicloud.vpc.get_prefix_lists(name_regex="^my-PrefixList")
pulumi.export("vpcPrefixListId2", name_regex.lists[0].id)
Copy
package main

import (
	"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 {
		ids, err := vpc.GetPrefixLists(ctx, &vpc.GetPrefixListsArgs{}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcPrefixListId1", ids.Lists[0].Id)
		nameRegex, err := vpc.GetPrefixLists(ctx, &vpc.GetPrefixListsArgs{
			NameRegex: pulumi.StringRef("^my-PrefixList"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcPrefixListId2", nameRegex.Lists[0].Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var ids = AliCloud.Vpc.GetPrefixLists.Invoke();

    var nameRegex = AliCloud.Vpc.GetPrefixLists.Invoke(new()
    {
        NameRegex = "^my-PrefixList",
    });

    return new Dictionary<string, object?>
    {
        ["vpcPrefixListId1"] = ids.Apply(getPrefixListsResult => getPrefixListsResult.Lists[0]?.Id),
        ["vpcPrefixListId2"] = nameRegex.Apply(getPrefixListsResult => getPrefixListsResult.Lists[0]?.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.vpc.VpcFunctions;
import com.pulumi.alicloud.vpc.inputs.GetPrefixListsArgs;
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 ids = VpcFunctions.getPrefixLists();

        ctx.export("vpcPrefixListId1", ids.applyValue(getPrefixListsResult -> getPrefixListsResult.lists()[0].id()));
        final var nameRegex = VpcFunctions.getPrefixLists(GetPrefixListsArgs.builder()
            .nameRegex("^my-PrefixList")
            .build());

        ctx.export("vpcPrefixListId2", nameRegex.applyValue(getPrefixListsResult -> getPrefixListsResult.lists()[0].id()));
    }
}
Copy
variables:
  ids:
    fn::invoke:
      function: alicloud:vpc:getPrefixLists
      arguments: {}
  nameRegex:
    fn::invoke:
      function: alicloud:vpc:getPrefixLists
      arguments:
        nameRegex: ^my-PrefixList
outputs:
  vpcPrefixListId1: ${ids.lists[0].id}
  vpcPrefixListId2: ${nameRegex.lists[0].id}
Copy

Using getPrefixLists

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 getPrefixLists(args: GetPrefixListsArgs, opts?: InvokeOptions): Promise<GetPrefixListsResult>
function getPrefixListsOutput(args: GetPrefixListsOutputArgs, opts?: InvokeOptions): Output<GetPrefixListsResult>
Copy
def get_prefix_lists(enable_details: Optional[bool] = None,
                     ids: Optional[Sequence[str]] = None,
                     name_regex: Optional[str] = None,
                     output_file: Optional[str] = None,
                     prefix_list_name: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetPrefixListsResult
def get_prefix_lists_output(enable_details: Optional[pulumi.Input[bool]] = None,
                     ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                     name_regex: Optional[pulumi.Input[str]] = None,
                     output_file: Optional[pulumi.Input[str]] = None,
                     prefix_list_name: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetPrefixListsResult]
Copy
func GetPrefixLists(ctx *Context, args *GetPrefixListsArgs, opts ...InvokeOption) (*GetPrefixListsResult, error)
func GetPrefixListsOutput(ctx *Context, args *GetPrefixListsOutputArgs, opts ...InvokeOption) GetPrefixListsResultOutput
Copy

> Note: This function is named GetPrefixLists in the Go SDK.

public static class GetPrefixLists 
{
    public static Task<GetPrefixListsResult> InvokeAsync(GetPrefixListsArgs args, InvokeOptions? opts = null)
    public static Output<GetPrefixListsResult> Invoke(GetPrefixListsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetPrefixListsResult> getPrefixLists(GetPrefixListsArgs args, InvokeOptions options)
public static Output<GetPrefixListsResult> getPrefixLists(GetPrefixListsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:vpc/getPrefixLists:getPrefixLists
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

EnableDetails bool
Default to true. Set it to false can hide the entrys to output.
Ids Changes to this property will trigger replacement. List<string>
A list of Prefix List IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Prefix List name.
OutputFile string
File name where to save data source results (after running pulumi preview).
PrefixListName Changes to this property will trigger replacement. string
The name of the prefix list.
EnableDetails bool
Default to true. Set it to false can hide the entrys to output.
Ids Changes to this property will trigger replacement. []string
A list of Prefix List IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Prefix List name.
OutputFile string
File name where to save data source results (after running pulumi preview).
PrefixListName Changes to this property will trigger replacement. string
The name of the prefix list.
enableDetails Boolean
Default to true. Set it to false can hide the entrys to output.
ids Changes to this property will trigger replacement. List<String>
A list of Prefix List IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Prefix List name.
outputFile String
File name where to save data source results (after running pulumi preview).
prefixListName Changes to this property will trigger replacement. String
The name of the prefix list.
enableDetails boolean
Default to true. Set it to false can hide the entrys to output.
ids Changes to this property will trigger replacement. string[]
A list of Prefix List IDs.
nameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Prefix List name.
outputFile string
File name where to save data source results (after running pulumi preview).
prefixListName Changes to this property will trigger replacement. string
The name of the prefix list.
enable_details bool
Default to true. Set it to false can hide the entrys to output.
ids Changes to this property will trigger replacement. Sequence[str]
A list of Prefix List IDs.
name_regex Changes to this property will trigger replacement. str
A regex string to filter results by Prefix List name.
output_file str
File name where to save data source results (after running pulumi preview).
prefix_list_name Changes to this property will trigger replacement. str
The name of the prefix list.
enableDetails Boolean
Default to true. Set it to false can hide the entrys to output.
ids Changes to this property will trigger replacement. List<String>
A list of Prefix List IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Prefix List name.
outputFile String
File name where to save data source results (after running pulumi preview).
prefixListName Changes to this property will trigger replacement. String
The name of the prefix list.

getPrefixLists Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
Lists List<Pulumi.AliCloud.Vpc.Outputs.GetPrefixListsList>
A list of Vpc Prefix Lists. Each element contains the following attributes:
Names List<string>
A list of Prefix List names.
EnableDetails bool
NameRegex string
OutputFile string
PrefixListName string
The name of the prefix list.
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
Lists []GetPrefixListsList
A list of Vpc Prefix Lists. Each element contains the following attributes:
Names []string
A list of Prefix List names.
EnableDetails bool
NameRegex string
OutputFile string
PrefixListName string
The name of the prefix list.
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
lists List<GetPrefixListsList>
A list of Vpc Prefix Lists. Each element contains the following attributes:
names List<String>
A list of Prefix List names.
enableDetails Boolean
nameRegex String
outputFile String
prefixListName String
The name of the prefix list.
id string
The provider-assigned unique ID for this managed resource.
ids string[]
lists GetPrefixListsList[]
A list of Vpc Prefix Lists. Each element contains the following attributes:
names string[]
A list of Prefix List names.
enableDetails boolean
nameRegex string
outputFile string
prefixListName string
The name of the prefix list.
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
lists Sequence[GetPrefixListsList]
A list of Vpc Prefix Lists. Each element contains the following attributes:
names Sequence[str]
A list of Prefix List names.
enable_details bool
name_regex str
output_file str
prefix_list_name str
The name of the prefix list.
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
lists List<Property Map>
A list of Vpc Prefix Lists. Each element contains the following attributes:
names List<String>
A list of Prefix List names.
enableDetails Boolean
nameRegex String
outputFile String
prefixListName String
The name of the prefix list.

Supporting Types

GetPrefixListsList

CreateTime This property is required. string
The time when the prefix list was created.
Entrys This property is required. List<Pulumi.AliCloud.Vpc.Inputs.GetPrefixListsListEntry>
The CIDR address block list of the prefix list.
Id This property is required. string
The ID of the Prefix List.
IpVersion This property is required. string
The IP version of the prefix list.
MaxEntries This property is required. int
The maximum number of entries for CIDR address blocks in the prefix list.
PrefixListDescription This property is required. string
The description of the prefix list.
PrefixListId This property is required. string
The ID of the query Prefix List.
PrefixListName This property is required. string
The name of the prefix list.
ShareType This property is required. string
The share type of the prefix list.
CreateTime This property is required. string
The time when the prefix list was created.
Entrys This property is required. []GetPrefixListsListEntry
The CIDR address block list of the prefix list.
Id This property is required. string
The ID of the Prefix List.
IpVersion This property is required. string
The IP version of the prefix list.
MaxEntries This property is required. int
The maximum number of entries for CIDR address blocks in the prefix list.
PrefixListDescription This property is required. string
The description of the prefix list.
PrefixListId This property is required. string
The ID of the query Prefix List.
PrefixListName This property is required. string
The name of the prefix list.
ShareType This property is required. string
The share type of the prefix list.
createTime This property is required. String
The time when the prefix list was created.
entrys This property is required. List<GetPrefixListsListEntry>
The CIDR address block list of the prefix list.
id This property is required. String
The ID of the Prefix List.
ipVersion This property is required. String
The IP version of the prefix list.
maxEntries This property is required. Integer
The maximum number of entries for CIDR address blocks in the prefix list.
prefixListDescription This property is required. String
The description of the prefix list.
prefixListId This property is required. String
The ID of the query Prefix List.
prefixListName This property is required. String
The name of the prefix list.
shareType This property is required. String
The share type of the prefix list.
createTime This property is required. string
The time when the prefix list was created.
entrys This property is required. GetPrefixListsListEntry[]
The CIDR address block list of the prefix list.
id This property is required. string
The ID of the Prefix List.
ipVersion This property is required. string
The IP version of the prefix list.
maxEntries This property is required. number
The maximum number of entries for CIDR address blocks in the prefix list.
prefixListDescription This property is required. string
The description of the prefix list.
prefixListId This property is required. string
The ID of the query Prefix List.
prefixListName This property is required. string
The name of the prefix list.
shareType This property is required. string
The share type of the prefix list.
create_time This property is required. str
The time when the prefix list was created.
entrys This property is required. Sequence[GetPrefixListsListEntry]
The CIDR address block list of the prefix list.
id This property is required. str
The ID of the Prefix List.
ip_version This property is required. str
The IP version of the prefix list.
max_entries This property is required. int
The maximum number of entries for CIDR address blocks in the prefix list.
prefix_list_description This property is required. str
The description of the prefix list.
prefix_list_id This property is required. str
The ID of the query Prefix List.
prefix_list_name This property is required. str
The name of the prefix list.
share_type This property is required. str
The share type of the prefix list.
createTime This property is required. String
The time when the prefix list was created.
entrys This property is required. List<Property Map>
The CIDR address block list of the prefix list.
id This property is required. String
The ID of the Prefix List.
ipVersion This property is required. String
The IP version of the prefix list.
maxEntries This property is required. Number
The maximum number of entries for CIDR address blocks in the prefix list.
prefixListDescription This property is required. String
The description of the prefix list.
prefixListId This property is required. String
The ID of the query Prefix List.
prefixListName This property is required. String
The name of the prefix list.
shareType This property is required. String
The share type of the prefix list.

GetPrefixListsListEntry

Cidr This property is required. string
The CIDR address block of the prefix list.
Description This property is required. string
The description of the cidr entry.
Cidr This property is required. string
The CIDR address block of the prefix list.
Description This property is required. string
The description of the cidr entry.
cidr This property is required. String
The CIDR address block of the prefix list.
description This property is required. String
The description of the cidr entry.
cidr This property is required. string
The CIDR address block of the prefix list.
description This property is required. string
The description of the cidr entry.
cidr This property is required. str
The CIDR address block of the prefix list.
description This property is required. str
The description of the cidr entry.
cidr This property is required. String
The CIDR address block of the prefix list.
description This property is required. String
The description of the cidr entry.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi