Store
Provides a SLS Log Store resource. For information about SLS Log Store and how to use it, see What is Log Store.
NOTE: Available since v1.0.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const _default = new random.index.Integer("default", {
max: 99999,
min: 10000,
});
const example = new alicloud.log.Project("example", {
name: `terraform-example-${_default.result}`,
description: "terraform-example",
});
const exampleStore = new alicloud.log.Store("example", {
project: example.name,
name: "example-store",
shardCount: 3,
autoSplit: true,
maxSplitShardCount: 60,
appendMeta: true,
});Content copied to clipboard
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
default = random.index.Integer("default",
max=99999,
min=10000)
example = alicloud.log.Project("example",
name=f"terraform-example-{default['result']}",
description="terraform-example")
example_store = alicloud.log.Store("example",
project=example.name,
name="example-store",
shard_count=3,
auto_split=True,
max_split_shard_count=60,
append_meta=True)Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var @default = new Random.Index.Integer("default", new()
{
Max = 99999,
Min = 10000,
});
var example = new AliCloud.Log.Project("example", new()
{
Name = $"terraform-example-{@default.Result}",
Description = "terraform-example",
});
var exampleStore = new AliCloud.Log.Store("example", new()
{
Project = example.Name,
Name = "example-store",
ShardCount = 3,
AutoSplit = true,
MaxSplitShardCount = 60,
AppendMeta = true,
});
});Content copied to clipboard
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/log"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
Max: 99999,
Min: 10000,
})
if err != nil {
return err
}
example, err := log.NewProject(ctx, "example", &log.ProjectArgs{
Name: pulumi.String(fmt.Sprintf("terraform-example-%v", _default.Result)),
Description: pulumi.String("terraform-example"),
})
if err != nil {
return err
}
_, err = log.NewStore(ctx, "example", &log.StoreArgs{
Project: example.Name,
Name: pulumi.String("example-store"),
ShardCount: pulumi.Int(3),
AutoSplit: pulumi.Bool(true),
MaxSplitShardCount: pulumi.Int(60),
AppendMeta: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.integer;
import com.pulumi.random.IntegerArgs;
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 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) {
var default_ = new Integer("default", IntegerArgs.builder()
.max(99999)
.min(10000)
.build());
var example = new Project("example", ProjectArgs.builder()
.name(String.format("terraform-example-%s", default_.result()))
.description("terraform-example")
.build());
var exampleStore = new Store("exampleStore", StoreArgs.builder()
.project(example.name())
.name("example-store")
.shardCount(3)
.autoSplit(true)
.maxSplitShardCount(60)
.appendMeta(true)
.build());
}
}Content copied to clipboard
resources:
default:
type: random:integer
properties:
max: 99999
min: 10000
example:
type: alicloud:log:Project
properties:
name: terraform-example-${default.result}
description: terraform-example
exampleStore:
type: alicloud:log:Store
name: example
properties:
project: ${example.name}
name: example-store
shardCount: 3
autoSplit: true
maxSplitShardCount: 60
appendMeta: trueContent copied to clipboard
Encrypt Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const config = new pulumi.Config();
// The region of kms key.
const region = config.get("region") || "cn-hangzhou";
const example = alicloud.getAccount({});
const _default = new random.index.Integer("default", {
max: 99999,
min: 10000,
});
const exampleKey = new alicloud.kms.Key("example", {
description: "terraform-example",
pendingWindowInDays: 7,
status: "Enabled",
});
const exampleProject = new alicloud.log.Project("example", {
name: `terraform-example-${_default.result}`,
description: "terraform-example",
});
const exampleStore = new alicloud.log.Store("example", {
project: exampleProject.name,
name: "example-store",
shardCount: 1,
autoSplit: true,
maxSplitShardCount: 60,
encryptConf: {
enable: true,
encryptType: "default",
userCmkInfo: {
cmkKeyId: exampleKey.id,
arn: example.then(example => `acs:ram::${example.id}:role/aliyunlogdefaultrole`),
regionId: region,
},
},
});Content copied to clipboard
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
config = pulumi.Config()
# The region of kms key.
region = config.get("region")
if region is None:
region = "cn-hangzhou"
example = alicloud.get_account()
default = random.index.Integer("default",
max=99999,
min=10000)
example_key = alicloud.kms.Key("example",
description="terraform-example",
pending_window_in_days=7,
status="Enabled")
example_project = alicloud.log.Project("example",
name=f"terraform-example-{default['result']}",
description="terraform-example")
example_store = alicloud.log.Store("example",
project=example_project.name,
name="example-store",
shard_count=1,
auto_split=True,
max_split_shard_count=60,
encrypt_conf=alicloud.log.StoreEncryptConfArgs(
enable=True,
encrypt_type="default",
user_cmk_info=alicloud.log.StoreEncryptConfUserCmkInfoArgs(
cmk_key_id=example_key.id,
arn=f"acs:ram::{example.id}:role/aliyunlogdefaultrole",
region_id=region,
),
))Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var config = new Config();
// The region of kms key.
var region = config.Get("region") ?? "cn-hangzhou";
var example = AliCloud.GetAccount.Invoke();
var @default = new Random.Index.Integer("default", new()
{
Max = 99999,
Min = 10000,
});
var exampleKey = new AliCloud.Kms.Key("example", new()
{
Description = "terraform-example",
PendingWindowInDays = 7,
Status = "Enabled",
});
var exampleProject = new AliCloud.Log.Project("example", new()
{
Name = $"terraform-example-{@default.Result}",
Description = "terraform-example",
});
var exampleStore = new AliCloud.Log.Store("example", new()
{
Project = exampleProject.Name,
Name = "example-store",
ShardCount = 1,
AutoSplit = true,
MaxSplitShardCount = 60,
EncryptConf = new AliCloud.Log.Inputs.StoreEncryptConfArgs
{
Enable = true,
EncryptType = "default",
UserCmkInfo = new AliCloud.Log.Inputs.StoreEncryptConfUserCmkInfoArgs
{
CmkKeyId = exampleKey.Id,
Arn = $"acs:ram::{example.Apply(getAccountResult => getAccountResult.Id)}:role/aliyunlogdefaultrole",
RegionId = region,
},
},
});
});Content copied to clipboard
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/kms"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/log"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"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, "")
// The region of kms key.
region := "cn-hangzhou"
if param := cfg.Get("region"); param != "" {
region = param
}
example, err := alicloud.GetAccount(ctx, nil, nil)
if err != nil {
return err
}
_, err = random.NewInteger(ctx, "default", &random.IntegerArgs{
Max: 99999,
Min: 10000,
})
if err != nil {
return err
}
exampleKey, err := kms.NewKey(ctx, "example", &kms.KeyArgs{
Description: pulumi.String("terraform-example"),
PendingWindowInDays: pulumi.Int(7),
Status: pulumi.String("Enabled"),
})
if err != nil {
return err
}
exampleProject, err := log.NewProject(ctx, "example", &log.ProjectArgs{
Name: pulumi.String(fmt.Sprintf("terraform-example-%v", _default.Result)),
Description: pulumi.String("terraform-example"),
})
if err != nil {
return err
}
_, err = log.NewStore(ctx, "example", &log.StoreArgs{
Project: exampleProject.Name,
Name: pulumi.String("example-store"),
ShardCount: pulumi.Int(1),
AutoSplit: pulumi.Bool(true),
MaxSplitShardCount: pulumi.Int(60),
EncryptConf: &log.StoreEncryptConfArgs{
Enable: pulumi.Bool(true),
EncryptType: pulumi.String("default"),
UserCmkInfo: &log.StoreEncryptConfUserCmkInfoArgs{
CmkKeyId: exampleKey.ID(),
Arn: pulumi.String(fmt.Sprintf("acs:ram::%v:role/aliyunlogdefaultrole", example.Id)),
RegionId: pulumi.String(region),
},
},
})
if err != nil {
return err
}
return nil
})
}Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.random.integer;
import com.pulumi.random.IntegerArgs;
import com.pulumi.alicloud.kms.Key;
import com.pulumi.alicloud.kms.KeyArgs;
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.log.inputs.StoreEncryptConfArgs;
import com.pulumi.alicloud.log.inputs.StoreEncryptConfUserCmkInfoArgs;
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 region = config.get("region").orElse("cn-hangzhou");
final var example = AlicloudFunctions.getAccount();
var default_ = new Integer("default", IntegerArgs.builder()
.max(99999)
.min(10000)
.build());
var exampleKey = new Key("exampleKey", KeyArgs.builder()
.description("terraform-example")
.pendingWindowInDays("7")
.status("Enabled")
.build());
var exampleProject = new Project("exampleProject", ProjectArgs.builder()
.name(String.format("terraform-example-%s", default_.result()))
.description("terraform-example")
.build());
var exampleStore = new Store("exampleStore", StoreArgs.builder()
.project(exampleProject.name())
.name("example-store")
.shardCount(1)
.autoSplit(true)
.maxSplitShardCount(60)
.encryptConf(StoreEncryptConfArgs.builder()
.enable(true)
.encryptType("default")
.userCmkInfo(StoreEncryptConfUserCmkInfoArgs.builder()
.cmkKeyId(exampleKey.id())
.arn(String.format("acs:ram::%s:role/aliyunlogdefaultrole", example.applyValue(getAccountResult -> getAccountResult.id())))
.regionId(region)
.build())
.build())
.build());
}
}Content copied to clipboard
configuration:
region:
type: string
default: cn-hangzhou
resources:
default:
type: random:integer
properties:
max: 99999
min: 10000
exampleKey:
type: alicloud:kms:Key
name: example
properties:
description: terraform-example
pendingWindowInDays: '7'
status: Enabled
exampleProject:
type: alicloud:log:Project
name: example
properties:
name: terraform-example-${default.result}
description: terraform-example
exampleStore:
type: alicloud:log:Store
name: example
properties:
project: ${exampleProject.name}
name: example-store
shardCount: 1
autoSplit: true
maxSplitShardCount: 60
encryptConf:
enable: true
encryptType: default
userCmkInfo:
cmkKeyId: ${exampleKey.id}
arn: acs:ram::${example.id}:role/aliyunlogdefaultrole
regionId: ${region}
variables:
example:
fn::invoke:
Function: alicloud:getAccount
Arguments: {}Content copied to clipboard
Module Support
You can use the existing sls module to create SLS project, store and store index one-click, like ECS instances.
Import
SLS Log Store can be imported using the id, e.g.
$ pulumi import alicloud:log/store:Store example <project_name>:<logstore_name>Content copied to clipboard
Properties
Link copied to clipboard
The number of shards in this log store. Default to 2. You can modify it by "Split" or "Merge" operations. Refer to details.
Link copied to clipboard