1. Packages
  2. Alicloud Provider
  3. API Docs
  4. log
  5. MachineGroup
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

alicloud.log.MachineGroup

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

    Log Service manages all the ECS instances whose logs need to be collected by using the Logtail client in the form of machine groups. Refer to details

    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", {
        projectName: `terraform-example-${_default.result}`,
        description: "terraform-example",
    });
    const exampleMachineGroup = new alicloud.log.MachineGroup("example", {
        project: example.projectName,
        name: "terraform-example",
        identifyType: "ip",
        topic: "terraform",
        identifyLists: [
            "10.0.0.1",
            "10.0.0.2",
        ],
    });
    
    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",
        project_name=f"terraform-example-{default['result']}",
        description="terraform-example")
    example_machine_group = alicloud.log.MachineGroup("example",
        project=example.project_name,
        name="terraform-example",
        identify_type="ip",
        topic="terraform",
        identify_lists=[
            "10.0.0.1",
            "10.0.0.2",
        ])
    
    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{
    			ProjectName: pulumi.Sprintf("terraform-example-%v", _default.Result),
    			Description: pulumi.String("terraform-example"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = log.NewMachineGroup(ctx, "example", &log.MachineGroupArgs{
    			Project:      example.ProjectName,
    			Name:         pulumi.String("terraform-example"),
    			IdentifyType: pulumi.String("ip"),
    			Topic:        pulumi.String("terraform"),
    			IdentifyLists: pulumi.StringArray{
    				pulumi.String("10.0.0.1"),
    				pulumi.String("10.0.0.2"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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()
        {
            ProjectName = $"terraform-example-{@default.Result}",
            Description = "terraform-example",
        });
    
        var exampleMachineGroup = new AliCloud.Log.MachineGroup("example", new()
        {
            Project = example.ProjectName,
            Name = "terraform-example",
            IdentifyType = "ip",
            Topic = "terraform",
            IdentifyLists = new[]
            {
                "10.0.0.1",
                "10.0.0.2",
            },
        });
    
    });
    
    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.MachineGroup;
    import com.pulumi.alicloud.log.MachineGroupArgs;
    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()
                .projectName(String.format("terraform-example-%s", default_.result()))
                .description("terraform-example")
                .build());
    
            var exampleMachineGroup = new MachineGroup("exampleMachineGroup", MachineGroupArgs.builder()
                .project(example.projectName())
                .name("terraform-example")
                .identifyType("ip")
                .topic("terraform")
                .identifyLists(            
                    "10.0.0.1",
                    "10.0.0.2")
                .build());
    
        }
    }
    
    resources:
      default:
        type: random:integer
        properties:
          max: 99999
          min: 10000
      example:
        type: alicloud:log:Project
        properties:
          projectName: terraform-example-${default.result}
          description: terraform-example
      exampleMachineGroup:
        type: alicloud:log:MachineGroup
        name: example
        properties:
          project: ${example.projectName}
          name: terraform-example
          identifyType: ip
          topic: terraform
          identifyLists:
            - 10.0.0.1
            - 10.0.0.2
    

    Module Support

    You can use the existing sls-logtail module to create logtail config, machine group, install logtail on ECS instances and join instances into machine group one-click.

    Create MachineGroup Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new MachineGroup(name: string, args: MachineGroupArgs, opts?: CustomResourceOptions);
    @overload
    def MachineGroup(resource_name: str,
                     args: MachineGroupArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def MachineGroup(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     identify_lists: Optional[Sequence[str]] = None,
                     project: Optional[str] = None,
                     identify_type: Optional[str] = None,
                     name: Optional[str] = None,
                     topic: Optional[str] = None)
    func NewMachineGroup(ctx *Context, name string, args MachineGroupArgs, opts ...ResourceOption) (*MachineGroup, error)
    public MachineGroup(string name, MachineGroupArgs args, CustomResourceOptions? opts = null)
    public MachineGroup(String name, MachineGroupArgs args)
    public MachineGroup(String name, MachineGroupArgs args, CustomResourceOptions options)
    
    type: alicloud:log:MachineGroup
    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 MachineGroupArgs
    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 MachineGroupArgs
    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 MachineGroupArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args MachineGroupArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args MachineGroupArgs
    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 machineGroupResource = new AliCloud.Log.MachineGroup("machineGroupResource", new()
    {
        IdentifyLists = new[]
        {
            "string",
        },
        Project = "string",
        IdentifyType = "string",
        Name = "string",
        Topic = "string",
    });
    
    example, err := log.NewMachineGroup(ctx, "machineGroupResource", &log.MachineGroupArgs{
    	IdentifyLists: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Project:      pulumi.String("string"),
    	IdentifyType: pulumi.String("string"),
    	Name:         pulumi.String("string"),
    	Topic:        pulumi.String("string"),
    })
    
    var machineGroupResource = new MachineGroup("machineGroupResource", MachineGroupArgs.builder()
        .identifyLists("string")
        .project("string")
        .identifyType("string")
        .name("string")
        .topic("string")
        .build());
    
    machine_group_resource = alicloud.log.MachineGroup("machineGroupResource",
        identify_lists=["string"],
        project="string",
        identify_type="string",
        name="string",
        topic="string")
    
    const machineGroupResource = new alicloud.log.MachineGroup("machineGroupResource", {
        identifyLists: ["string"],
        project: "string",
        identifyType: "string",
        name: "string",
        topic: "string",
    });
    
    type: alicloud:log:MachineGroup
    properties:
        identifyLists:
            - string
        identifyType: string
        name: string
        project: string
        topic: string
    

    MachineGroup Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The MachineGroup resource accepts the following input properties:

    IdentifyLists List<string>
    The specific machine identification, which can be an IP address or user-defined identity.
    Project string
    The project name to the machine group belongs.
    IdentifyType string
    The machine identification type, including IP and user-defined identity. Valid values are "ip" and "userdefined". Default to "ip".
    Name string
    The machine group name, which is unique in the same project.
    Topic string
    The topic of a machine group.
    IdentifyLists []string
    The specific machine identification, which can be an IP address or user-defined identity.
    Project string
    The project name to the machine group belongs.
    IdentifyType string
    The machine identification type, including IP and user-defined identity. Valid values are "ip" and "userdefined". Default to "ip".
    Name string
    The machine group name, which is unique in the same project.
    Topic string
    The topic of a machine group.
    identifyLists List<String>
    The specific machine identification, which can be an IP address or user-defined identity.
    project String
    The project name to the machine group belongs.
    identifyType String
    The machine identification type, including IP and user-defined identity. Valid values are "ip" and "userdefined". Default to "ip".
    name String
    The machine group name, which is unique in the same project.
    topic String
    The topic of a machine group.
    identifyLists string[]
    The specific machine identification, which can be an IP address or user-defined identity.
    project string
    The project name to the machine group belongs.
    identifyType string
    The machine identification type, including IP and user-defined identity. Valid values are "ip" and "userdefined". Default to "ip".
    name string
    The machine group name, which is unique in the same project.
    topic string
    The topic of a machine group.
    identify_lists Sequence[str]
    The specific machine identification, which can be an IP address or user-defined identity.
    project str
    The project name to the machine group belongs.
    identify_type str
    The machine identification type, including IP and user-defined identity. Valid values are "ip" and "userdefined". Default to "ip".
    name str
    The machine group name, which is unique in the same project.
    topic str
    The topic of a machine group.
    identifyLists List<String>
    The specific machine identification, which can be an IP address or user-defined identity.
    project String
    The project name to the machine group belongs.
    identifyType String
    The machine identification type, including IP and user-defined identity. Valid values are "ip" and "userdefined". Default to "ip".
    name String
    The machine group name, which is unique in the same project.
    topic String
    The topic of a machine group.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the MachineGroup 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 MachineGroup Resource

    Get an existing MachineGroup 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?: MachineGroupState, opts?: CustomResourceOptions): MachineGroup
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            identify_lists: Optional[Sequence[str]] = None,
            identify_type: Optional[str] = None,
            name: Optional[str] = None,
            project: Optional[str] = None,
            topic: Optional[str] = None) -> MachineGroup
    func GetMachineGroup(ctx *Context, name string, id IDInput, state *MachineGroupState, opts ...ResourceOption) (*MachineGroup, error)
    public static MachineGroup Get(string name, Input<string> id, MachineGroupState? state, CustomResourceOptions? opts = null)
    public static MachineGroup get(String name, Output<String> id, MachineGroupState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    The following state arguments are supported:
    IdentifyLists List<string>
    The specific machine identification, which can be an IP address or user-defined identity.
    IdentifyType string
    The machine identification type, including IP and user-defined identity. Valid values are "ip" and "userdefined". Default to "ip".
    Name string
    The machine group name, which is unique in the same project.
    Project string
    The project name to the machine group belongs.
    Topic string
    The topic of a machine group.
    IdentifyLists []string
    The specific machine identification, which can be an IP address or user-defined identity.
    IdentifyType string
    The machine identification type, including IP and user-defined identity. Valid values are "ip" and "userdefined". Default to "ip".
    Name string
    The machine group name, which is unique in the same project.
    Project string
    The project name to the machine group belongs.
    Topic string
    The topic of a machine group.
    identifyLists List<String>
    The specific machine identification, which can be an IP address or user-defined identity.
    identifyType String
    The machine identification type, including IP and user-defined identity. Valid values are "ip" and "userdefined". Default to "ip".
    name String
    The machine group name, which is unique in the same project.
    project String
    The project name to the machine group belongs.
    topic String
    The topic of a machine group.
    identifyLists string[]
    The specific machine identification, which can be an IP address or user-defined identity.
    identifyType string
    The machine identification type, including IP and user-defined identity. Valid values are "ip" and "userdefined". Default to "ip".
    name string
    The machine group name, which is unique in the same project.
    project string
    The project name to the machine group belongs.
    topic string
    The topic of a machine group.
    identify_lists Sequence[str]
    The specific machine identification, which can be an IP address or user-defined identity.
    identify_type str
    The machine identification type, including IP and user-defined identity. Valid values are "ip" and "userdefined". Default to "ip".
    name str
    The machine group name, which is unique in the same project.
    project str
    The project name to the machine group belongs.
    topic str
    The topic of a machine group.
    identifyLists List<String>
    The specific machine identification, which can be an IP address or user-defined identity.
    identifyType String
    The machine identification type, including IP and user-defined identity. Valid values are "ip" and "userdefined". Default to "ip".
    name String
    The machine group name, which is unique in the same project.
    project String
    The project name to the machine group belongs.
    topic String
    The topic of a machine group.

    Import

    Log machine group can be imported using the id, e.g.

    $ pulumi import alicloud:log/machineGroup:MachineGroup example tf-log:tf-machine-group
    

    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.
    alicloud logo
    Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi