diff --git a/examples/resources/harness_platform_monitored_service/resource.tf b/examples/resources/harness_platform_monitored_service/resource.tf index 512053c0f..4902bf778 100644 --- a/examples/resources/harness_platform_monitored_service/resource.tf +++ b/examples/resources/harness_platform_monitored_service/resource.tf @@ -104,6 +104,39 @@ resource "harness_platform_monitored_service" "example1" { liveMonitoringEnabled = "true" continuousVerificationEnabled = "true" sliEnabled = "false" + metricThresholds: [ + { + type: "IgnoreThreshold", + spec: { + action: "Ignore" + }, + criteria: { + type: "Absolute", + spec: { + greaterThan: 100 + } + }, + metricType: "Custom", + metricName: "metric_cpu" + }, + { + "type": "FailImmediately", + "spec": { + "action": "FailAfterOccurrence", + "spec": { + "count": 2 + } + }, + "criteria": { + "type": "Absolute", + "spec": { + "greaterThan": 100 + } + }, + "metricType": "Custom", + "metricName": "metric_cpu" + } + ] }, { name = "name2" @@ -225,6 +258,39 @@ resource "harness_platform_monitored_service" "example3" { liveMonitoringEnabled = "true" continuousVerificationEnabled = "false" sliEnabled = "false" + metricThresholds: [ + { + type: "IgnoreThreshold", + spec: { + action: "Ignore" + }, + criteria: { + type: "Absolute", + spec: { + greaterThan: 100 + } + }, + metricType: "Custom", + metricName: "identifier2" + }, + { + "type": "FailImmediately", + "spec": { + "action": "FailAfterOccurrence", + "spec": { + "count": 2 + } + }, + "criteria": { + "type": "Absolute", + "spec": { + "greaterThan": 100 + } + }, + "metricType": "Custom", + "metricName": "identifier2" + } + ] } ] }) @@ -324,6 +390,38 @@ resource "harness_platform_monitored_service" "example5" { liveMonitoringEnabled = "true" continuousVerificationEnabled = "true" sliEnabled = "false" + metricThresholds: [ + { + type: "IgnoreThreshold", + spec: { + action: "Ignore" + }, + criteria: { + type: "Absolute", + spec: { + greaterThan: 100 + } + }, + metricType: "Custom", + metricName: "metric" + }, + { + "type": "FailImmediately", + "spec": { + "action": "FailAfterOccurrence", + "spec": { + "count": 2 + } + }, + "criteria": { + "type": "Absolute", + "spec": { + "greaterThan": 100 + } + }, + "metricType": "Custom", + "metricName": "metric" + }] }, { name = "name2" @@ -439,6 +537,44 @@ resource "harness_platform_monitored_service" "example7" { isManualQuery = true } ] + metricPacks: [ + { + identifier: "Custom", + metricThresholds: [ + { + type: "IgnoreThreshold", + spec: { + action: "Ignore" + }, + criteria: { + type: "Absolute", + spec: { + greaterThan: 100 + } + }, + metricType: "Custom", + metricName: "Prometheus Metric" + }, + { + "type": "FailImmediately", + "spec": { + "action": "FailAfterOccurrence", + "spec": { + "count": 2 + } + }, + "criteria": { + "type": "Absolute", + "spec": { + "greaterThan": 100 + } + }, + "metricType": "Custom", + "metricName": "Prometheus Metric" + } + ] + } + ] }) } template_ref = "template_ref" @@ -522,6 +658,44 @@ resource "harness_platform_monitored_service" "example8" { } } ] + metricPacks: [ + { + identifier: "Custom", + metricThresholds: [ + { + type: "IgnoreThreshold", + spec: { + action: "Ignore" + }, + criteria: { + type: "Absolute", + spec: { + greaterThan: 100 + } + }, + metricType: "Custom", + metricName: "metric" + }, + { + "type": "FailImmediately", + "spec": { + "action": "FailAfterOccurrence", + "spec": { + "count": 2 + } + }, + "criteria": { + "type": "Absolute", + "spec": { + "greaterThan": 100 + } + }, + "metricType": "Custom", + "metricName": "metric" + } + ] + } + ] }) } template_ref = "template_ref" diff --git a/internal/service/platform/monitored_service/data_source_monitored_service_test.go b/internal/service/platform/monitored_service/data_source_monitored_service_test.go index 0cada65e4..700957523 100644 --- a/internal/service/platform/monitored_service/data_source_monitored_service_test.go +++ b/internal/service/platform/monitored_service/data_source_monitored_service_test.go @@ -482,6 +482,38 @@ func testAccSplunkSignalFXDataSourceMonitoredService(id string, name string) str liveMonitoringEnabled = "true" continuousVerificationEnabled = "false" sliEnabled = "false" + metricThresholds: [ + { + type: "IgnoreThreshold", + spec: { + action: "Ignore" + }, + criteria: { + type: "Absolute", + spec: { + greaterThan: 100 + } + }, + metricType: "Custom", + metricName: "identifier2" + }, + { + "type": "FailImmediately", + "spec": { + "action": "FailAfterOccurrence", + "spec": { + "count": 2 + } + }, + "criteria": { + "type": "Absolute", + "spec": { + "greaterThan": 100 + } + }, + "metricType": "Custom", + "metricName": "identifier2" + }] } ]}) } @@ -561,6 +593,22 @@ func testAccGrafanaLokiLogsDataSourceMonitoredService(id string, name string) st liveMonitoringEnabled = "false" continuousVerificationEnabled = "false" sliEnabled = "false" + metricThresholds: [ + { + type: "IgnoreThreshold", + spec: { + action: "Ignore" + }, + criteria: { + type: "Absolute", + spec: { + greaterThan: 100 + } + }, + metricType: "Custom", + metricName: "identifier2" + } + ] } ]}) } @@ -632,6 +680,39 @@ func testAccAzureMetricsDataSourceMonitoredService(id string, name string) strin liveMonitoringEnabled = "true" continuousVerificationEnabled = "true" sliEnabled = "false" + metricThresholds: [ + { + type: "IgnoreThreshold", + spec: { + action: "Ignore" + }, + criteria: { + type: "Absolute", + spec: { + greaterThan: 100 + } + }, + metricType: "Custom", + metricName: "metric" + }, + { + "type": "FailImmediately", + "spec": { + "action": "FailAfterOccurrence", + "spec": { + "count": 2 + } + }, + "criteria": { + "type": "Absolute", + "spec": { + "greaterThan": 100 + } + }, + "metricType": "Custom", + "metricName": "metric" + } + ] }, { name = "name2" @@ -826,6 +907,23 @@ resource "harness_platform_monitored_service" "test" { }, metricType: "Custom", metricName: "Prometheus Metric" + }, + { + "type": "FailImmediately", + "spec": { + "action": "FailAfterOccurrence", + "spec": { + "count": 2 + } + }, + "criteria": { + "type": "Absolute", + "spec": { + "greaterThan": 100 + } + }, + "metricType": "Custom", + "metricName": "Prometheus Metric" } ] } @@ -882,7 +980,7 @@ resource "harness_platform_monitored_service" "test" { { identifier: "Custom", metricThresholds: [ - { + { type: "IgnoreThreshold", spec: { action: "Ignore" @@ -895,7 +993,24 @@ resource "harness_platform_monitored_service" "test" { }, metricType: "Custom", metricName: "metric" - } + }, + { + "type": "FailImmediately", + "spec": { + "action": "FailAfterOccurrence", + "spec": { + "count": 2 + } + }, + "criteria": { + "type": "Absolute", + "spec": { + "greaterThan": 100 + } + }, + "metricType": "Custom", + "metricName": "metric" + } ] } ]