1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. cms
  5. MonitorGroupInstances
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

alicloud.cms.MonitorGroupInstances

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

    Provides a Cloud Monitor Service Monitor Group Instances resource.

    For information about Cloud Monitor Service Monitor Group Instances and how to use it, see What is Monitor Group Instances.

    NOTE: Available since v1.115.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf_example";
    const defaultNetwork = new alicloud.vpc.Network("defaultNetwork", {
        vpcName: name,
        cidrBlock: "192.168.0.0/16",
    });
    const defaultMonitorGroup = new alicloud.cms.MonitorGroup("defaultMonitorGroup", {monitorGroupName: name});
    const defaultRegions = alicloud.getRegions({
        current: true,
    });
    const example = new alicloud.cms.MonitorGroupInstances("example", {
        groupId: defaultMonitorGroup.id,
        instances: [{
            instanceId: defaultNetwork.id,
            instanceName: name,
            regionId: defaultRegions.then(defaultRegions => defaultRegions.regions?.[0]?.id),
            category: "vpc",
        }],
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf_example"
    default_network = alicloud.vpc.Network("defaultNetwork",
        vpc_name=name,
        cidr_block="192.168.0.0/16")
    default_monitor_group = alicloud.cms.MonitorGroup("defaultMonitorGroup", monitor_group_name=name)
    default_regions = alicloud.get_regions(current=True)
    example = alicloud.cms.MonitorGroupInstances("example",
        group_id=default_monitor_group.id,
        instances=[alicloud.cms.MonitorGroupInstancesInstanceArgs(
            instance_id=default_network.id,
            instance_name=name,
            region_id=default_regions.regions[0].id,
            category="vpc",
        )])
    
    package main
    
    import (
    	"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/vpc"
    	"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
    		}
    		defaultNetwork, err := vpc.NewNetwork(ctx, "defaultNetwork", &vpc.NetworkArgs{
    			VpcName:   pulumi.String(name),
    			CidrBlock: pulumi.String("192.168.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultMonitorGroup, err := cms.NewMonitorGroup(ctx, "defaultMonitorGroup", &cms.MonitorGroupArgs{
    			MonitorGroupName: pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		defaultRegions, err := alicloud.GetRegions(ctx, &alicloud.GetRegionsArgs{
    			Current: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = cms.NewMonitorGroupInstances(ctx, "example", &cms.MonitorGroupInstancesArgs{
    			GroupId: defaultMonitorGroup.ID(),
    			Instances: cms.MonitorGroupInstancesInstanceArray{
    				&cms.MonitorGroupInstancesInstanceArgs{
    					InstanceId:   defaultNetwork.ID(),
    					InstanceName: pulumi.String(name),
    					RegionId:     pulumi.String(defaultRegions.Regions[0].Id),
    					Category:     pulumi.String("vpc"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf_example";
        var defaultNetwork = new AliCloud.Vpc.Network("defaultNetwork", new()
        {
            VpcName = name,
            CidrBlock = "192.168.0.0/16",
        });
    
        var defaultMonitorGroup = new AliCloud.Cms.MonitorGroup("defaultMonitorGroup", new()
        {
            MonitorGroupName = name,
        });
    
        var defaultRegions = AliCloud.GetRegions.Invoke(new()
        {
            Current = true,
        });
    
        var example = new AliCloud.Cms.MonitorGroupInstances("example", new()
        {
            GroupId = defaultMonitorGroup.Id,
            Instances = new[]
            {
                new AliCloud.Cms.Inputs.MonitorGroupInstancesInstanceArgs
                {
                    InstanceId = defaultNetwork.Id,
                    InstanceName = name,
                    RegionId = defaultRegions.Apply(getRegionsResult => getRegionsResult.Regions[0]?.Id),
                    Category = "vpc",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.vpc.Network;
    import com.pulumi.alicloud.vpc.NetworkArgs;
    import com.pulumi.alicloud.cms.MonitorGroup;
    import com.pulumi.alicloud.cms.MonitorGroupArgs;
    import com.pulumi.alicloud.AlicloudFunctions;
    import com.pulumi.alicloud.inputs.GetRegionsArgs;
    import com.pulumi.alicloud.cms.MonitorGroupInstances;
    import com.pulumi.alicloud.cms.MonitorGroupInstancesArgs;
    import com.pulumi.alicloud.cms.inputs.MonitorGroupInstancesInstanceArgs;
    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");
            var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()        
                .vpcName(name)
                .cidrBlock("192.168.0.0/16")
                .build());
    
            var defaultMonitorGroup = new MonitorGroup("defaultMonitorGroup", MonitorGroupArgs.builder()        
                .monitorGroupName(name)
                .build());
    
            final var defaultRegions = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
                .current(true)
                .build());
    
            var example = new MonitorGroupInstances("example", MonitorGroupInstancesArgs.builder()        
                .groupId(defaultMonitorGroup.id())
                .instances(MonitorGroupInstancesInstanceArgs.builder()
                    .instanceId(defaultNetwork.id())
                    .instanceName(name)
                    .regionId(defaultRegions.applyValue(getRegionsResult -> getRegionsResult.regions()[0].id()))
                    .category("vpc")
                    .build())
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf_example
    resources:
      defaultNetwork:
        type: alicloud:vpc:Network
        properties:
          vpcName: ${name}
          cidrBlock: 192.168.0.0/16
      defaultMonitorGroup:
        type: alicloud:cms:MonitorGroup
        properties:
          monitorGroupName: ${name}
      example:
        type: alicloud:cms:MonitorGroupInstances
        properties:
          groupId: ${defaultMonitorGroup.id}
          instances:
            - instanceId: ${defaultNetwork.id}
              instanceName: ${name}
              regionId: ${defaultRegions.regions[0].id}
              category: vpc
    variables:
      defaultRegions:
        fn::invoke:
          Function: alicloud:getRegions
          Arguments:
            current: true
    

    Create MonitorGroupInstances Resource

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

    Constructor syntax

    new MonitorGroupInstances(name: string, args: MonitorGroupInstancesArgs, opts?: CustomResourceOptions);
    @overload
    def MonitorGroupInstances(resource_name: str,
                              args: MonitorGroupInstancesArgs,
                              opts: Optional[ResourceOptions] = None)
    
    @overload
    def MonitorGroupInstances(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              group_id: Optional[str] = None,
                              instances: Optional[Sequence[MonitorGroupInstancesInstanceArgs]] = None)
    func NewMonitorGroupInstances(ctx *Context, name string, args MonitorGroupInstancesArgs, opts ...ResourceOption) (*MonitorGroupInstances, error)
    public MonitorGroupInstances(string name, MonitorGroupInstancesArgs args, CustomResourceOptions? opts = null)
    public MonitorGroupInstances(String name, MonitorGroupInstancesArgs args)
    public MonitorGroupInstances(String name, MonitorGroupInstancesArgs args, CustomResourceOptions options)
    
    type: alicloud:cms:MonitorGroupInstances
    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 MonitorGroupInstancesArgs
    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 MonitorGroupInstancesArgs
    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 MonitorGroupInstancesArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args MonitorGroupInstancesArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args MonitorGroupInstancesArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var monitorGroupInstancesResource = new AliCloud.Cms.MonitorGroupInstances("monitorGroupInstancesResource", new()
    {
        GroupId = "string",
        Instances = new[]
        {
            new AliCloud.Cms.Inputs.MonitorGroupInstancesInstanceArgs
            {
                Category = "string",
                InstanceId = "string",
                InstanceName = "string",
                RegionId = "string",
            },
        },
    });
    
    example, err := cms.NewMonitorGroupInstances(ctx, "monitorGroupInstancesResource", &cms.MonitorGroupInstancesArgs{
    	GroupId: pulumi.String("string"),
    	Instances: cms.MonitorGroupInstancesInstanceArray{
    		&cms.MonitorGroupInstancesInstanceArgs{
    			Category:     pulumi.String("string"),
    			InstanceId:   pulumi.String("string"),
    			InstanceName: pulumi.String("string"),
    			RegionId:     pulumi.String("string"),
    		},
    	},
    })
    
    var monitorGroupInstancesResource = new MonitorGroupInstances("monitorGroupInstancesResource", MonitorGroupInstancesArgs.builder()        
        .groupId("string")
        .instances(MonitorGroupInstancesInstanceArgs.builder()
            .category("string")
            .instanceId("string")
            .instanceName("string")
            .regionId("string")
            .build())
        .build());
    
    monitor_group_instances_resource = alicloud.cms.MonitorGroupInstances("monitorGroupInstancesResource",
        group_id="string",
        instances=[alicloud.cms.MonitorGroupInstancesInstanceArgs(
            category="string",
            instance_id="string",
            instance_name="string",
            region_id="string",
        )])
    
    const monitorGroupInstancesResource = new alicloud.cms.MonitorGroupInstances("monitorGroupInstancesResource", {
        groupId: "string",
        instances: [{
            category: "string",
            instanceId: "string",
            instanceName: "string",
            regionId: "string",
        }],
    });
    
    type: alicloud:cms:MonitorGroupInstances
    properties:
        groupId: string
        instances:
            - category: string
              instanceId: string
              instanceName: string
              regionId: string
    

    MonitorGroupInstances 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 MonitorGroupInstances resource accepts the following input properties:

    GroupId string
    The id of Cms Group.
    Instances List<Pulumi.AliCloud.Cms.Inputs.MonitorGroupInstancesInstance>
    Instance information added to the Cms Group. See instances below.
    GroupId string
    The id of Cms Group.
    Instances []MonitorGroupInstancesInstanceArgs
    Instance information added to the Cms Group. See instances below.
    groupId String
    The id of Cms Group.
    instances List<MonitorGroupInstancesInstance>
    Instance information added to the Cms Group. See instances below.
    groupId string
    The id of Cms Group.
    instances MonitorGroupInstancesInstance[]
    Instance information added to the Cms Group. See instances below.
    group_id str
    The id of Cms Group.
    instances Sequence[MonitorGroupInstancesInstanceArgs]
    Instance information added to the Cms Group. See instances below.
    groupId String
    The id of Cms Group.
    instances List<Property Map>
    Instance information added to the Cms Group. See instances below.

    Outputs

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

    Get an existing MonitorGroupInstances 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?: MonitorGroupInstancesState, opts?: CustomResourceOptions): MonitorGroupInstances
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            group_id: Optional[str] = None,
            instances: Optional[Sequence[MonitorGroupInstancesInstanceArgs]] = None) -> MonitorGroupInstances
    func GetMonitorGroupInstances(ctx *Context, name string, id IDInput, state *MonitorGroupInstancesState, opts ...ResourceOption) (*MonitorGroupInstances, error)
    public static MonitorGroupInstances Get(string name, Input<string> id, MonitorGroupInstancesState? state, CustomResourceOptions? opts = null)
    public static MonitorGroupInstances get(String name, Output<String> id, MonitorGroupInstancesState 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:
    GroupId string
    The id of Cms Group.
    Instances List<Pulumi.AliCloud.Cms.Inputs.MonitorGroupInstancesInstance>
    Instance information added to the Cms Group. See instances below.
    GroupId string
    The id of Cms Group.
    Instances []MonitorGroupInstancesInstanceArgs
    Instance information added to the Cms Group. See instances below.
    groupId String
    The id of Cms Group.
    instances List<MonitorGroupInstancesInstance>
    Instance information added to the Cms Group. See instances below.
    groupId string
    The id of Cms Group.
    instances MonitorGroupInstancesInstance[]
    Instance information added to the Cms Group. See instances below.
    group_id str
    The id of Cms Group.
    instances Sequence[MonitorGroupInstancesInstanceArgs]
    Instance information added to the Cms Group. See instances below.
    groupId String
    The id of Cms Group.
    instances List<Property Map>
    Instance information added to the Cms Group. See instances below.

    Supporting Types

    MonitorGroupInstancesInstance, MonitorGroupInstancesInstanceArgs

    Category string
    The category of instance.
    InstanceId string
    The id of instance.
    InstanceName string
    The name of instance.
    RegionId string
    The region id of instance.
    Category string
    The category of instance.
    InstanceId string
    The id of instance.
    InstanceName string
    The name of instance.
    RegionId string
    The region id of instance.
    category String
    The category of instance.
    instanceId String
    The id of instance.
    instanceName String
    The name of instance.
    regionId String
    The region id of instance.
    category string
    The category of instance.
    instanceId string
    The id of instance.
    instanceName string
    The name of instance.
    regionId string
    The region id of instance.
    category str
    The category of instance.
    instance_id str
    The id of instance.
    instance_name str
    The name of instance.
    region_id str
    The region id of instance.
    category String
    The category of instance.
    instanceId String
    The id of instance.
    instanceName String
    The name of instance.
    regionId String
    The region id of instance.

    Import

    Cloud Monitor Service Monitor Group Instances can be imported using the id, e.g.

    $ pulumi import alicloud:cms/monitorGroupInstances:MonitorGroupInstances example <group_id>
    

    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.53.0 published on Wednesday, Apr 17, 2024 by Pulumi