1. Registry
  2. Packages
  3. Alibaba Cloud Provider
  4. API Docs
  5. sls
  6. getMetricStores
Viewing docs for Alibaba Cloud v3.108.0
published on Thursday, Sep 17, 2026 by Pulumi
alicloud logo alicloud logo
Viewing docs for Alibaba Cloud v3.108.0
published on Thursday, Sep 17, 2026 by Pulumi

    This data source provides the SLS MetricStores of the current Alibaba Cloud user.

    NOTE: Available since v1.291.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const _default = alicloud.sls.getMetricStores({
        projectName: "your-project-name",
        nameRegex: ".*",
    });
    export const firstMetricStoreName = _default.then(_default => _default.names?.[0]);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default = alicloud.sls.get_metric_stores(project_name="your-project-name",
        name_regex=".*")
    pulumi.export("firstMetricStoreName", default.names[0])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/sls"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := sls.GetMetricStores(ctx, &sls.GetMetricStoresArgs{
    			ProjectName: "your-project-name",
    			NameRegex:   pulumi.StringRef(".*"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("firstMetricStoreName", _default.Names[0])
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var @default = AliCloud.Sls.GetMetricStores.Invoke(new()
        {
            ProjectName = "your-project-name",
            NameRegex = ".*",
        });
    
        return new Dictionary<string, object?>
        {
            ["firstMetricStoreName"] = @default.Apply(@default => @default.Apply(getMetricStoresResult => getMetricStoresResult.Names[0])),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.sls.SlsFunctions;
    import com.pulumi.alicloud.sls.inputs.GetMetricStoresArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            final var default = SlsFunctions.getMetricStores(GetMetricStoresArgs.builder()
                .projectName("your-project-name")
                .nameRegex(".*")
                .build());
    
            ctx.export("firstMetricStoreName", default_.names()[0]);
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    variables:
      default:
        fn::invoke:
          function: alicloud:sls:getMetricStores
          arguments:
            projectName: your-project-name
            nameRegex: .*
    outputs:
      firstMetricStoreName: ${default.names[0]}
    
    pulumi {
      required_providers {
        alicloud = {
          source = "pulumi/alicloud"
        }
      }
    }
    
    data "alicloud_sls_getmetricstores" "default" {
      project_name = "your-project-name"
      name_regex   = ".*"
    }
    
    variable "name" {
      type    = string
      default = "terraform-example"
    }
    output "firstMetricStoreName" {
      value = data.alicloud_sls_getmetricstores.default.names[0]
    }
    

    Using getMetricStores

    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 getMetricStores(args: GetMetricStoresArgs, opts?: InvokeOptions): Promise<GetMetricStoresResult>
    function getMetricStoresOutput(args: GetMetricStoresOutputArgs, opts?: InvokeOutputOptions): Output<GetMetricStoresResult>
    def get_metric_stores(ids: Optional[Sequence[str]] = None,
                          name_regex: Optional[str] = None,
                          output_file: Optional[str] = None,
                          project_name: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetMetricStoresResult
    def get_metric_stores_output(ids: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
                          name_regex: pulumi.Input[Optional[str]] = None,
                          output_file: pulumi.Input[Optional[str]] = None,
                          project_name: pulumi.Input[Optional[str]] = None,
                          opts: Optional[InvokeOutputOptions] = None) -> Output[GetMetricStoresResult]
    func GetMetricStores(ctx *Context, args *GetMetricStoresArgs, opts ...InvokeOption) (*GetMetricStoresResult, error)
    func GetMetricStoresOutput(ctx *Context, args *GetMetricStoresOutputArgs, opts ...InvokeOption) GetMetricStoresResultOutput

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

    public static class GetMetricStores 
    {
        public static Task<GetMetricStoresResult> InvokeAsync(GetMetricStoresArgs args, InvokeOptions? opts = null)
        public static Output<GetMetricStoresResult> Invoke(GetMetricStoresInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetMetricStoresResult> Invoke(GetMetricStoresInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetMetricStoresResult> getMetricStores(GetMetricStoresArgs args, InvokeOptions options)
    public static Output<GetMetricStoresResult> getMetricStores(GetMetricStoresArgs args, InvokeOptions options)
    public static Output<GetMetricStoresResult> getMetricStores(GetMetricStoresArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: alicloud:sls/getMetricStores:getMetricStores
      arguments:
        # arguments dictionary
    data "alicloud_sls_get_metric_stores" "name" {
        # arguments
    }

    The following arguments are supported:

    ProjectName string
    The name of the SLS project.
    Ids List<string>
    A list of MetricStore names to filter results.
    NameRegex string
    A regex string to apply to the MetricStore name.
    OutputFile string
    File name where to save data source results (after running pulumi up).
    ProjectName string
    The name of the SLS project.
    Ids []string
    A list of MetricStore names to filter results.
    NameRegex string
    A regex string to apply to the MetricStore name.
    OutputFile string
    File name where to save data source results (after running pulumi up).
    project_name string
    The name of the SLS project.
    ids list(string)
    A list of MetricStore names to filter results.
    name_regex string
    A regex string to apply to the MetricStore name.
    output_file string
    File name where to save data source results (after running pulumi up).
    projectName String
    The name of the SLS project.
    ids List<String>
    A list of MetricStore names to filter results.
    nameRegex String
    A regex string to apply to the MetricStore name.
    outputFile String
    File name where to save data source results (after running pulumi up).
    projectName string
    The name of the SLS project.
    ids string[]
    A list of MetricStore names to filter results.
    nameRegex string
    A regex string to apply to the MetricStore name.
    outputFile string
    File name where to save data source results (after running pulumi up).
    project_name str
    The name of the SLS project.
    ids Sequence[str]
    A list of MetricStore names to filter results.
    name_regex str
    A regex string to apply to the MetricStore name.
    output_file str
    File name where to save data source results (after running pulumi up).
    projectName String
    The name of the SLS project.
    ids List<String>
    A list of MetricStore names to filter results.
    nameRegex String
    A regex string to apply to the MetricStore name.
    outputFile String
    File name where to save data source results (after running pulumi up).

    getMetricStores Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    MetricStores List<Pulumi.AliCloud.Sls.Outputs.GetMetricStoresMetricStore>
    A list of MetricStores. Each element contains the following attributes:
    Names List<string>
    A list of MetricStore names.
    ProjectName string
    NameRegex string
    OutputFile string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    MetricStores []GetMetricStoresMetricStore
    A list of MetricStores. Each element contains the following attributes:
    Names []string
    A list of MetricStore names.
    ProjectName string
    NameRegex string
    OutputFile string
    id string
    The provider-assigned unique ID for this managed resource.
    ids list(string)
    metric_stores list(object)
    A list of MetricStores. Each element contains the following attributes:
    names list(string)
    A list of MetricStore names.
    project_name string
    name_regex string
    output_file string
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    metricStores List<GetMetricStoresMetricStore>
    A list of MetricStores. Each element contains the following attributes:
    names List<String>
    A list of MetricStore names.
    projectName String
    nameRegex String
    outputFile String
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    metricStores GetMetricStoresMetricStore[]
    A list of MetricStores. Each element contains the following attributes:
    names string[]
    A list of MetricStore names.
    projectName string
    nameRegex string
    outputFile string
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    metric_stores Sequence[GetMetricStoresMetricStore]
    A list of MetricStores. Each element contains the following attributes:
    names Sequence[str]
    A list of MetricStore names.
    project_name str
    name_regex str
    output_file str
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    metricStores List<Property Map>
    A list of MetricStores. Each element contains the following attributes:
    names List<String>
    A list of MetricStore names.
    projectName String
    nameRegex String
    outputFile String

    Supporting Types

    GetMetricStoresMetricStore

    AppendMeta bool
    Whether to record the IP address of the requester.
    AutoSplit bool
    Whether automatic shard splitting is enabled.
    CreateTime int
    The time when the MetricStore was created.
    HotTtl int
    The data retention period in the hot storage tier, in days.
    Id string
    The ID of the MetricStore. The value is formatted as <project_name>:<metric_store_name>.
    LastModifyTime int
    The time when the MetricStore was last modified.
    MaxSplitShardCount int
    The maximum number of shards to split.
    MetricStoreName string
    The name of the MetricStore.
    Mode string
    The type of the MetricStore.
    ShardCount int
    The number of shards.
    Ttl int
    The data retention period in days.
    AppendMeta bool
    Whether to record the IP address of the requester.
    AutoSplit bool
    Whether automatic shard splitting is enabled.
    CreateTime int
    The time when the MetricStore was created.
    HotTtl int
    The data retention period in the hot storage tier, in days.
    Id string
    The ID of the MetricStore. The value is formatted as <project_name>:<metric_store_name>.
    LastModifyTime int
    The time when the MetricStore was last modified.
    MaxSplitShardCount int
    The maximum number of shards to split.
    MetricStoreName string
    The name of the MetricStore.
    Mode string
    The type of the MetricStore.
    ShardCount int
    The number of shards.
    Ttl int
    The data retention period in days.
    append_meta bool
    Whether to record the IP address of the requester.
    auto_split bool
    Whether automatic shard splitting is enabled.
    create_time number
    The time when the MetricStore was created.
    hot_ttl number
    The data retention period in the hot storage tier, in days.
    id string
    The ID of the MetricStore. The value is formatted as <project_name>:<metric_store_name>.
    last_modify_time number
    The time when the MetricStore was last modified.
    max_split_shard_count number
    The maximum number of shards to split.
    metric_store_name string
    The name of the MetricStore.
    mode string
    The type of the MetricStore.
    shard_count number
    The number of shards.
    ttl number
    The data retention period in days.
    appendMeta Boolean
    Whether to record the IP address of the requester.
    autoSplit Boolean
    Whether automatic shard splitting is enabled.
    createTime Integer
    The time when the MetricStore was created.
    hotTtl Integer
    The data retention period in the hot storage tier, in days.
    id String
    The ID of the MetricStore. The value is formatted as <project_name>:<metric_store_name>.
    lastModifyTime Integer
    The time when the MetricStore was last modified.
    maxSplitShardCount Integer
    The maximum number of shards to split.
    metricStoreName String
    The name of the MetricStore.
    mode String
    The type of the MetricStore.
    shardCount Integer
    The number of shards.
    ttl Integer
    The data retention period in days.
    appendMeta boolean
    Whether to record the IP address of the requester.
    autoSplit boolean
    Whether automatic shard splitting is enabled.
    createTime number
    The time when the MetricStore was created.
    hotTtl number
    The data retention period in the hot storage tier, in days.
    id string
    The ID of the MetricStore. The value is formatted as <project_name>:<metric_store_name>.
    lastModifyTime number
    The time when the MetricStore was last modified.
    maxSplitShardCount number
    The maximum number of shards to split.
    metricStoreName string
    The name of the MetricStore.
    mode string
    The type of the MetricStore.
    shardCount number
    The number of shards.
    ttl number
    The data retention period in days.
    append_meta bool
    Whether to record the IP address of the requester.
    auto_split bool
    Whether automatic shard splitting is enabled.
    create_time int
    The time when the MetricStore was created.
    hot_ttl int
    The data retention period in the hot storage tier, in days.
    id str
    The ID of the MetricStore. The value is formatted as <project_name>:<metric_store_name>.
    last_modify_time int
    The time when the MetricStore was last modified.
    max_split_shard_count int
    The maximum number of shards to split.
    metric_store_name str
    The name of the MetricStore.
    mode str
    The type of the MetricStore.
    shard_count int
    The number of shards.
    ttl int
    The data retention period in days.
    appendMeta Boolean
    Whether to record the IP address of the requester.
    autoSplit Boolean
    Whether automatic shard splitting is enabled.
    createTime Number
    The time when the MetricStore was created.
    hotTtl Number
    The data retention period in the hot storage tier, in days.
    id String
    The ID of the MetricStore. The value is formatted as <project_name>:<metric_store_name>.
    lastModifyTime Number
    The time when the MetricStore was last modified.
    maxSplitShardCount Number
    The maximum number of shards to split.
    metricStoreName String
    The name of the MetricStore.
    mode String
    The type of the MetricStore.
    shardCount Number
    The number of shards.
    ttl Number
    The data retention period in days.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo alicloud logo
    Viewing docs for Alibaba Cloud v3.108.0
    published on Thursday, Sep 17, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial