Alibaba Cloud v3.88.0 published on Saturday, Nov 1, 2025 by Pulumi
alicloud.sls.getIndexs
Start a Neo task
Explain and create an alicloud.sls.getIndexs resource
This data source provides Sls Index available to the user.What is Index
NOTE: Available since v1.262.0.
Example 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 logstoreName = config.get("logstoreName") || "logstore-example-1";
const projectName = config.get("projectName") || "project-for-index-terraform-example-1";
const defaultProject = new alicloud.log.Project("default", {
description: "terraform example",
projectName: projectName,
});
const defaultStore = new alicloud.log.Store("default", {
hotTtl: 7,
retentionPeriod: 30,
shardCount: 2,
projectName: defaultProject.projectName,
logstoreName: logstoreName,
});
const defaultIndex = new alicloud.sls.Index("default", {
line: {
chn: true,
caseSensitive: true,
tokens: ["a"],
excludeKeys: ["t"],
},
keys: JSON.stringify({
example: {
caseSensitive: false,
token: [
"\n",
"\x09",
",",
" ",
";",
"\"",
"'",
"(",
")",
"{",
"}",
"[",
"]",
"<",
">",
"?",
"/",
"#",
":",
],
type: "text",
doc_value: false,
alias: "",
chn: false,
},
}),
logstoreName: defaultStore.logstoreName,
projectName: projectName,
});
const _default = alicloud.sls.getIndexsOutput({
logstoreName: defaultStore.logstoreName,
projectName: defaultProject.projectName,
});
export const alicloudSlsIndexExampleId = _default.apply(_default => _default.indexs?.[0]?.id);
import pulumi
import json
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
logstore_name = config.get("logstoreName")
if logstore_name is None:
logstore_name = "logstore-example-1"
project_name = config.get("projectName")
if project_name is None:
project_name = "project-for-index-terraform-example-1"
default_project = alicloud.log.Project("default",
description="terraform example",
project_name=project_name)
default_store = alicloud.log.Store("default",
hot_ttl=7,
retention_period=30,
shard_count=2,
project_name=default_project.project_name,
logstore_name=logstore_name)
default_index = alicloud.sls.Index("default",
line={
"chn": True,
"case_sensitive": True,
"tokens": ["a"],
"exclude_keys": ["t"],
},
keys=json.dumps({
"example": {
"caseSensitive": False,
"token": [
"\n",
"\x09",
",",
" ",
";",
"\"",
"'",
"(",
")",
"{",
"}",
"[",
"]",
"<",
">",
"?",
"/",
"#",
":",
],
"type": "text",
"doc_value": False,
"alias": "",
"chn": False,
},
}),
logstore_name=default_store.logstore_name,
project_name=project_name)
default = alicloud.sls.get_indexs_output(logstore_name=default_store.logstore_name,
project_name=default_project.project_name)
pulumi.export("alicloudSlsIndexExampleId", default.indexs[0].id)
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/log"
"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
}
logstoreName := "logstore-example-1";
if param := cfg.Get("logstoreName"); param != ""{
logstoreName = param
}
projectName := "project-for-index-terraform-example-1";
if param := cfg.Get("projectName"); param != ""{
projectName = param
}
defaultProject, err := log.NewProject(ctx, "default", &log.ProjectArgs{
Description: pulumi.String("terraform example"),
ProjectName: pulumi.String(projectName),
})
if err != nil {
return err
}
defaultStore, err := log.NewStore(ctx, "default", &log.StoreArgs{
HotTtl: pulumi.Int(7),
RetentionPeriod: pulumi.Int(30),
ShardCount: pulumi.Int(2),
ProjectName: defaultProject.ProjectName,
LogstoreName: pulumi.String(logstoreName),
})
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string]interface{}{
"example": map[string]interface{}{
"caseSensitive": false,
"token": []string{
"\n",
" ",
",",
" ",
";",
"\"",
"'",
"(",
")",
"{",
"}",
"[",
"]",
"<",
">",
"?",
"/",
"#",
":",
},
"type": "text",
"doc_value": false,
"alias": "",
"chn": false,
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = sls.NewIndex(ctx, "default", &sls.IndexArgs{
Line: &sls.IndexLineArgs{
Chn: pulumi.Bool(true),
CaseSensitive: pulumi.Bool(true),
Tokens: pulumi.StringArray{
pulumi.String("a"),
},
ExcludeKeys: pulumi.StringArray{
pulumi.String("t"),
},
},
Keys: pulumi.String(json0),
LogstoreName: defaultStore.LogstoreName,
ProjectName: pulumi.String(projectName),
})
if err != nil {
return err
}
_default := sls.GetIndexsOutput(ctx, sls.GetIndexsOutputArgs{
LogstoreName: defaultStore.LogstoreName,
ProjectName: defaultProject.ProjectName,
}, nil);
ctx.Export("alicloudSlsIndexExampleId", _default.ApplyT(func(_default sls.GetIndexsResult) (*string, error) {
return &default.Indexs[0].Id, nil
}).(pulumi.StringPtrOutput))
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var logstoreName = config.Get("logstoreName") ?? "logstore-example-1";
var projectName = config.Get("projectName") ?? "project-for-index-terraform-example-1";
var defaultProject = new AliCloud.Log.Project("default", new()
{
Description = "terraform example",
ProjectName = projectName,
});
var defaultStore = new AliCloud.Log.Store("default", new()
{
HotTtl = 7,
RetentionPeriod = 30,
ShardCount = 2,
ProjectName = defaultProject.ProjectName,
LogstoreName = logstoreName,
});
var defaultIndex = new AliCloud.Sls.Index("default", new()
{
Line = new AliCloud.Sls.Inputs.IndexLineArgs
{
Chn = true,
CaseSensitive = true,
Tokens = new[]
{
"a",
},
ExcludeKeys = new[]
{
"t",
},
},
Keys = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["example"] = new Dictionary<string, object?>
{
["caseSensitive"] = false,
["token"] = new[]
{
@"
",
" ",
",",
" ",
";",
"\"",
"'",
"(",
")",
"{",
"}",
"[",
"]",
"<",
">",
"?",
"/",
"#",
":",
},
["type"] = "text",
["doc_value"] = false,
["alias"] = "",
["chn"] = false,
},
}),
LogstoreName = defaultStore.LogstoreName,
ProjectName = projectName,
});
var @default = AliCloud.Sls.GetIndexs.Invoke(new()
{
LogstoreName = defaultStore.LogstoreName,
ProjectName = defaultProject.ProjectName,
});
return new Dictionary<string, object?>
{
["alicloudSlsIndexExampleId"] = @default.Apply(@default => @default.Apply(getIndexsResult => getIndexsResult.Indexs[0]?.Id)),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.log.Project;
import com.pulumi.alicloud.log.ProjectArgs;
import com.pulumi.alicloud.log.Store;
import com.pulumi.alicloud.log.StoreArgs;
import com.pulumi.alicloud.sls.Index;
import com.pulumi.alicloud.sls.IndexArgs;
import com.pulumi.alicloud.sls.inputs.IndexLineArgs;
import com.pulumi.alicloud.sls.SlsFunctions;
import com.pulumi.alicloud.sls.inputs.GetIndexsArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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 config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
final var logstoreName = config.get("logstoreName").orElse("logstore-example-1");
final var projectName = config.get("projectName").orElse("project-for-index-terraform-example-1");
var defaultProject = new Project("defaultProject", ProjectArgs.builder()
.description("terraform example")
.projectName(projectName)
.build());
var defaultStore = new Store("defaultStore", StoreArgs.builder()
.hotTtl(7)
.retentionPeriod(30)
.shardCount(2)
.projectName(defaultProject.projectName())
.logstoreName(logstoreName)
.build());
var defaultIndex = new Index("defaultIndex", IndexArgs.builder()
.line(IndexLineArgs.builder()
.chn(true)
.caseSensitive(true)
.tokens("a")
.excludeKeys("t")
.build())
.keys(serializeJson(
jsonObject(
jsonProperty("example", jsonObject(
jsonProperty("caseSensitive", false),
jsonProperty("token", jsonArray(
"""
""",
" ",
",",
" ",
";",
"\"",
"'",
"(",
")",
"{",
"}",
"[",
"]",
"<",
">",
"?",
"/",
"#",
":"
)),
jsonProperty("type", "text"),
jsonProperty("doc_value", false),
jsonProperty("alias", ""),
jsonProperty("chn", false)
))
)))
.logstoreName(defaultStore.logstoreName())
.projectName(projectName)
.build());
final var default = SlsFunctions.getIndexs(GetIndexsArgs.builder()
.logstoreName(defaultStore.logstoreName())
.projectName(defaultProject.projectName())
.build());
ctx.export("alicloudSlsIndexExampleId", default_.applyValue(_default_ -> _default_.indexs()[0].id()));
}
}
configuration:
name:
type: string
default: terraform-example
logstoreName:
type: string
default: logstore-example-1
projectName:
type: string
default: project-for-index-terraform-example-1
resources:
defaultProject:
type: alicloud:log:Project
name: default
properties:
description: terraform example
projectName: ${projectName}
defaultStore:
type: alicloud:log:Store
name: default
properties:
hotTtl: '7'
retentionPeriod: '30'
shardCount: '2'
projectName: ${defaultProject.projectName}
logstoreName: ${logstoreName}
defaultIndex:
type: alicloud:sls:Index
name: default
properties:
line:
chn: 'true'
caseSensitive: 'true'
tokens:
- a
excludeKeys:
- t
keys:
fn::toJSON:
example:
caseSensitive: false
token:
- |2+
- "\t"
- ','
- ' '
- ;
- '"'
- ''''
- (
- )
- '{'
- '}'
- '['
- ']'
- <
- '>'
- '?'
- /
- '#'
- ':'
type: text
doc_value: false
alias: ""
chn: false
logstoreName: ${defaultStore.logstoreName}
projectName: ${projectName}
variables:
default:
fn::invoke:
function: alicloud:sls:getIndexs
arguments:
logstoreName: ${defaultStore.logstoreName}
projectName: ${defaultProject.projectName}
outputs:
alicloudSlsIndexExampleId: ${default.indexs[0].id}
Using getIndexs
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 getIndexs(args: GetIndexsArgs, opts?: InvokeOptions): Promise<GetIndexsResult>
function getIndexsOutput(args: GetIndexsOutputArgs, opts?: InvokeOptions): Output<GetIndexsResult>def get_indexs(ids: Optional[Sequence[str]] = None,
logstore_name: Optional[str] = None,
output_file: Optional[str] = None,
project_name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetIndexsResult
def get_indexs_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
logstore_name: Optional[pulumi.Input[str]] = None,
output_file: Optional[pulumi.Input[str]] = None,
project_name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetIndexsResult]func GetIndexs(ctx *Context, args *GetIndexsArgs, opts ...InvokeOption) (*GetIndexsResult, error)
func GetIndexsOutput(ctx *Context, args *GetIndexsOutputArgs, opts ...InvokeOption) GetIndexsResultOutput> Note: This function is named GetIndexs in the Go SDK.
public static class GetIndexs
{
public static Task<GetIndexsResult> InvokeAsync(GetIndexsArgs args, InvokeOptions? opts = null)
public static Output<GetIndexsResult> Invoke(GetIndexsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetIndexsResult> getIndexs(GetIndexsArgs args, InvokeOptions options)
public static Output<GetIndexsResult> getIndexs(GetIndexsArgs args, InvokeOptions options)
fn::invoke:
function: alicloud:sls/getIndexs:getIndexs
arguments:
# arguments dictionaryThe following arguments are supported:
- Logstore
Name string - Logstore name
- Project
Name string - Project name
- Ids List<string>
- A list of Index IDs. The value is formulated as
<project_name>:<logstore_name>. - Output
File string - File name where to save data source results (after running
pulumi preview).
- Logstore
Name string - Logstore name
- Project
Name string - Project name
- Ids []string
- A list of Index IDs. The value is formulated as
<project_name>:<logstore_name>. - Output
File string - File name where to save data source results (after running
pulumi preview).
- logstore
Name String - Logstore name
- project
Name String - Project name
- ids List<String>
- A list of Index IDs. The value is formulated as
<project_name>:<logstore_name>. - output
File String - File name where to save data source results (after running
pulumi preview).
- logstore
Name string - Logstore name
- project
Name string - Project name
- ids string[]
- A list of Index IDs. The value is formulated as
<project_name>:<logstore_name>. - output
File string - File name where to save data source results (after running
pulumi preview).
- logstore_
name str - Logstore name
- project_
name str - Project name
- ids Sequence[str]
- A list of Index IDs. The value is formulated as
<project_name>:<logstore_name>. - output_
file str - File name where to save data source results (after running
pulumi preview).
- logstore
Name String - Logstore name
- project
Name String - Project name
- ids List<String>
- A list of Index IDs. The value is formulated as
<project_name>:<logstore_name>. - output
File String - File name where to save data source results (after running
pulumi preview).
getIndexs Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- A list of Index IDs.
- Indexs
List<Pulumi.
Ali Cloud. Sls. Outputs. Get Indexs Index> - A list of Index Entries. Each element contains the following attributes:
- Logstore
Name string - Project
Name string - Output
File string
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- A list of Index IDs.
- Indexs
[]Get
Indexs Index - A list of Index Entries. Each element contains the following attributes:
- Logstore
Name string - Project
Name string - Output
File string
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of Index IDs.
- indexs
List<Get
Indexs Index> - A list of Index Entries. Each element contains the following attributes:
- logstore
Name String - project
Name String - output
File String
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- A list of Index IDs.
- indexs
Get
Indexs Index[] - A list of Index Entries. Each element contains the following attributes:
- logstore
Name string - project
Name string - output
File string
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- A list of Index IDs.
- indexs
Sequence[Get
Indexs Index] - A list of Index Entries. Each element contains the following attributes:
- logstore_
name str - project_
name str - output_
file str
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of Index IDs.
- indexs List<Property Map>
- A list of Index Entries. Each element contains the following attributes:
- logstore
Name String - project
Name String - output
File String
Supporting Types
GetIndexsIndex
- Id string
- The ID of the resource supplied above.
- Keys string
- Field index
- Line
Pulumi.
Ali Cloud. Sls. Inputs. Get Indexs Index Line - Full-text index
- Log
Reduce List<string>Black Lists - The blacklist of the cluster fields of log clustering is filtered only when log clustering is enabled.
- Log
Reduce List<string>White Lists - The whitelist of the cluster fields for log clustering. This filter is valid only when log clustering is enabled.
- Max
Text intLen - Maximum length of statistical field
- Ttl int
- Log index storage time
- Id string
- The ID of the resource supplied above.
- Keys string
- Field index
- Line
Get
Indexs Index Line - Full-text index
- Log
Reduce []stringBlack Lists - The blacklist of the cluster fields of log clustering is filtered only when log clustering is enabled.
- Log
Reduce []stringWhite Lists - The whitelist of the cluster fields for log clustering. This filter is valid only when log clustering is enabled.
- Max
Text intLen - Maximum length of statistical field
- Ttl int
- Log index storage time
- id String
- The ID of the resource supplied above.
- keys String
- Field index
- line
Get
Indexs Index Line - Full-text index
- log
Reduce List<String>Black Lists - The blacklist of the cluster fields of log clustering is filtered only when log clustering is enabled.
- log
Reduce List<String>White Lists - The whitelist of the cluster fields for log clustering. This filter is valid only when log clustering is enabled.
- max
Text IntegerLen - Maximum length of statistical field
- ttl Integer
- Log index storage time
- id string
- The ID of the resource supplied above.
- keys string
- Field index
- line
Get
Indexs Index Line - Full-text index
- log
Reduce string[]Black Lists - The blacklist of the cluster fields of log clustering is filtered only when log clustering is enabled.
- log
Reduce string[]White Lists - The whitelist of the cluster fields for log clustering. This filter is valid only when log clustering is enabled.
- max
Text numberLen - Maximum length of statistical field
- ttl number
- Log index storage time
- id str
- The ID of the resource supplied above.
- keys str
- Field index
- line
Get
Indexs Index Line - Full-text index
- log_
reduce_ Sequence[str]black_ lists - The blacklist of the cluster fields of log clustering is filtered only when log clustering is enabled.
- log_
reduce_ Sequence[str]white_ lists - The whitelist of the cluster fields for log clustering. This filter is valid only when log clustering is enabled.
- max_
text_ intlen - Maximum length of statistical field
- ttl int
- Log index storage time
- id String
- The ID of the resource supplied above.
- keys String
- Field index
- line Property Map
- Full-text index
- log
Reduce List<String>Black Lists - The blacklist of the cluster fields of log clustering is filtered only when log clustering is enabled.
- log
Reduce List<String>White Lists - The whitelist of the cluster fields for log clustering. This filter is valid only when log clustering is enabled.
- max
Text NumberLen - Maximum length of statistical field
- ttl Number
- Log index storage time
GetIndexsIndexLine
- Case
Sensitive bool - Is case sensitive.
- Chn bool
- Does it include Chinese.
- Exclude
Keys List<string> - List of excluded fields.
- Include
Keys List<string> - Include field list.
- Tokens List<string>
- Delimiter.
- Case
Sensitive bool - Is case sensitive.
- Chn bool
- Does it include Chinese.
- Exclude
Keys []string - List of excluded fields.
- Include
Keys []string - Include field list.
- Tokens []string
- Delimiter.
- case
Sensitive Boolean - Is case sensitive.
- chn Boolean
- Does it include Chinese.
- exclude
Keys List<String> - List of excluded fields.
- include
Keys List<String> - Include field list.
- tokens List<String>
- Delimiter.
- case
Sensitive boolean - Is case sensitive.
- chn boolean
- Does it include Chinese.
- exclude
Keys string[] - List of excluded fields.
- include
Keys string[] - Include field list.
- tokens string[]
- Delimiter.
- case_
sensitive bool - Is case sensitive.
- chn bool
- Does it include Chinese.
- exclude_
keys Sequence[str] - List of excluded fields.
- include_
keys Sequence[str] - Include field list.
- tokens Sequence[str]
- Delimiter.
- case
Sensitive Boolean - Is case sensitive.
- chn Boolean
- Does it include Chinese.
- exclude
Keys List<String> - List of excluded fields.
- include
Keys List<String> - Include field list.
- tokens List<String>
- Delimiter.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloudTerraform Provider.
