Skip to content

Commit 78793f4

Browse files
authored
Extend OpenSearch instance parameters (#443)
* Extend OpenSearch instance parameters * Fix bug in parameter modelling * Improve monitoring_instance_id field documentation * Fix unit test
1 parent 7e51a0a commit 78793f4

6 files changed

Lines changed: 487 additions & 129 deletions

File tree

docs/data-sources/opensearch_instance.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ data "stackit_opensearch_instance" "example" {
2020
```
2121

2222
<!-- schema generated by tfplugindocs -->
23+
2324
## Schema
2425

2526
### Required
@@ -42,8 +43,22 @@ data "stackit_opensearch_instance" "example" {
4243
- `version` (String) The service version.
4344

4445
<a id="nestedatt--parameters"></a>
46+
4547
### Nested Schema for `parameters`
4648

4749
Read-Only:
4850

49-
- `sgw_acl` (String)
51+
- `enable_monitoring` (Boolean) Enable monitoring.
52+
- `graphite` (String) If set, monitoring with Graphite will be enabled. Expects the host and port where the Graphite metrics should be sent to (host:port).
53+
- `java_garbage_collector` (String) The garbage collector to use for OpenSearch.
54+
- `java_heapspace` (Number) The amount of memory (in MB) allocated as heap by the JVM for OpenSearch.
55+
- `java_maxmetaspace` (Number) The amount of memory (in MB) used by the JVM to store metadata for OpenSearch.
56+
- `max_disk_threshold` (Number) The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.
57+
- `metrics_frequency` (Number) The frequency in seconds at which metrics are emitted (in seconds).
58+
- `metrics_prefix` (String) The prefix for the metrics. Could be useful when using Graphite monitoring to prefix the metrics with a certain value, like an API key.
59+
- `monitoring_instance_id` (String) The ID of the STACKIT monitoring instance.
60+
- `plugins` (List of String) List of plugins to install. Must be a supported plugin name. The plugins `repository-s3` and `repository-azure` are enabled by default and cannot be disabled.
61+
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
62+
- `syslog` (List of String) List of syslog servers to send logs to.
63+
- `tls_ciphers` (List of String) List of TLS ciphers to use.
64+
- `tls_protocols` (String) The TLS protocol to use.

docs/resources/opensearch_instance.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ resource "stackit_opensearch_instance" "example" {
2525
```
2626

2727
<!-- schema generated by tfplugindocs -->
28+
2829
## Schema
2930

3031
### Required
@@ -50,8 +51,22 @@ resource "stackit_opensearch_instance" "example" {
5051
- `plan_id` (String) The selected plan ID.
5152

5253
<a id="nestedatt--parameters"></a>
54+
5355
### Nested Schema for `parameters`
5456

5557
Optional:
5658

57-
- `sgw_acl` (String)
59+
- `enable_monitoring` (Boolean) Enable monitoring.
60+
- `graphite` (String) If set, monitoring with Graphite will be enabled. Expects the host and port where the Graphite metrics should be sent to (host:port).
61+
- `java_garbage_collector` (String) The garbage collector to use for OpenSearch.
62+
- `java_heapspace` (Number) The amount of memory (in MB) allocated as heap by the JVM for OpenSearch.
63+
- `java_maxmetaspace` (Number) The amount of memory (in MB) used by the JVM to store metadata for OpenSearch.
64+
- `max_disk_threshold` (Number) The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.
65+
- `metrics_frequency` (Number) The frequency in seconds at which metrics are emitted (in seconds).
66+
- `metrics_prefix` (String) The prefix for the metrics. Could be useful when using Graphite monitoring to prefix the metrics with a certain value, like an API key.
67+
- `monitoring_instance_id` (String) The ID of the STACKIT monitoring instance.
68+
- `plugins` (List of String) List of plugins to install. Must be a supported plugin name. The plugins `repository-s3` and `repository-azure` are enabled by default and cannot be disabled.
69+
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
70+
- `syslog` (List of String) List of syslog servers to send logs to.
71+
- `tls_ciphers` (List of String) List of TLS ciphers to use.
72+
- `tls_protocols` (String) The TLS protocol to use.

stackit/internal/services/opensearch/instance/datasource.go

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77

88
"github.com/hashicorp/terraform-plugin-framework/datasource"
99
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
10+
"github.com/hashicorp/terraform-plugin-framework/types"
1011
"github.com/hashicorp/terraform-plugin-log/tflog"
1112
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
1213
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
@@ -86,6 +87,23 @@ func (r *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques
8687
"plan_id": "The selected plan ID.",
8788
}
8889

90+
parametersDescriptions := map[string]string{
91+
"sgw_acl": "Comma separated list of IP networks in CIDR notation which are allowed to access this instance.",
92+
"enable_monitoring": "Enable monitoring.",
93+
"graphite": "If set, monitoring with Graphite will be enabled. Expects the host and port where the Graphite metrics should be sent to (host:port).",
94+
"max_disk_threshold": "The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.",
95+
"metrics_frequency": "The frequency in seconds at which metrics are emitted (in seconds).",
96+
"metrics_prefix": "The prefix for the metrics. Could be useful when using Graphite monitoring to prefix the metrics with a certain value, like an API key.",
97+
"monitoring_instance_id": "The ID of the STACKIT monitoring instance.",
98+
"java_garbage_collector": "The garbage collector to use for OpenSearch.",
99+
"java_heapspace": "The amount of memory (in MB) allocated as heap by the JVM for OpenSearch.",
100+
"java_maxmetaspace": "The amount of memory (in MB) used by the JVM to store metadata for OpenSearch.",
101+
"plugins": "List of plugins to install. Must be a supported plugin name. The plugins `repository-s3` and `repository-azure` are enabled by default and cannot be disabled.",
102+
"syslog": "List of syslog servers to send logs to.",
103+
"tls_ciphers": "List of TLS ciphers to use.",
104+
"tls_protocols": "The TLS protocol to use.",
105+
}
106+
89107
resp.Schema = schema.Schema{
90108
Description: descriptions["main"],
91109
Attributes: map[string]schema.Attribute{
@@ -128,7 +146,63 @@ func (r *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques
128146
"parameters": schema.SingleNestedAttribute{
129147
Attributes: map[string]schema.Attribute{
130148
"sgw_acl": schema.StringAttribute{
131-
Computed: true,
149+
Description: parametersDescriptions["sgw_acl"],
150+
Computed: true,
151+
},
152+
"enable_monitoring": schema.BoolAttribute{
153+
Description: parametersDescriptions["enable_monitoring"],
154+
Computed: true,
155+
},
156+
"graphite": schema.StringAttribute{
157+
Description: parametersDescriptions["graphite"],
158+
Computed: true,
159+
},
160+
"java_garbage_collector": schema.StringAttribute{
161+
Description: parametersDescriptions["java_garbage_collector"],
162+
Computed: true,
163+
},
164+
"java_heapspace": schema.Int64Attribute{
165+
Description: parametersDescriptions["java_heapspace"],
166+
Computed: true,
167+
},
168+
"java_maxmetaspace": schema.Int64Attribute{
169+
Description: parametersDescriptions["java_maxmetaspace"],
170+
Computed: true,
171+
},
172+
"max_disk_threshold": schema.Int64Attribute{
173+
Description: parametersDescriptions["max_disk_threshold"],
174+
Computed: true,
175+
},
176+
"metrics_frequency": schema.Int64Attribute{
177+
Description: parametersDescriptions["metrics_frequency"],
178+
Computed: true,
179+
},
180+
"metrics_prefix": schema.StringAttribute{
181+
Description: parametersDescriptions["metrics_prefix"],
182+
Computed: true,
183+
},
184+
"monitoring_instance_id": schema.StringAttribute{
185+
Description: parametersDescriptions["monitoring_instance_id"],
186+
Computed: true,
187+
},
188+
"plugins": schema.ListAttribute{
189+
ElementType: types.StringType,
190+
Description: parametersDescriptions["plugins"],
191+
Computed: true,
192+
},
193+
"syslog": schema.ListAttribute{
194+
ElementType: types.StringType,
195+
Description: parametersDescriptions["syslog"],
196+
Computed: true,
197+
},
198+
"tls_ciphers": schema.ListAttribute{
199+
ElementType: types.StringType,
200+
Description: parametersDescriptions["tls_ciphers"],
201+
Computed: true,
202+
},
203+
"tls_protocols": schema.StringAttribute{
204+
Description: parametersDescriptions["tls_protocols"],
205+
Computed: true,
132206
},
133207
},
134208
Computed: true,

0 commit comments

Comments
 (0)