alicloud.cms.SlsGroup
Explore with Pulumi AI
Provides a Cloud Monitor Service Sls Group resource.
For information about Cloud Monitor Service Sls Group and how to use it, see What is Sls Group.
NOTE: Available since v1.171.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
import * as std from "@pulumi/std";
const config = new pulumi.Config();
const name = config.get("name") || "tf_example";
const _default = alicloud.getAccount({});
const defaultGetRegions = alicloud.getRegions({
current: true,
});
const defaultUuid = new random.index.Uuid("default", {});
const defaultProject = new alicloud.log.Project("default", {projectName: std.replace({
text: defaultUuid.result,
search: "-",
replace: "",
}).then(invoke => std.substr({
input: `tf-example-${invoke.result}`,
offset: 0,
length: 16,
})).then(invoke => invoke.result)});
const defaultStore = new alicloud.log.Store("default", {
projectName: defaultProject.projectName,
logstoreName: name,
shardCount: 3,
autoSplit: true,
maxSplitShardCount: 60,
appendMeta: true,
});
const defaultSlsGroup = new alicloud.cms.SlsGroup("default", {
slsGroupConfigs: [{
slsUserId: _default.then(_default => _default.id),
slsLogstore: defaultStore.logstoreName,
slsProject: defaultProject.projectName,
slsRegion: defaultGetRegions.then(defaultGetRegions => defaultGetRegions.regions?.[0]?.id),
}],
slsGroupDescription: name,
slsGroupName: name,
});
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
import pulumi_std as std
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf_example"
default = alicloud.get_account()
default_get_regions = alicloud.get_regions(current=True)
default_uuid = random.index.Uuid("default")
default_project = alicloud.log.Project("default", project_name=std.substr(input=f"tf-example-{std.replace(text=default_uuid['result'],
search='-',
replace='').result}",
offset=0,
length=16).result)
default_store = alicloud.log.Store("default",
project_name=default_project.project_name,
logstore_name=name,
shard_count=3,
auto_split=True,
max_split_shard_count=60,
append_meta=True)
default_sls_group = alicloud.cms.SlsGroup("default",
sls_group_configs=[{
"sls_user_id": default.id,
"sls_logstore": default_store.logstore_name,
"sls_project": default_project.project_name,
"sls_region": default_get_regions.regions[0].id,
}],
sls_group_description=name,
sls_group_name=name)
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cms"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/log"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi-std/sdk/go/std"
"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 := "tf_example"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := alicloud.GetAccount(ctx, map[string]interface{}{}, nil)
if err != nil {
return err
}
defaultGetRegions, err := alicloud.GetRegions(ctx, &alicloud.GetRegionsArgs{
Current: pulumi.BoolRef(true),
}, nil)
if err != nil {
return err
}
defaultUuid, err := random.NewUuid(ctx, "default", nil)
if err != nil {
return err
}
invokeSubstr, err := std.Substr(ctx, &std.SubstrArgs{
Input: fmt.Sprintf("tf-example-%v", std.Replace(ctx, &std.ReplaceArgs{
Text: defaultUuid.Result,
Search: "-",
Replace: "",
}, nil).Result),
Offset: 0,
Length: 16,
}, nil)
if err != nil {
return err
}
defaultProject, err := log.NewProject(ctx, "default", &log.ProjectArgs{
ProjectName: pulumi.String(invokeSubstr.Result),
})
if err != nil {
return err
}
defaultStore, err := log.NewStore(ctx, "default", &log.StoreArgs{
ProjectName: defaultProject.ProjectName,
LogstoreName: pulumi.String(name),
ShardCount: pulumi.Int(3),
AutoSplit: pulumi.Bool(true),
MaxSplitShardCount: pulumi.Int(60),
AppendMeta: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = cms.NewSlsGroup(ctx, "default", &cms.SlsGroupArgs{
SlsGroupConfigs: cms.SlsGroupSlsGroupConfigArray{
&cms.SlsGroupSlsGroupConfigArgs{
SlsUserId: pulumi.String(_default.Id),
SlsLogstore: defaultStore.LogstoreName,
SlsProject: defaultProject.ProjectName,
SlsRegion: pulumi.String(defaultGetRegions.Regions[0].Id),
},
},
SlsGroupDescription: pulumi.String(name),
SlsGroupName: pulumi.String(name),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "tf_example";
var @default = AliCloud.GetAccount.Invoke();
var defaultGetRegions = AliCloud.GetRegions.Invoke(new()
{
Current = true,
});
var defaultUuid = new Random.Index.Uuid("default");
var defaultProject = new AliCloud.Log.Project("default", new()
{
ProjectName = Std.Replace.Invoke(new()
{
Text = defaultUuid.Result,
Search = "-",
Replace = "",
}).Apply(invoke => Std.Substr.Invoke(new()
{
Input = $"tf-example-{invoke.Result}",
Offset = 0,
Length = 16,
})).Apply(invoke => invoke.Result),
});
var defaultStore = new AliCloud.Log.Store("default", new()
{
ProjectName = defaultProject.ProjectName,
LogstoreName = name,
ShardCount = 3,
AutoSplit = true,
MaxSplitShardCount = 60,
AppendMeta = true,
});
var defaultSlsGroup = new AliCloud.Cms.SlsGroup("default", new()
{
SlsGroupConfigs = new[]
{
new AliCloud.Cms.Inputs.SlsGroupSlsGroupConfigArgs
{
SlsUserId = @default.Apply(@default => @default.Apply(getAccountResult => getAccountResult.Id)),
SlsLogstore = defaultStore.LogstoreName,
SlsProject = defaultProject.ProjectName,
SlsRegion = defaultGetRegions.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id),
},
},
SlsGroupDescription = name,
SlsGroupName = name,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.inputs.GetRegionsArgs;
import com.pulumi.random.Uuid;
import com.pulumi.alicloud.log.Project;
import com.pulumi.alicloud.log.ProjectArgs;
import com.pulumi.std.StdFunctions;
import com.pulumi.std.inputs.ReplaceArgs;
import com.pulumi.std.inputs.SubstrArgs;
import com.pulumi.alicloud.log.Store;
import com.pulumi.alicloud.log.StoreArgs;
import com.pulumi.alicloud.cms.SlsGroup;
import com.pulumi.alicloud.cms.SlsGroupArgs;
import com.pulumi.alicloud.cms.inputs.SlsGroupSlsGroupConfigArgs;
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("tf_example");
final var default = AlicloudFunctions.getAccount(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference);
final var defaultGetRegions = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
.current(true)
.build());
var defaultUuid = new Uuid("defaultUuid");
var defaultProject = new Project("defaultProject", ProjectArgs.builder()
.projectName(StdFunctions.substr(SubstrArgs.builder()
.input(String.format("tf-example-%s", StdFunctions.replace(ReplaceArgs.builder()
.text(defaultUuid.result())
.search("-")
.replace("")
.build()).result()))
.offset(0)
.length(16)
.build()).result())
.build());
var defaultStore = new Store("defaultStore", StoreArgs.builder()
.projectName(defaultProject.projectName())
.logstoreName(name)
.shardCount(3)
.autoSplit(true)
.maxSplitShardCount(60)
.appendMeta(true)
.build());
var defaultSlsGroup = new SlsGroup("defaultSlsGroup", SlsGroupArgs.builder()
.slsGroupConfigs(SlsGroupSlsGroupConfigArgs.builder()
.slsUserId(default_.id())
.slsLogstore(defaultStore.logstoreName())
.slsProject(defaultProject.projectName())
.slsRegion(defaultGetRegions.regions()[0].id())
.build())
.slsGroupDescription(name)
.slsGroupName(name)
.build());
}
}
configuration:
name:
type: string
default: tf_example
resources:
defaultUuid:
type: random:Uuid
name: default
defaultProject:
type: alicloud:log:Project
name: default
properties:
projectName:
fn::invoke:
function: std:substr
arguments:
input:
fn::join:
- ""
- - tf-example-
- fn::invoke:
function: std:replace
arguments:
text: ${defaultUuid.result}
search: '-'
replace: ""
return: result
offset: 0
length: 16
return: result
defaultStore:
type: alicloud:log:Store
name: default
properties:
projectName: ${defaultProject.projectName}
logstoreName: ${name}
shardCount: 3
autoSplit: true
maxSplitShardCount: 60
appendMeta: true
defaultSlsGroup:
type: alicloud:cms:SlsGroup
name: default
properties:
slsGroupConfigs:
- slsUserId: ${default.id}
slsLogstore: ${defaultStore.logstoreName}
slsProject: ${defaultProject.projectName}
slsRegion: ${defaultGetRegions.regions[0].id}
slsGroupDescription: ${name}
slsGroupName: ${name}
variables:
default:
fn::invoke:
function: alicloud:getAccount
arguments: {}
defaultGetRegions:
fn::invoke:
function: alicloud:getRegions
arguments:
current: true
Create SlsGroup Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new SlsGroup(name: string, args: SlsGroupArgs, opts?: CustomResourceOptions);
@overload
def SlsGroup(resource_name: str,
args: SlsGroupArgs,
opts: Optional[ResourceOptions] = None)
@overload
def SlsGroup(resource_name: str,
opts: Optional[ResourceOptions] = None,
sls_group_configs: Optional[Sequence[SlsGroupSlsGroupConfigArgs]] = None,
sls_group_name: Optional[str] = None,
sls_group_description: Optional[str] = None)
func NewSlsGroup(ctx *Context, name string, args SlsGroupArgs, opts ...ResourceOption) (*SlsGroup, error)
public SlsGroup(string name, SlsGroupArgs args, CustomResourceOptions? opts = null)
public SlsGroup(String name, SlsGroupArgs args)
public SlsGroup(String name, SlsGroupArgs args, CustomResourceOptions options)
type: alicloud:cms:SlsGroup
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args SlsGroupArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args SlsGroupArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args SlsGroupArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SlsGroupArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SlsGroupArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var slsGroupResource = new AliCloud.Cms.SlsGroup("slsGroupResource", new()
{
SlsGroupConfigs = new[]
{
new AliCloud.Cms.Inputs.SlsGroupSlsGroupConfigArgs
{
SlsLogstore = "string",
SlsProject = "string",
SlsRegion = "string",
SlsUserId = "string",
},
},
SlsGroupName = "string",
SlsGroupDescription = "string",
});
example, err := cms.NewSlsGroup(ctx, "slsGroupResource", &cms.SlsGroupArgs{
SlsGroupConfigs: cms.SlsGroupSlsGroupConfigArray{
&cms.SlsGroupSlsGroupConfigArgs{
SlsLogstore: pulumi.String("string"),
SlsProject: pulumi.String("string"),
SlsRegion: pulumi.String("string"),
SlsUserId: pulumi.String("string"),
},
},
SlsGroupName: pulumi.String("string"),
SlsGroupDescription: pulumi.String("string"),
})
var slsGroupResource = new SlsGroup("slsGroupResource", SlsGroupArgs.builder()
.slsGroupConfigs(SlsGroupSlsGroupConfigArgs.builder()
.slsLogstore("string")
.slsProject("string")
.slsRegion("string")
.slsUserId("string")
.build())
.slsGroupName("string")
.slsGroupDescription("string")
.build());
sls_group_resource = alicloud.cms.SlsGroup("slsGroupResource",
sls_group_configs=[{
"sls_logstore": "string",
"sls_project": "string",
"sls_region": "string",
"sls_user_id": "string",
}],
sls_group_name="string",
sls_group_description="string")
const slsGroupResource = new alicloud.cms.SlsGroup("slsGroupResource", {
slsGroupConfigs: [{
slsLogstore: "string",
slsProject: "string",
slsRegion: "string",
slsUserId: "string",
}],
slsGroupName: "string",
slsGroupDescription: "string",
});
type: alicloud:cms:SlsGroup
properties:
slsGroupConfigs:
- slsLogstore: string
slsProject: string
slsRegion: string
slsUserId: string
slsGroupDescription: string
slsGroupName: string
SlsGroup Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The SlsGroup resource accepts the following input properties:
- Sls
Group List<Pulumi.Configs Ali Cloud. Cms. Inputs. Sls Group Sls Group Config> - The Config of the Sls Group. You can specify up to 25 Config. See
sls_group_config
below. - Sls
Group stringName - The name of the resource. The name must be
2
to32
characters in length, and can contain letters, digits and underscores (_). It must start with a letter. - Sls
Group stringDescription - The Description of the Sls Group.
- Sls
Group []SlsConfigs Group Sls Group Config Args - The Config of the Sls Group. You can specify up to 25 Config. See
sls_group_config
below. - Sls
Group stringName - The name of the resource. The name must be
2
to32
characters in length, and can contain letters, digits and underscores (_). It must start with a letter. - Sls
Group stringDescription - The Description of the Sls Group.
- sls
Group List<SlsConfigs Group Sls Group Config> - The Config of the Sls Group. You can specify up to 25 Config. See
sls_group_config
below. - sls
Group StringName - The name of the resource. The name must be
2
to32
characters in length, and can contain letters, digits and underscores (_). It must start with a letter. - sls
Group StringDescription - The Description of the Sls Group.
- sls
Group SlsConfigs Group Sls Group Config[] - The Config of the Sls Group. You can specify up to 25 Config. See
sls_group_config
below. - sls
Group stringName - The name of the resource. The name must be
2
to32
characters in length, and can contain letters, digits and underscores (_). It must start with a letter. - sls
Group stringDescription - The Description of the Sls Group.
- sls_
group_ Sequence[Slsconfigs Group Sls Group Config Args] - The Config of the Sls Group. You can specify up to 25 Config. See
sls_group_config
below. - sls_
group_ strname - The name of the resource. The name must be
2
to32
characters in length, and can contain letters, digits and underscores (_). It must start with a letter. - sls_
group_ strdescription - The Description of the Sls Group.
- sls
Group List<Property Map>Configs - The Config of the Sls Group. You can specify up to 25 Config. See
sls_group_config
below. - sls
Group StringName - The name of the resource. The name must be
2
to32
characters in length, and can contain letters, digits and underscores (_). It must start with a letter. - sls
Group StringDescription - The Description of the Sls Group.
Outputs
All input properties are implicitly available as output properties. Additionally, the SlsGroup resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing SlsGroup Resource
Get an existing SlsGroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: SlsGroupState, opts?: CustomResourceOptions): SlsGroup
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
sls_group_configs: Optional[Sequence[SlsGroupSlsGroupConfigArgs]] = None,
sls_group_description: Optional[str] = None,
sls_group_name: Optional[str] = None) -> SlsGroup
func GetSlsGroup(ctx *Context, name string, id IDInput, state *SlsGroupState, opts ...ResourceOption) (*SlsGroup, error)
public static SlsGroup Get(string name, Input<string> id, SlsGroupState? state, CustomResourceOptions? opts = null)
public static SlsGroup get(String name, Output<String> id, SlsGroupState state, CustomResourceOptions options)
resources: _: type: alicloud:cms:SlsGroup get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Sls
Group List<Pulumi.Configs Ali Cloud. Cms. Inputs. Sls Group Sls Group Config> - The Config of the Sls Group. You can specify up to 25 Config. See
sls_group_config
below. - Sls
Group stringDescription - The Description of the Sls Group.
- Sls
Group stringName - The name of the resource. The name must be
2
to32
characters in length, and can contain letters, digits and underscores (_). It must start with a letter.
- Sls
Group []SlsConfigs Group Sls Group Config Args - The Config of the Sls Group. You can specify up to 25 Config. See
sls_group_config
below. - Sls
Group stringDescription - The Description of the Sls Group.
- Sls
Group stringName - The name of the resource. The name must be
2
to32
characters in length, and can contain letters, digits and underscores (_). It must start with a letter.
- sls
Group List<SlsConfigs Group Sls Group Config> - The Config of the Sls Group. You can specify up to 25 Config. See
sls_group_config
below. - sls
Group StringDescription - The Description of the Sls Group.
- sls
Group StringName - The name of the resource. The name must be
2
to32
characters in length, and can contain letters, digits and underscores (_). It must start with a letter.
- sls
Group SlsConfigs Group Sls Group Config[] - The Config of the Sls Group. You can specify up to 25 Config. See
sls_group_config
below. - sls
Group stringDescription - The Description of the Sls Group.
- sls
Group stringName - The name of the resource. The name must be
2
to32
characters in length, and can contain letters, digits and underscores (_). It must start with a letter.
- sls_
group_ Sequence[Slsconfigs Group Sls Group Config Args] - The Config of the Sls Group. You can specify up to 25 Config. See
sls_group_config
below. - sls_
group_ strdescription - The Description of the Sls Group.
- sls_
group_ strname - The name of the resource. The name must be
2
to32
characters in length, and can contain letters, digits and underscores (_). It must start with a letter.
- sls
Group List<Property Map>Configs - The Config of the Sls Group. You can specify up to 25 Config. See
sls_group_config
below. - sls
Group StringDescription - The Description of the Sls Group.
- sls
Group StringName - The name of the resource. The name must be
2
to32
characters in length, and can contain letters, digits and underscores (_). It must start with a letter.
Supporting Types
SlsGroupSlsGroupConfig, SlsGroupSlsGroupConfigArgs
- Sls
Logstore string - The name of the Log Store.
- Sls
Project string - The name of the Project.
- Sls
Region string - The Sls Region.
- Sls
User stringId - The ID of the Sls User.
- Sls
Logstore string - The name of the Log Store.
- Sls
Project string - The name of the Project.
- Sls
Region string - The Sls Region.
- Sls
User stringId - The ID of the Sls User.
- sls
Logstore String - The name of the Log Store.
- sls
Project String - The name of the Project.
- sls
Region String - The Sls Region.
- sls
User StringId - The ID of the Sls User.
- sls
Logstore string - The name of the Log Store.
- sls
Project string - The name of the Project.
- sls
Region string - The Sls Region.
- sls
User stringId - The ID of the Sls User.
- sls_
logstore str - The name of the Log Store.
- sls_
project str - The name of the Project.
- sls_
region str - The Sls Region.
- sls_
user_ strid - The ID of the Sls User.
- sls
Logstore String - The name of the Log Store.
- sls
Project String - The name of the Project.
- sls
Region String - The Sls Region.
- sls
User StringId - The ID of the Sls User.
Import
Cloud Monitor Service Sls Group can be imported using the id, e.g.
$ pulumi import alicloud:cms/slsGroup:SlsGroup example <sls_group_name>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.