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

alicloud.vpc.getTrafficMirrorFilters

Explore with Pulumi AI

This data source provides the Vpc Traffic Mirror Filters of the current Alibaba Cloud user.

NOTE: Available since v1.140.0.

Example Usage

Basic Usage

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

const ids = alicloud.vpc.getTrafficMirrorFilters({
    ids: ["example_id"],
});
export const vpcTrafficMirrorFilterId1 = ids.then(ids => ids.filters?.[0]?.id);
const nameRegex = alicloud.vpc.getTrafficMirrorFilters({
    nameRegex: "^my-TrafficMirrorFilter",
});
export const vpcTrafficMirrorFilterId2 = nameRegex.then(nameRegex => nameRegex.filters?.[0]?.id);
const filterName = alicloud.vpc.getTrafficMirrorFilters({
    trafficMirrorFilterName: "example_traffic_mirror_filter_name",
});
export const vpcTrafficMirrorFilterId3 = filterName.then(filterName => filterName.filters?.[0]?.id);
const status = alicloud.vpc.getTrafficMirrorFilters({
    status: "^my-TrafficMirrorFilter",
});
export const vpcTrafficMirrorFilterId4 = status.then(status => status.filters?.[0]?.id);
Copy
import pulumi
import pulumi_alicloud as alicloud

ids = alicloud.vpc.get_traffic_mirror_filters(ids=["example_id"])
pulumi.export("vpcTrafficMirrorFilterId1", ids.filters[0].id)
name_regex = alicloud.vpc.get_traffic_mirror_filters(name_regex="^my-TrafficMirrorFilter")
pulumi.export("vpcTrafficMirrorFilterId2", name_regex.filters[0].id)
filter_name = alicloud.vpc.get_traffic_mirror_filters(traffic_mirror_filter_name="example_traffic_mirror_filter_name")
pulumi.export("vpcTrafficMirrorFilterId3", filter_name.filters[0].id)
status = alicloud.vpc.get_traffic_mirror_filters(status="^my-TrafficMirrorFilter")
pulumi.export("vpcTrafficMirrorFilterId4", status.filters[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.GetTrafficMirrorFilters(ctx, &vpc.GetTrafficMirrorFiltersArgs{
			Ids: []string{
				"example_id",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcTrafficMirrorFilterId1", ids.Filters[0].Id)
		nameRegex, err := vpc.GetTrafficMirrorFilters(ctx, &vpc.GetTrafficMirrorFiltersArgs{
			NameRegex: pulumi.StringRef("^my-TrafficMirrorFilter"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcTrafficMirrorFilterId2", nameRegex.Filters[0].Id)
		filterName, err := vpc.GetTrafficMirrorFilters(ctx, &vpc.GetTrafficMirrorFiltersArgs{
			TrafficMirrorFilterName: pulumi.StringRef("example_traffic_mirror_filter_name"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcTrafficMirrorFilterId3", filterName.Filters[0].Id)
		status, err := vpc.GetTrafficMirrorFilters(ctx, &vpc.GetTrafficMirrorFiltersArgs{
			Status: pulumi.StringRef("^my-TrafficMirrorFilter"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcTrafficMirrorFilterId4", status.Filters[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.GetTrafficMirrorFilters.Invoke(new()
    {
        Ids = new[]
        {
            "example_id",
        },
    });

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

    var filterName = AliCloud.Vpc.GetTrafficMirrorFilters.Invoke(new()
    {
        TrafficMirrorFilterName = "example_traffic_mirror_filter_name",
    });

    var status = AliCloud.Vpc.GetTrafficMirrorFilters.Invoke(new()
    {
        Status = "^my-TrafficMirrorFilter",
    });

    return new Dictionary<string, object?>
    {
        ["vpcTrafficMirrorFilterId1"] = ids.Apply(getTrafficMirrorFiltersResult => getTrafficMirrorFiltersResult.Filters[0]?.Id),
        ["vpcTrafficMirrorFilterId2"] = nameRegex.Apply(getTrafficMirrorFiltersResult => getTrafficMirrorFiltersResult.Filters[0]?.Id),
        ["vpcTrafficMirrorFilterId3"] = filterName.Apply(getTrafficMirrorFiltersResult => getTrafficMirrorFiltersResult.Filters[0]?.Id),
        ["vpcTrafficMirrorFilterId4"] = status.Apply(getTrafficMirrorFiltersResult => getTrafficMirrorFiltersResult.Filters[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.GetTrafficMirrorFiltersArgs;
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.getTrafficMirrorFilters(GetTrafficMirrorFiltersArgs.builder()
            .ids("example_id")
            .build());

        ctx.export("vpcTrafficMirrorFilterId1", ids.applyValue(getTrafficMirrorFiltersResult -> getTrafficMirrorFiltersResult.filters()[0].id()));
        final var nameRegex = VpcFunctions.getTrafficMirrorFilters(GetTrafficMirrorFiltersArgs.builder()
            .nameRegex("^my-TrafficMirrorFilter")
            .build());

        ctx.export("vpcTrafficMirrorFilterId2", nameRegex.applyValue(getTrafficMirrorFiltersResult -> getTrafficMirrorFiltersResult.filters()[0].id()));
        final var filterName = VpcFunctions.getTrafficMirrorFilters(GetTrafficMirrorFiltersArgs.builder()
            .trafficMirrorFilterName("example_traffic_mirror_filter_name")
            .build());

        ctx.export("vpcTrafficMirrorFilterId3", filterName.applyValue(getTrafficMirrorFiltersResult -> getTrafficMirrorFiltersResult.filters()[0].id()));
        final var status = VpcFunctions.getTrafficMirrorFilters(GetTrafficMirrorFiltersArgs.builder()
            .status("^my-TrafficMirrorFilter")
            .build());

        ctx.export("vpcTrafficMirrorFilterId4", status.applyValue(getTrafficMirrorFiltersResult -> getTrafficMirrorFiltersResult.filters()[0].id()));
    }
}
Copy
variables:
  ids:
    fn::invoke:
      function: alicloud:vpc:getTrafficMirrorFilters
      arguments:
        ids:
          - example_id
  nameRegex:
    fn::invoke:
      function: alicloud:vpc:getTrafficMirrorFilters
      arguments:
        nameRegex: ^my-TrafficMirrorFilter
  filterName:
    fn::invoke:
      function: alicloud:vpc:getTrafficMirrorFilters
      arguments:
        trafficMirrorFilterName: example_traffic_mirror_filter_name
  status:
    fn::invoke:
      function: alicloud:vpc:getTrafficMirrorFilters
      arguments:
        status: ^my-TrafficMirrorFilter
outputs:
  vpcTrafficMirrorFilterId1: ${ids.filters[0].id}
  vpcTrafficMirrorFilterId2: ${nameRegex.filters[0].id}
  vpcTrafficMirrorFilterId3: ${filterName.filters[0].id}
  vpcTrafficMirrorFilterId4: ${status.filters[0].id}
Copy

Using getTrafficMirrorFilters

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 getTrafficMirrorFilters(args: GetTrafficMirrorFiltersArgs, opts?: InvokeOptions): Promise<GetTrafficMirrorFiltersResult>
function getTrafficMirrorFiltersOutput(args: GetTrafficMirrorFiltersOutputArgs, opts?: InvokeOptions): Output<GetTrafficMirrorFiltersResult>
Copy
def get_traffic_mirror_filters(ids: Optional[Sequence[str]] = None,
                               name_regex: Optional[str] = None,
                               output_file: Optional[str] = None,
                               status: Optional[str] = None,
                               traffic_mirror_filter_name: Optional[str] = None,
                               opts: Optional[InvokeOptions] = None) -> GetTrafficMirrorFiltersResult
def get_traffic_mirror_filters_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                               name_regex: Optional[pulumi.Input[str]] = None,
                               output_file: Optional[pulumi.Input[str]] = None,
                               status: Optional[pulumi.Input[str]] = None,
                               traffic_mirror_filter_name: Optional[pulumi.Input[str]] = None,
                               opts: Optional[InvokeOptions] = None) -> Output[GetTrafficMirrorFiltersResult]
Copy
func GetTrafficMirrorFilters(ctx *Context, args *GetTrafficMirrorFiltersArgs, opts ...InvokeOption) (*GetTrafficMirrorFiltersResult, error)
func GetTrafficMirrorFiltersOutput(ctx *Context, args *GetTrafficMirrorFiltersOutputArgs, opts ...InvokeOption) GetTrafficMirrorFiltersResultOutput
Copy

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

public static class GetTrafficMirrorFilters 
{
    public static Task<GetTrafficMirrorFiltersResult> InvokeAsync(GetTrafficMirrorFiltersArgs args, InvokeOptions? opts = null)
    public static Output<GetTrafficMirrorFiltersResult> Invoke(GetTrafficMirrorFiltersInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetTrafficMirrorFiltersResult> getTrafficMirrorFilters(GetTrafficMirrorFiltersArgs args, InvokeOptions options)
public static Output<GetTrafficMirrorFiltersResult> getTrafficMirrorFilters(GetTrafficMirrorFiltersArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:vpc/getTrafficMirrorFilters:getTrafficMirrorFilters
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Ids Changes to this property will trigger replacement. List<string>
A list of Traffic Mirror Filter IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Traffic Mirror Filter name.
OutputFile string
File name where to save data source results (after running pulumi preview).
Status Changes to this property will trigger replacement. string
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
TrafficMirrorFilterName Changes to this property will trigger replacement. string
The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
Ids Changes to this property will trigger replacement. []string
A list of Traffic Mirror Filter IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Traffic Mirror Filter name.
OutputFile string
File name where to save data source results (after running pulumi preview).
Status Changes to this property will trigger replacement. string
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
TrafficMirrorFilterName Changes to this property will trigger replacement. string
The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
ids Changes to this property will trigger replacement. List<String>
A list of Traffic Mirror Filter IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Traffic Mirror Filter name.
outputFile String
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. String
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
trafficMirrorFilterName Changes to this property will trigger replacement. String
The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
ids Changes to this property will trigger replacement. string[]
A list of Traffic Mirror Filter IDs.
nameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Traffic Mirror Filter name.
outputFile string
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. string
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
trafficMirrorFilterName Changes to this property will trigger replacement. string
The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
ids Changes to this property will trigger replacement. Sequence[str]
A list of Traffic Mirror Filter IDs.
name_regex Changes to this property will trigger replacement. str
A regex string to filter results by Traffic Mirror Filter name.
output_file str
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. str
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
traffic_mirror_filter_name Changes to this property will trigger replacement. str
The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
ids Changes to this property will trigger replacement. List<String>
A list of Traffic Mirror Filter IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Traffic Mirror Filter name.
outputFile String
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. String
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
trafficMirrorFilterName Changes to this property will trigger replacement. String
The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.

getTrafficMirrorFilters Result

The following output properties are available:

Filters List<Pulumi.AliCloud.Vpc.Outputs.GetTrafficMirrorFiltersFilter>
A list of Vpc Traffic Mirror Filters. Each element contains the following attributes:
Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
Names List<string>
A list of Traffic Mirror Filter names.
NameRegex string
OutputFile string
Status string
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
TrafficMirrorFilterName string
The name of the filter.
Filters []GetTrafficMirrorFiltersFilter
A list of Vpc Traffic Mirror Filters. Each element contains the following attributes:
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
Names []string
A list of Traffic Mirror Filter names.
NameRegex string
OutputFile string
Status string
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
TrafficMirrorFilterName string
The name of the filter.
filters List<GetTrafficMirrorFiltersFilter>
A list of Vpc Traffic Mirror Filters. Each element contains the following attributes:
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
names List<String>
A list of Traffic Mirror Filter names.
nameRegex String
outputFile String
status String
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
trafficMirrorFilterName String
The name of the filter.
filters GetTrafficMirrorFiltersFilter[]
A list of Vpc Traffic Mirror Filters. Each element contains the following attributes:
id string
The provider-assigned unique ID for this managed resource.
ids string[]
names string[]
A list of Traffic Mirror Filter names.
nameRegex string
outputFile string
status string
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
trafficMirrorFilterName string
The name of the filter.
filters Sequence[GetTrafficMirrorFiltersFilter]
A list of Vpc Traffic Mirror Filters. Each element contains the following attributes:
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
names Sequence[str]
A list of Traffic Mirror Filter names.
name_regex str
output_file str
status str
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
traffic_mirror_filter_name str
The name of the filter.
filters List<Property Map>
A list of Vpc Traffic Mirror Filters. Each element contains the following attributes:
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
names List<String>
A list of Traffic Mirror Filter names.
nameRegex String
outputFile String
status String
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
trafficMirrorFilterName String
The name of the filter.

Supporting Types

GetTrafficMirrorFiltersFilter

Id This property is required. string
The ID of the Traffic Mirror Filter.
Status This property is required. string
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
TrafficMirrorFilterDescription This property is required. string
The description of the filter.
TrafficMirrorFilterId This property is required. string
The ID of the filter.
TrafficMirrorFilterName This property is required. string
The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
Id This property is required. string
The ID of the Traffic Mirror Filter.
Status This property is required. string
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
TrafficMirrorFilterDescription This property is required. string
The description of the filter.
TrafficMirrorFilterId This property is required. string
The ID of the filter.
TrafficMirrorFilterName This property is required. string
The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
id This property is required. String
The ID of the Traffic Mirror Filter.
status This property is required. String
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
trafficMirrorFilterDescription This property is required. String
The description of the filter.
trafficMirrorFilterId This property is required. String
The ID of the filter.
trafficMirrorFilterName This property is required. String
The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
id This property is required. string
The ID of the Traffic Mirror Filter.
status This property is required. string
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
trafficMirrorFilterDescription This property is required. string
The description of the filter.
trafficMirrorFilterId This property is required. string
The ID of the filter.
trafficMirrorFilterName This property is required. string
The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
id This property is required. str
The ID of the Traffic Mirror Filter.
status This property is required. str
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
traffic_mirror_filter_description This property is required. str
The description of the filter.
traffic_mirror_filter_id This property is required. str
The ID of the filter.
traffic_mirror_filter_name This property is required. str
The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
id This property is required. String
The ID of the Traffic Mirror Filter.
status This property is required. String
The state of the filter. Valid values:Creating, Created, Modifying and Deleting. Creating: The filter is being created. Created: The filter is created. Modifying: The filter is being modified. Deleting: The filter is being deleted.
trafficMirrorFilterDescription This property is required. String
The description of the filter.
trafficMirrorFilterId This property is required. String
The ID of the filter.
trafficMirrorFilterName This property is required. String
The name of the filter. The name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.