diff --git a/docs/data-sources/monitor_v2.md b/docs/data-sources/monitor_v2.md
index 044a5215..cc9a2f96 100644
--- a/docs/data-sources/monitor_v2.md
+++ b/docs/data-sources/monitor_v2.md
@@ -23,21 +23,21 @@ template and destinations to configure the receiver.
### Optional
-- `data_stabilization_delay` (String) expresses the minimum time that should elapse before data is considered "good enough" to evaluate. Choosing a delay really depends on the expectations of latency of data and whether data is expected to arrive later than other data and thus would change previously evaluated results.
- `id` (String) Resource ID for this object.
-- `max_alerts_per_hour` (Number) overrides the default value of max alerts generated in a single hour before the monitor is deactivated for safety
- `name` (String) Monitor name.
- `workspace` (String) OID of the workspace this object is contained in.
### Read-Only
- `actions` (Block List) The list of shared actions to which this monitor is connected. (see [below for nested schema](#nestedblock--actions))
+- `data_stabilization_delay` (String) expresses the minimum time that should elapse before data is considered "good enough" to evaluate. Choosing a delay really depends on the expectations of latency of data and whether data is expected to arrive later than other data and thus would change previously evaluated results.
- `description` (String) A brief description of the monitor.
- `groupings` (Block List) Describes the groups that logically separate events/rows/etc from each other. If monitor dataset is resource type and monitor strategy is promote, this field should be either empty or only contain the primary keys of the dataset. (see [below for nested schema](#nestedblock--groupings))
- `icon_url` (String) URL of the monitor icon.
- `inputs` (Map of String) The inputs map binds dataset OIDs to labels which can be referenced within
stage pipelines.
- `lookback_time` (String) optionally describes a duration that must be satisifed by this monitor. It applies to all rules, but is only applicable to rule kinds that utilize it.
+- `max_alerts_per_hour` (Number) overrides the default value of max alerts generated in a single hour before the monitor is deactivated for safety
- `oid` (String)
- `rule_kind` (String) Describes the type of each of the rules in the definition (they must all be the same type).
- `rules` (Block List) All rules for this monitor must be of the same MonitorRuleKind as specified in ruleKind. Rules should be constructed logically such that a state transition null->Warning implies transition from null->Informational. (see [below for nested schema](#nestedblock--rules))
@@ -51,11 +51,114 @@ its predecessor. (see [below for nested schema](#nestedblock--stage))
Read-Only:
+- `action` (Block List) This value should be used for creating inline private actions. (see [below for nested schema](#nestedblock--actions--action))
+- `conditions` (List of Object) Optional conditions that can be AND'd with levels to match the action. (see [below for nested schema](#nestedatt--actions--conditions))
- `levels` (List of String) The alarm level(s) at which this monitor should trigger this shared action.
- `oid` (String) The OID of this shared action. This should be used for existing shared actions.
- `send_end_notifications` (Boolean)
- `send_reminders_interval` (String)
+
+### Nested Schema for `actions.action`
+
+Read-Only:
+
+- `description` (String)
+- `email` (List of Object) (see [below for nested schema](#nestedatt--actions--action--email))
+- `type` (String)
+- `webhook` (List of Object) (see [below for nested schema](#nestedatt--actions--action--webhook))
+
+
+### Nested Schema for `actions.action.email`
+
+Read-Only:
+
+- `addresses` (List of String)
+- `body` (String)
+- `fragments` (String)
+- `subject` (String)
+- `users` (List of String)
+
+
+
+### Nested Schema for `actions.action.webhook`
+
+Read-Only:
+
+- `body` (String)
+- `fragments` (String)
+- `headers` (List of Object) (see [below for nested schema](#nestedobjatt--actions--action--webhook--headers))
+- `method` (String)
+- `url` (String)
+
+
+### Nested Schema for `actions.action.webhook.headers`
+
+Read-Only:
+
+- `header` (String)
+- `value` (String)
+
+
+
+
+
+### Nested Schema for `actions.conditions`
+
+Read-Only:
+
+- `compare_terms` (List of Object) (see [below for nested schema](#nestedobjatt--actions--conditions--compare_terms))
+
+
+### Nested Schema for `actions.conditions.compare_terms`
+
+Read-Only:
+
+- `column` (List of Object) (see [below for nested schema](#nestedobjatt--actions--conditions--compare_terms--column))
+- `comparison` (List of Object) (see [below for nested schema](#nestedobjatt--actions--conditions--compare_terms--comparison))
+
+
+### Nested Schema for `actions.conditions.compare_terms.comparison`
+
+Read-Only:
+
+- `column_path` (List of Object) (see [below for nested schema](#nestedobjatt--actions--conditions--compare_terms--comparison--column_path))
+- `link_column` (List of Object) (see [below for nested schema](#nestedobjatt--actions--conditions--compare_terms--comparison--link_column))
+
+
+### Nested Schema for `actions.conditions.compare_terms.comparison.column_path`
+
+Read-Only:
+
+- `name` (String)
+- `path` (String)
+
+
+
+### Nested Schema for `actions.conditions.compare_terms.comparison.link_column`
+
+Read-Only:
+
+- `name` (String)
+
+
+
+
+### Nested Schema for `actions.conditions.compare_terms.comparison`
+
+Read-Only:
+
+- `compare_fn` (String)
+- `value_bool` (List of Boolean)
+- `value_duration` (List of Boolean)
+- `value_float64` (List of Number)
+- `value_int64` (List of Number)
+- `value_string` (List of String)
+- `value_timestamp` (List of String)
+
+
+
+
### Nested Schema for `groupings`
diff --git a/observe/data_source_monitor_v2.go b/observe/data_source_monitor_v2.go
index 19beefc0..926beb94 100644
--- a/observe/data_source_monitor_v2.go
+++ b/observe/data_source_monitor_v2.go
@@ -189,13 +189,11 @@ func dataSourceMonitorV2() *schema.Resource {
"data_stabilization_delay": { // Int64
Type: schema.TypeString,
Computed: true,
- Optional: true,
Description: descriptions.Get("monitorv2", "schema", "data_stabilization_delay"),
},
"max_alerts_per_hour": { //Int64
Type: schema.TypeInt,
Computed: true,
- Optional: true,
Description: descriptions.Get("monitorv2", "schema", "max_alerts_per_hour"),
},
"groupings": { // [MonitorV2ColumnInput!]
@@ -246,12 +244,71 @@ func dataSourceMonitorV2() *schema.Resource {
Computed: true,
Description: descriptions.Get("monitorv2", "schema", "actions", "oid"),
},
+ "action": {
+ Type: schema.TypeList,
+ Optional: true,
+ Computed: true,
+ Description: descriptions.Get("monitorv2", "schema", "actions", "action"),
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ // fields of MonitorV2ActionInput
+ "type": { // MonitorV2ActionType!
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "email": { // MonitorV2EmailDestinationInput
+ Type: schema.TypeList,
+ Computed: true,
+ Elem: monitorV2EmailActionDatasource(),
+ },
+ "webhook": { // MonitorV2WebhookDestinationInput
+ Type: schema.TypeList,
+ Computed: true,
+ Elem: monitorV2WebhookActionDatasource(),
+ },
+ "description": { // String
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ },
+ },
+ },
"levels": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
Description: descriptions.Get("monitorv2", "schema", "actions", "levels"),
},
+ "conditions": { // MonitorV2ComparisonExpression
+ Type: schema.TypeList,
+ Computed: true,
+ Description: descriptions.Get("monitorv2", "schema", "actions", "conditions", "description"),
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "compare_terms": { // [MonitorV2ComparisonTerm!]
+ Type: schema.TypeList,
+ Computed: true,
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "comparison": { // [MonitorV2Comparison!]!
+ Type: schema.TypeList,
+ Computed: true,
+ Elem: monitorV2ComparisonDatasource(),
+ Description: descriptions.Get("monitorv2", "schema", "actions", "conditions", "compare_terms", "comparison"),
+ },
+ "column": { // [MonitorV2Column!]!
+ Type: schema.TypeList,
+ Computed: true,
+ Elem: monitorV2ColumnDatasource(),
+ Description: descriptions.Get("monitorv2", "schema", "actions", "conditions", "compare_terms", "column"),
+ },
+ },
+ },
+ },
+ // note: operator is an implied AND for now until the UI supports OR
+ },
+ },
+ },
"send_end_notifications": { // Boolean
Type: schema.TypeBool,
Computed: true,
diff --git a/observe/resource_monitor_v2.go b/observe/resource_monitor_v2.go
index a2f08f45..c9f079c8 100644
--- a/observe/resource_monitor_v2.go
+++ b/observe/resource_monitor_v2.go
@@ -35,6 +35,11 @@ func resourceMonitorV2() *schema.Resource {
ValidateDiagFunc: validateOID(oid.TypeWorkspace),
Description: descriptions.Get("monitorv2", "schema", "workspace_id"),
},
+ "name": { // String!
+ Type: schema.TypeString,
+ Required: true,
+ Description: descriptions.Get("monitorv2", "schema", "name"),
+ },
// fields of MonitorV2Input excluding the components of MonitorV2DefinitionInput
"rule_kind": { // MonitorV2RuleKind!
Type: schema.TypeString,
@@ -42,11 +47,6 @@ func resourceMonitorV2() *schema.Resource {
ValidateDiagFunc: validateEnums(gql.AllMonitorV2RuleKinds),
Description: descriptions.Get("monitorv2", "schema", "rule_kind"),
},
- "name": { // String!
- Type: schema.TypeString,
- Required: true,
- Description: descriptions.Get("monitorv2", "schema", "name"),
- },
"icon_url": { // String
Type: schema.TypeString,
Optional: true,