From aacf57f94d31a5a9e1a372778c06ef9b0c2f7561 Mon Sep 17 00:00:00 2001 From: abhinavkumarsph Date: Wed, 21 Feb 2024 13:42:30 +0800 Subject: [PATCH 1/2] feat: index pattern submodule --- modules/dashboard/index-pattern/README.md | 36 ++++++++++++++++++++ modules/dashboard/index-pattern/main.tf | 21 ++++++++++++ modules/dashboard/index-pattern/outputs.tf | 4 +++ modules/dashboard/index-pattern/variables.tf | 15 ++++++++ modules/dashboard/index-pattern/versions.tf | 10 ++++++ 5 files changed, 86 insertions(+) create mode 100644 modules/dashboard/index-pattern/README.md create mode 100644 modules/dashboard/index-pattern/main.tf create mode 100644 modules/dashboard/index-pattern/outputs.tf create mode 100644 modules/dashboard/index-pattern/variables.tf create mode 100644 modules/dashboard/index-pattern/versions.tf diff --git a/modules/dashboard/index-pattern/README.md b/modules/dashboard/index-pattern/README.md new file mode 100644 index 0000000..43e3165 --- /dev/null +++ b/modules/dashboard/index-pattern/README.md @@ -0,0 +1,36 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.4 | +| [opensearch](#requirement\_opensearch) | >= 1.0 | + +## Providers + +| Name | Version | +|------|---------| +| [opensearch](#provider\_opensearch) | >= 1.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [opensearch_dashboard_object.index_pattern](https://registry.terraform.io/providers/opensearch-project/opensearch/latest/docs/resources/dashboard_object) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [pattern](#input\_pattern) | The index pattern | `string` | n/a | yes | +| [pattern\_id](#input\_pattern\_id) | The ID of index pattern | `string` | `null` | no | +| [time\_field\_name](#input\_time\_field\_name) | Field name which has the timestamp | `string` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [id](#output\_id) | The ID of the index pattern | diff --git a/modules/dashboard/index-pattern/main.tf b/modules/dashboard/index-pattern/main.tf new file mode 100644 index 0000000..9596a23 --- /dev/null +++ b/modules/dashboard/index-pattern/main.tf @@ -0,0 +1,21 @@ +locals { + id = coalesce(var.pattern_id, split(var.pattern, "-*")[0]) +} + +resource "opensearch_dashboard_object" "index_pattern" { + body = < Date: Wed, 21 Feb 2024 13:59:11 +0800 Subject: [PATCH 2/2] fix: pattern id --- modules/dashboard/index-pattern/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/dashboard/index-pattern/main.tf b/modules/dashboard/index-pattern/main.tf index 9596a23..5fa235d 100644 --- a/modules/dashboard/index-pattern/main.tf +++ b/modules/dashboard/index-pattern/main.tf @@ -1,5 +1,5 @@ locals { - id = coalesce(var.pattern_id, split(var.pattern, "-*")[0]) + id = coalesce(var.pattern_id, split("-*", var.pattern)[0]) } resource "opensearch_dashboard_object" "index_pattern" {