From b33b9cb47d3992246b64ee4aab440f2d0987e644 Mon Sep 17 00:00:00 2001 From: Rupa Lahiri Date: Fri, 20 Oct 2023 00:39:46 +0530 Subject: [PATCH] Add anomaly detection (#105) * Add anomaly detection Signed-off-by: Rupa Lahiri * Add test for update Signed-off-by: Rupa Lahiri * Add audit config in anomaly detector test Signed-off-by: Rupa Lahiri * Format terraform in test Signed-off-by: Rupa Lahiri --------- Signed-off-by: Rupa Lahiri --- docs/resources/anomaly_detection.md | 82 +++++ .../opensearch_anomaly_detection/resource.tf | 53 ++++ provider/diff_suppress_funcs.go | 20 ++ provider/provider.go | 1 + .../resource_opensearch_anomaly_detection.go | 224 ++++++++++++++ ...ource_opensearch_anomaly_detection_test.go | 289 ++++++++++++++++++ provider/util.go | 4 + 7 files changed, 673 insertions(+) create mode 100644 docs/resources/anomaly_detection.md create mode 100644 examples/resources/opensearch_anomaly_detection/resource.tf create mode 100644 provider/resource_opensearch_anomaly_detection.go create mode 100644 provider/resource_opensearch_anomaly_detection_test.go diff --git a/docs/resources/anomaly_detection.md b/docs/resources/anomaly_detection.md new file mode 100644 index 0000000..a2abbd9 --- /dev/null +++ b/docs/resources/anomaly_detection.md @@ -0,0 +1,82 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "opensearch_anomaly_detection Resource - terraform-provider-opensearch" +subcategory: "" +description: |- + Provides an OpenSearch anonaly detection. Please refer to the OpenSearch anomaly detection documentation for details. +--- + +# opensearch_anomaly_detection (Resource) + +Provides an OpenSearch anonaly detection. Please refer to the OpenSearch anomaly detection documentation for details. + +## Example Usage + +```terraform +resource "opensearch_anomaly_detection" "foo" { + body = < +## Schema + +### Required + +- `body` (String) The anomaly detection document + +### Read-Only + +- `id` (String) The ID of this resource. + + diff --git a/examples/resources/opensearch_anomaly_detection/resource.tf b/examples/resources/opensearch_anomaly_detection/resource.tf new file mode 100644 index 0000000..cb1a5c1 --- /dev/null +++ b/examples/resources/opensearch_anomaly_detection/resource.tf @@ -0,0 +1,53 @@ +resource "opensearch_anomaly_detection" "foo" { + body = <