1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. log
  5. MachineGroup
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi

alicloud.log.MachineGroup

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 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.RandomInteger("default", {
        max: 99999,
        min: 10000,
    });
    const exampleProject = new alicloud.log.Project("exampleProject", {description: "terraform-example"});
    const exampleMachineGroup = new alicloud.log.MachineGroup("exampleMachineGroup", {
        project: exampleProject.name,
        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.RandomInteger("default",
        max=99999,
        min=10000)
    example_project = alicloud.log.Project("exampleProject", description="terraform-example")
    example_machine_group = alicloud.log.MachineGroup("exampleMachineGroup",
        project=example_project.name,
        identify_type="ip",
        topic="terraform",
        identify_lists=[
            "10.0.0.1",
            "10.0.0.2",
        ])
    
    package main
    
    import (
    	"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.NewRandomInteger(ctx, "default", &random.RandomIntegerArgs{
    			Max: pulumi.Int(99999),
    			Min: pulumi.Int(10000),
    		})
    		if err != nil {
    			return err
    		}
    		exampleProject, err := log.NewProject(ctx, "exampleProject", &log.ProjectArgs{
    			Description: pulumi.String("terraform-example"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = log.NewMachineGroup(ctx, "exampleMachineGroup", &log.MachineGroupArgs{
    			Project:      exampleProject.Name,
    			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.RandomInteger("default", new()
        {
            Max = 99999,
            Min = 10000,
        });
    
        var exampleProject = new AliCloud.Log.Project("exampleProject", new()
        {
            Description = "terraform-example",
        });
    
        var exampleMachineGroup = new AliCloud.Log.MachineGroup("exampleMachineGroup", new()
        {
            Project = exampleProject.Name,
            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.RandomInteger;
    import com.pulumi.random.RandomIntegerArgs;
    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 RandomInteger("default", RandomIntegerArgs.builder()        
                .max(99999)
                .min(10000)
                .build());
    
            var exampleProject = new Project("exampleProject", ProjectArgs.builder()        
                .description("terraform-example")
                .build());
    
            var exampleMachineGroup = new MachineGroup("exampleMachineGroup", MachineGroupArgs.builder()        
                .project(exampleProject.name())
                .identifyType("ip")
                .topic("terraform")
                .identifyLists(            
                    "10.0.0.1",
                    "10.0.0.2")
                .build());
    
        }
    }
    
    resources:
      default:
        type: random:RandomInteger
        properties:
          max: 99999
          min: 10000
      exampleProject:
        type: alicloud:log:Project
        properties:
          description: terraform-example
      exampleMachineGroup:
        type: alicloud:log:MachineGroup
        properties:
          project: ${exampleProject.name}
          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

    new MachineGroup(name: string, args: MachineGroupArgs, opts?: CustomResourceOptions);
    @overload
    def MachineGroup(resource_name: 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)
    @overload
    def MachineGroup(resource_name: str,
                     args: MachineGroupArgs,
                     opts: Optional[ResourceOptions] = 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.
    
    
    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.

    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
    

    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.51.0 published on Saturday, Mar 23, 2024 by Pulumi