alicloud.cms.MonitorGroupInstances
Explore with Pulumi AI
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("default", {
vpcName: name,
cidrBlock: "192.168.0.0/16",
});
const defaultMonitorGroup = new alicloud.cms.MonitorGroup("default", {monitorGroupName: name});
const default = alicloud.getRegions({
current: true,
});
const example = new alicloud.cms.MonitorGroupInstances("example", {
groupId: defaultMonitorGroup.id,
instances: [{
instanceId: defaultNetwork.id,
instanceName: name,
regionId: _default.then(_default => _default.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("default",
vpc_name=name,
cidr_block="192.168.0.0/16")
default_monitor_group = alicloud.cms.MonitorGroup("default", monitor_group_name=name)
default = alicloud.get_regions(current=True)
example = alicloud.cms.MonitorGroupInstances("example",
group_id=default_monitor_group.id,
instances=[{
"instance_id": default_network.id,
"instance_name": name,
"region_id": default.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, "default", &vpc.NetworkArgs{
VpcName: pulumi.String(name),
CidrBlock: pulumi.String("192.168.0.0/16"),
})
if err != nil {
return err
}
defaultMonitorGroup, err := cms.NewMonitorGroup(ctx, "default", &cms.MonitorGroupArgs{
MonitorGroupName: pulumi.String(name),
})
if err != nil {
return err
}
_default, 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(_default.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("default", new()
{
VpcName = name,
CidrBlock = "192.168.0.0/16",
});
var defaultMonitorGroup = new AliCloud.Cms.MonitorGroup("default", new()
{
MonitorGroupName = name,
});
var @default = 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 = @default.Apply(@default => @default.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 default = 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(default_.regions()[0].id())
.category("vpc")
.build())
.build());
}
}
configuration:
name:
type: string
default: tf_example
resources:
defaultNetwork:
type: alicloud:vpc:Network
name: default
properties:
vpcName: ${name}
cidrBlock: 192.168.0.0/16
defaultMonitorGroup:
type: alicloud:cms:MonitorGroup
name: default
properties:
monitorGroupName: ${name}
example:
type: alicloud:cms:MonitorGroupInstances
properties:
groupId: ${defaultMonitorGroup.id}
instances:
- instanceId: ${defaultNetwork.id}
instanceName: ${name}
regionId: ${default.regions[0].id}
category: vpc
variables:
default:
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.
Constructor 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=[{
"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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The MonitorGroupInstances resource accepts the following input properties:
- Group
Id string - The id of Cms Group.
- Instances
List<Pulumi.
Ali Cloud. Cms. Inputs. Monitor Group Instances Instance> - Instance information added to the Cms Group. See
instances
below.
- Group
Id string - The id of Cms Group.
- Instances
[]Monitor
Group Instances Instance Args - Instance information added to the Cms Group. See
instances
below.
- group
Id String - The id of Cms Group.
- instances
List<Monitor
Group Instances Instance> - Instance information added to the Cms Group. See
instances
below.
- group
Id string - The id of Cms Group.
- instances
Monitor
Group Instances Instance[] - Instance information added to the Cms Group. See
instances
below.
- group_
id str - The id of Cms Group.
- instances
Sequence[Monitor
Group Instances Instance Args] - Instance information added to the Cms Group. See
instances
below.
- group
Id 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.
- Group
Id string - The id of Cms Group.
- Instances
List<Pulumi.
Ali Cloud. Cms. Inputs. Monitor Group Instances Instance> - Instance information added to the Cms Group. See
instances
below.
- Group
Id string - The id of Cms Group.
- Instances
[]Monitor
Group Instances Instance Args - Instance information added to the Cms Group. See
instances
below.
- group
Id String - The id of Cms Group.
- instances
List<Monitor
Group Instances Instance> - Instance information added to the Cms Group. See
instances
below.
- group
Id string - The id of Cms Group.
- instances
Monitor
Group Instances Instance[] - Instance information added to the Cms Group. See
instances
below.
- group_
id str - The id of Cms Group.
- instances
Sequence[Monitor
Group Instances Instance Args] - Instance information added to the Cms Group. See
instances
below.
- group
Id 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.
- Instance
Id string - The id of instance.
- Instance
Name string - The name of instance.
- Region
Id string - The region id of instance.
- Category string
- The category of instance.
- Instance
Id string - The id of instance.
- Instance
Name string - The name of instance.
- Region
Id string - The region id of instance.
- category String
- The category of instance.
- instance
Id String - The id of instance.
- instance
Name String - The name of instance.
- region
Id String - The region id of instance.
- category string
- The category of instance.
- instance
Id string - The id of instance.
- instance
Name string - The name of instance.
- region
Id 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.
- instance
Id String - The id of instance.
- instance
Name String - The name of instance.
- region
Id 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.