Extend MariaDB instance parameters (#441)
* Extend MariaDB instance parameters * Fix linter * Improve monitoring_instance_id field documentation * Add documentation for graphite field * Add Argus instance as example to monitoring_instance_id description * Specify that a STACKIT monitoring instance is expected
This commit is contained in:
parent
a08dbd8926
commit
b54c671082
18 changed files with 377 additions and 117 deletions
|
|
@ -20,6 +20,7 @@ data "stackit_logme_instance" "example" {
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- schema generated by tfplugindocs -->
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
|
||||||
## Schema
|
## Schema
|
||||||
|
|
||||||
### Required
|
### Required
|
||||||
|
|
@ -42,6 +43,7 @@ data "stackit_logme_instance" "example" {
|
||||||
- `version` (String) The service version.
|
- `version` (String) The service version.
|
||||||
|
|
||||||
<a id="nestedatt--parameters"></a>
|
<a id="nestedatt--parameters"></a>
|
||||||
|
|
||||||
### Nested Schema for `parameters`
|
### Nested Schema for `parameters`
|
||||||
|
|
||||||
Read-Only:
|
Read-Only:
|
||||||
|
|
@ -63,7 +65,7 @@ Read-Only:
|
||||||
- `max_disk_threshold` (Number) The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.
|
- `max_disk_threshold` (Number) The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.
|
||||||
- `metrics_frequency` (Number) The frequency in seconds at which metrics are emitted (in seconds).
|
- `metrics_frequency` (Number) The frequency in seconds at which metrics are emitted (in seconds).
|
||||||
- `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.
|
- `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.
|
||||||
- `monitoring_instance_id` (String) The monitoring instance ID.
|
- `monitoring_instance_id` (String) The ID of the STACKIT monitoring instance.
|
||||||
- `opensearch_tls_ciphers` (List of String)
|
- `opensearch_tls_ciphers` (List of String)
|
||||||
- `opensearch_tls_protocols` (List of String)
|
- `opensearch_tls_protocols` (List of String)
|
||||||
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
|
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ data "stackit_mariadb_instance" "example" {
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- schema generated by tfplugindocs -->
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
|
||||||
## Schema
|
## Schema
|
||||||
|
|
||||||
### Required
|
### Required
|
||||||
|
|
@ -42,8 +43,16 @@ data "stackit_mariadb_instance" "example" {
|
||||||
- `version` (String) The service version.
|
- `version` (String) The service version.
|
||||||
|
|
||||||
<a id="nestedatt--parameters"></a>
|
<a id="nestedatt--parameters"></a>
|
||||||
|
|
||||||
### Nested Schema for `parameters`
|
### Nested Schema for `parameters`
|
||||||
|
|
||||||
Read-Only:
|
Read-Only:
|
||||||
|
|
||||||
- `sgw_acl` (String)
|
- `enable_monitoring` (Boolean) Enable monitoring.
|
||||||
|
- `graphite` (String)
|
||||||
|
- `max_disk_threshold` (Number) The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.
|
||||||
|
- `metrics_frequency` (Number) The frequency in seconds at which metrics are emitted.
|
||||||
|
- `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
|
||||||
|
- `monitoring_instance_id` (String) The ID of the STACKIT monitoring instance.
|
||||||
|
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
|
||||||
|
- `syslog` (List of String) List of syslog servers to send logs to.
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ data "stackit_rabbitmq_instance" "example" {
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- schema generated by tfplugindocs -->
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
|
||||||
## Schema
|
## Schema
|
||||||
|
|
||||||
### Required
|
### Required
|
||||||
|
|
@ -42,6 +43,7 @@ data "stackit_rabbitmq_instance" "example" {
|
||||||
- `version` (String) The service version.
|
- `version` (String) The service version.
|
||||||
|
|
||||||
<a id="nestedatt--parameters"></a>
|
<a id="nestedatt--parameters"></a>
|
||||||
|
|
||||||
### Nested Schema for `parameters`
|
### Nested Schema for `parameters`
|
||||||
|
|
||||||
Read-Only:
|
Read-Only:
|
||||||
|
|
@ -52,7 +54,7 @@ Read-Only:
|
||||||
- `max_disk_threshold` (Number) The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.
|
- `max_disk_threshold` (Number) The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.
|
||||||
- `metrics_frequency` (Number) The frequency in seconds at which metrics are emitted.
|
- `metrics_frequency` (Number) The frequency in seconds at which metrics are emitted.
|
||||||
- `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
|
- `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
|
||||||
- `monitoring_instance_id` (String) The monitoring instance ID.
|
- `monitoring_instance_id` (String) The ID of the STACKIT monitoring instance.
|
||||||
- `plugins` (List of String) List of plugins to install. Must be a supported plugin name.
|
- `plugins` (List of String) List of plugins to install. Must be a supported plugin name.
|
||||||
- `roles` (List of String) List of roles to assign to the instance.
|
- `roles` (List of String) List of roles to assign to the instance.
|
||||||
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
|
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ data "stackit_redis_instance" "example" {
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- schema generated by tfplugindocs -->
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
|
||||||
## Schema
|
## Schema
|
||||||
|
|
||||||
### Required
|
### Required
|
||||||
|
|
@ -42,6 +43,7 @@ data "stackit_redis_instance" "example" {
|
||||||
- `version` (String) The service version.
|
- `version` (String) The service version.
|
||||||
|
|
||||||
<a id="nestedatt--parameters"></a>
|
<a id="nestedatt--parameters"></a>
|
||||||
|
|
||||||
### Nested Schema for `parameters`
|
### Nested Schema for `parameters`
|
||||||
|
|
||||||
Read-Only:
|
Read-Only:
|
||||||
|
|
@ -60,7 +62,7 @@ Read-Only:
|
||||||
- `metrics_frequency` (Number) The frequency in seconds at which metrics are emitted.
|
- `metrics_frequency` (Number) The frequency in seconds at which metrics are emitted.
|
||||||
- `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
|
- `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
|
||||||
- `min_replicas_max_lag` (Number) The minimum replicas maximum lag.
|
- `min_replicas_max_lag` (Number) The minimum replicas maximum lag.
|
||||||
- `monitoring_instance_id` (String) The monitoring instance ID.
|
- `monitoring_instance_id` (String) The ID of the STACKIT monitoring instance.
|
||||||
- `notify_keyspace_events` (String) The notify keyspace events.
|
- `notify_keyspace_events` (String) The notify keyspace events.
|
||||||
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
|
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
|
||||||
- `snapshot` (String) The snapshot configuration.
|
- `snapshot` (String) The snapshot configuration.
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ resource "stackit_logme_instance" "example" {
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- schema generated by tfplugindocs -->
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
|
||||||
## Schema
|
## Schema
|
||||||
|
|
||||||
### Required
|
### Required
|
||||||
|
|
@ -50,6 +51,7 @@ resource "stackit_logme_instance" "example" {
|
||||||
- `plan_id` (String) The selected plan ID.
|
- `plan_id` (String) The selected plan ID.
|
||||||
|
|
||||||
<a id="nestedatt--parameters"></a>
|
<a id="nestedatt--parameters"></a>
|
||||||
|
|
||||||
### Nested Schema for `parameters`
|
### Nested Schema for `parameters`
|
||||||
|
|
||||||
Optional:
|
Optional:
|
||||||
|
|
@ -71,7 +73,7 @@ Optional:
|
||||||
- `max_disk_threshold` (Number) The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.
|
- `max_disk_threshold` (Number) The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.
|
||||||
- `metrics_frequency` (Number) The frequency in seconds at which metrics are emitted (in seconds).
|
- `metrics_frequency` (Number) The frequency in seconds at which metrics are emitted (in seconds).
|
||||||
- `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.
|
- `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.
|
||||||
- `monitoring_instance_id` (String) The monitoring instance ID.
|
- `monitoring_instance_id` (String) The ID of the STACKIT monitoring instance.
|
||||||
- `opensearch_tls_ciphers` (List of String)
|
- `opensearch_tls_ciphers` (List of String)
|
||||||
- `opensearch_tls_protocols` (List of String)
|
- `opensearch_tls_protocols` (List of String)
|
||||||
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
|
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ resource "stackit_mariadb_instance" "example" {
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- schema generated by tfplugindocs -->
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
|
||||||
## Schema
|
## Schema
|
||||||
|
|
||||||
### Required
|
### Required
|
||||||
|
|
@ -50,8 +51,16 @@ resource "stackit_mariadb_instance" "example" {
|
||||||
- `plan_id` (String) The selected plan ID.
|
- `plan_id` (String) The selected plan ID.
|
||||||
|
|
||||||
<a id="nestedatt--parameters"></a>
|
<a id="nestedatt--parameters"></a>
|
||||||
|
|
||||||
### Nested Schema for `parameters`
|
### Nested Schema for `parameters`
|
||||||
|
|
||||||
Optional:
|
Optional:
|
||||||
|
|
||||||
- `sgw_acl` (String)
|
- `enable_monitoring` (Boolean) Enable monitoring.
|
||||||
|
- `graphite` (String) Graphite server URL (host and port). If set, monitoring with Graphite will be enabled.
|
||||||
|
- `max_disk_threshold` (Number) The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.
|
||||||
|
- `metrics_frequency` (Number) The frequency in seconds at which metrics are emitted.
|
||||||
|
- `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
|
||||||
|
- `monitoring_instance_id` (String) The ID of the STACKIT monitoring instance.
|
||||||
|
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
|
||||||
|
- `syslog` (List of String) List of syslog servers to send logs to.
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ resource "stackit_rabbitmq_instance" "example" {
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- schema generated by tfplugindocs -->
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
|
||||||
## Schema
|
## Schema
|
||||||
|
|
||||||
### Required
|
### Required
|
||||||
|
|
@ -53,6 +54,7 @@ resource "stackit_rabbitmq_instance" "example" {
|
||||||
- `plan_id` (String) The selected plan ID.
|
- `plan_id` (String) The selected plan ID.
|
||||||
|
|
||||||
<a id="nestedatt--parameters"></a>
|
<a id="nestedatt--parameters"></a>
|
||||||
|
|
||||||
### Nested Schema for `parameters`
|
### Nested Schema for `parameters`
|
||||||
|
|
||||||
Optional:
|
Optional:
|
||||||
|
|
@ -63,7 +65,7 @@ Optional:
|
||||||
- `max_disk_threshold` (Number) The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.
|
- `max_disk_threshold` (Number) The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.
|
||||||
- `metrics_frequency` (Number) The frequency in seconds at which metrics are emitted.
|
- `metrics_frequency` (Number) The frequency in seconds at which metrics are emitted.
|
||||||
- `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
|
- `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
|
||||||
- `monitoring_instance_id` (String) The monitoring instance ID.
|
- `monitoring_instance_id` (String) The ID of the STACKIT monitoring instance.
|
||||||
- `plugins` (List of String) List of plugins to install. Must be a supported plugin name.
|
- `plugins` (List of String) List of plugins to install. Must be a supported plugin name.
|
||||||
- `roles` (List of String) List of roles to assign to the instance.
|
- `roles` (List of String) List of roles to assign to the instance.
|
||||||
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
|
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ resource "stackit_redis_instance" "example" {
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- schema generated by tfplugindocs -->
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
|
||||||
## Schema
|
## Schema
|
||||||
|
|
||||||
### Required
|
### Required
|
||||||
|
|
@ -53,6 +54,7 @@ resource "stackit_redis_instance" "example" {
|
||||||
- `plan_id` (String) The selected plan ID.
|
- `plan_id` (String) The selected plan ID.
|
||||||
|
|
||||||
<a id="nestedatt--parameters"></a>
|
<a id="nestedatt--parameters"></a>
|
||||||
|
|
||||||
### Nested Schema for `parameters`
|
### Nested Schema for `parameters`
|
||||||
|
|
||||||
Optional:
|
Optional:
|
||||||
|
|
@ -71,7 +73,7 @@ Optional:
|
||||||
- `metrics_frequency` (Number) The frequency in seconds at which metrics are emitted.
|
- `metrics_frequency` (Number) The frequency in seconds at which metrics are emitted.
|
||||||
- `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
|
- `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
|
||||||
- `min_replicas_max_lag` (Number) The minimum replicas maximum lag.
|
- `min_replicas_max_lag` (Number) The minimum replicas maximum lag.
|
||||||
- `monitoring_instance_id` (String) The monitoring instance ID.
|
- `monitoring_instance_id` (String) The ID of the STACKIT monitoring instance.
|
||||||
- `notify_keyspace_events` (String) The notify keyspace events.
|
- `notify_keyspace_events` (String) The notify keyspace events.
|
||||||
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
|
- `sgw_acl` (String) Comma separated list of IP networks in CIDR notation which are allowed to access this instance.
|
||||||
- `snapshot` (String) The snapshot configuration.
|
- `snapshot` (String) The snapshot configuration.
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ func (r *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques
|
||||||
"max_disk_threshold": "The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.",
|
"max_disk_threshold": "The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.",
|
||||||
"metrics_frequency": "The frequency in seconds at which metrics are emitted (in seconds).",
|
"metrics_frequency": "The frequency in seconds at which metrics are emitted (in seconds).",
|
||||||
"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.",
|
"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.",
|
||||||
"monitoring_instance_id": "The monitoring instance ID.",
|
"monitoring_instance_id": "The ID of the STACKIT monitoring instance.",
|
||||||
"java_heapspace": "The amount of memory (in MB) allocated as heap by the JVM for OpenSearch.",
|
"java_heapspace": "The amount of memory (in MB) allocated as heap by the JVM for OpenSearch.",
|
||||||
"java_maxmetaspace": "The amount of memory (in MB) used by the JVM to store metadata for OpenSearch.",
|
"java_maxmetaspace": "The amount of memory (in MB) used by the JVM to store metadata for OpenSearch.",
|
||||||
"ism_deletion_after": "Combination of an integer and a timerange when an index will be considered \"old\" and can be deleted. Possible values for the timerange are `s`, `m`, `h` and `d`.",
|
"ism_deletion_after": "Combination of an integer and a timerange when an index will be considered \"old\" and can be deleted. Possible values for the timerange are `s`, `m`, `h` and `d`.",
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r
|
||||||
"max_disk_threshold": "The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.",
|
"max_disk_threshold": "The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.",
|
||||||
"metrics_frequency": "The frequency in seconds at which metrics are emitted (in seconds).",
|
"metrics_frequency": "The frequency in seconds at which metrics are emitted (in seconds).",
|
||||||
"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.",
|
"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.",
|
||||||
"monitoring_instance_id": "The monitoring instance ID.",
|
"monitoring_instance_id": "The ID of the STACKIT monitoring instance.",
|
||||||
"java_heapspace": "The amount of memory (in MB) allocated as heap by the JVM for OpenSearch.",
|
"java_heapspace": "The amount of memory (in MB) allocated as heap by the JVM for OpenSearch.",
|
||||||
"java_maxmetaspace": "The amount of memory (in MB) used by the JVM to store metadata for OpenSearch.",
|
"java_maxmetaspace": "The amount of memory (in MB) used by the JVM to store metadata for OpenSearch.",
|
||||||
"ism_deletion_after": "Combination of an integer and a timerange when an index will be considered \"old\" and can be deleted. Possible values for the timerange are `s`, `m`, `h` and `d`.",
|
"ism_deletion_after": "Combination of an integer and a timerange when an index will be considered \"old\" and can be deleted. Possible values for the timerange are `s`, `m`, `h` and `d`.",
|
||||||
|
|
@ -339,6 +339,10 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r
|
||||||
Description: parametersDescriptions["monitoring_instance_id"],
|
Description: parametersDescriptions["monitoring_instance_id"],
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
Validators: []validator.String{
|
||||||
|
validate.UUID(),
|
||||||
|
validate.NoSeparator(),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"opensearch_tls_ciphers": schema.ListAttribute{
|
"opensearch_tls_ciphers": schema.ListAttribute{
|
||||||
Description: parametersDescriptions["opensearch_tls_ciphers"],
|
Description: parametersDescriptions["opensearch_tls_ciphers"],
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||||
|
|
@ -86,6 +87,16 @@ func (r *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques
|
||||||
"plan_id": "The selected plan ID.",
|
"plan_id": "The selected plan ID.",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parametersDescriptions := map[string]string{
|
||||||
|
"sgw_acl": "Comma separated list of IP networks in CIDR notation which are allowed to access this instance.",
|
||||||
|
"enable_monitoring": "Enable monitoring.",
|
||||||
|
"max_disk_threshold": "The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.",
|
||||||
|
"metrics_frequency": "The frequency in seconds at which metrics are emitted.",
|
||||||
|
"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",
|
||||||
|
"monitoring_instance_id": "The ID of the STACKIT monitoring instance.",
|
||||||
|
"syslog": "List of syslog servers to send logs to.",
|
||||||
|
}
|
||||||
|
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
Description: descriptions["main"],
|
Description: descriptions["main"],
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
|
|
@ -128,7 +139,37 @@ func (r *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques
|
||||||
"parameters": schema.SingleNestedAttribute{
|
"parameters": schema.SingleNestedAttribute{
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"sgw_acl": schema.StringAttribute{
|
"sgw_acl": schema.StringAttribute{
|
||||||
Computed: true,
|
Description: parametersDescriptions["sgw_acl"],
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"enable_monitoring": schema.BoolAttribute{
|
||||||
|
Description: parametersDescriptions["enable_monitoring"],
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"graphite": schema.StringAttribute{
|
||||||
|
Description: parametersDescriptions["graphite"],
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"max_disk_threshold": schema.Int64Attribute{
|
||||||
|
Description: parametersDescriptions["max_disk_threshold"],
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"metrics_frequency": schema.Int64Attribute{
|
||||||
|
Description: parametersDescriptions["metrics_frequency"],
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"metrics_prefix": schema.StringAttribute{
|
||||||
|
Description: parametersDescriptions["metrics_prefix"],
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"monitoring_instance_id": schema.StringAttribute{
|
||||||
|
Description: parametersDescriptions["monitoring_instance_id"],
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"syslog": schema.ListAttribute{
|
||||||
|
Description: parametersDescriptions["syslog"],
|
||||||
|
ElementType: types.StringType,
|
||||||
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
|
|
||||||
|
|
@ -52,12 +52,26 @@ type Model struct {
|
||||||
|
|
||||||
// Struct corresponding to DataSourceModel.Parameters
|
// Struct corresponding to DataSourceModel.Parameters
|
||||||
type parametersModel struct {
|
type parametersModel struct {
|
||||||
SgwAcl types.String `tfsdk:"sgw_acl"`
|
SgwAcl types.String `tfsdk:"sgw_acl"`
|
||||||
|
EnableMonitoring types.Bool `tfsdk:"enable_monitoring"`
|
||||||
|
Graphite types.String `tfsdk:"graphite"`
|
||||||
|
MaxDiskThreshold types.Int64 `tfsdk:"max_disk_threshold"`
|
||||||
|
MetricsFrequency types.Int64 `tfsdk:"metrics_frequency"`
|
||||||
|
MetricsPrefix types.String `tfsdk:"metrics_prefix"`
|
||||||
|
MonitoringInstanceId types.String `tfsdk:"monitoring_instance_id"`
|
||||||
|
Syslog types.List `tfsdk:"syslog"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Types corresponding to parametersModel
|
// Types corresponding to parametersModel
|
||||||
var parametersTypes = map[string]attr.Type{
|
var parametersTypes = map[string]attr.Type{
|
||||||
"sgw_acl": basetypes.StringType{},
|
"sgw_acl": basetypes.StringType{},
|
||||||
|
"enable_monitoring": basetypes.BoolType{},
|
||||||
|
"graphite": basetypes.StringType{},
|
||||||
|
"max_disk_threshold": basetypes.Int64Type{},
|
||||||
|
"metrics_frequency": basetypes.Int64Type{},
|
||||||
|
"metrics_prefix": basetypes.StringType{},
|
||||||
|
"monitoring_instance_id": basetypes.StringType{},
|
||||||
|
"syslog": basetypes.ListType{ElemType: types.StringType},
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewInstanceResource is a helper function to simplify the provider implementation.
|
// NewInstanceResource is a helper function to simplify the provider implementation.
|
||||||
|
|
@ -124,6 +138,17 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r
|
||||||
"plan_id": "The selected plan ID.",
|
"plan_id": "The selected plan ID.",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parametersDescriptions := map[string]string{
|
||||||
|
"sgw_acl": "Comma separated list of IP networks in CIDR notation which are allowed to access this instance.",
|
||||||
|
"graphite": "Graphite server URL (host and port). If set, monitoring with Graphite will be enabled.",
|
||||||
|
"enable_monitoring": "Enable monitoring.",
|
||||||
|
"max_disk_threshold": "The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.",
|
||||||
|
"metrics_frequency": "The frequency in seconds at which metrics are emitted.",
|
||||||
|
"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",
|
||||||
|
"monitoring_instance_id": "The ID of the STACKIT monitoring instance.",
|
||||||
|
"syslog": "List of syslog servers to send logs to.",
|
||||||
|
}
|
||||||
|
|
||||||
resp.Schema = schema.Schema{
|
resp.Schema = schema.Schema{
|
||||||
Description: descriptions["main"],
|
Description: descriptions["main"],
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
|
|
@ -183,8 +208,49 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r
|
||||||
"parameters": schema.SingleNestedAttribute{
|
"parameters": schema.SingleNestedAttribute{
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
"sgw_acl": schema.StringAttribute{
|
"sgw_acl": schema.StringAttribute{
|
||||||
Optional: true,
|
Description: parametersDescriptions["sgw_acl"],
|
||||||
Computed: true,
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"enable_monitoring": schema.BoolAttribute{
|
||||||
|
Description: parametersDescriptions["enable_monitoring"],
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"graphite": schema.StringAttribute{
|
||||||
|
Description: parametersDescriptions["graphite"],
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"max_disk_threshold": schema.Int64Attribute{
|
||||||
|
Description: parametersDescriptions["max_disk_threshold"],
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"metrics_frequency": schema.Int64Attribute{
|
||||||
|
Description: parametersDescriptions["metrics_frequency"],
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"metrics_prefix": schema.StringAttribute{
|
||||||
|
Description: parametersDescriptions["metrics_prefix"],
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
"monitoring_instance_id": schema.StringAttribute{
|
||||||
|
Description: parametersDescriptions["monitoring_instance_id"],
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
Validators: []validator.String{
|
||||||
|
validate.UUID(),
|
||||||
|
validate.NoSeparator(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"syslog": schema.ListAttribute{
|
||||||
|
Description: parametersDescriptions["syslog"],
|
||||||
|
ElementType: types.StringType,
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
|
@ -235,8 +301,9 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques
|
||||||
projectId := model.ProjectId.ValueString()
|
projectId := model.ProjectId.ValueString()
|
||||||
ctx = tflog.SetField(ctx, "project_id", projectId)
|
ctx = tflog.SetField(ctx, "project_id", projectId)
|
||||||
|
|
||||||
var parameters = ¶metersModel{}
|
var parameters *parametersModel
|
||||||
if !(model.Parameters.IsNull() || model.Parameters.IsUnknown()) {
|
if !(model.Parameters.IsNull() || model.Parameters.IsUnknown()) {
|
||||||
|
parameters = ¶metersModel{}
|
||||||
diags = model.Parameters.As(ctx, parameters, basetypes.ObjectAsOptions{})
|
diags = model.Parameters.As(ctx, parameters, basetypes.ObjectAsOptions{})
|
||||||
resp.Diagnostics.Append(diags...)
|
resp.Diagnostics.Append(diags...)
|
||||||
if resp.Diagnostics.HasError() {
|
if resp.Diagnostics.HasError() {
|
||||||
|
|
@ -346,8 +413,9 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
||||||
ctx = tflog.SetField(ctx, "project_id", projectId)
|
ctx = tflog.SetField(ctx, "project_id", projectId)
|
||||||
ctx = tflog.SetField(ctx, "instance_id", instanceId)
|
ctx = tflog.SetField(ctx, "instance_id", instanceId)
|
||||||
|
|
||||||
var parameters = ¶metersModel{}
|
var parameters *parametersModel
|
||||||
if !(model.Parameters.IsNull() || model.Parameters.IsUnknown()) {
|
if !(model.Parameters.IsNull() || model.Parameters.IsUnknown()) {
|
||||||
|
parameters = ¶metersModel{}
|
||||||
diags = model.Parameters.As(ctx, parameters, basetypes.ObjectAsOptions{})
|
diags = model.Parameters.As(ctx, parameters, basetypes.ObjectAsOptions{})
|
||||||
resp.Diagnostics.Append(diags...)
|
resp.Diagnostics.Append(diags...)
|
||||||
if resp.Diagnostics.HasError() {
|
if resp.Diagnostics.HasError() {
|
||||||
|
|
@ -584,20 +652,14 @@ func toCreatePayload(model *Model, parameters *parametersModel) (*mariadb.Create
|
||||||
if model == nil {
|
if model == nil {
|
||||||
return nil, fmt.Errorf("nil model")
|
return nil, fmt.Errorf("nil model")
|
||||||
}
|
}
|
||||||
if parameters == nil {
|
payloadParams, err := toInstanceParams(parameters)
|
||||||
return &mariadb.CreateInstancePayload{
|
if err != nil {
|
||||||
InstanceName: conversion.StringValueToPointer(model.Name),
|
return nil, fmt.Errorf("convert parameters: %w", err)
|
||||||
PlanId: conversion.StringValueToPointer(model.PlanId),
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
payloadParams := &mariadb.InstanceParameters{}
|
|
||||||
if parameters.SgwAcl.ValueString() != "" {
|
|
||||||
payloadParams.SgwAcl = conversion.StringValueToPointer(parameters.SgwAcl)
|
|
||||||
}
|
}
|
||||||
return &mariadb.CreateInstancePayload{
|
return &mariadb.CreateInstancePayload{
|
||||||
InstanceName: conversion.StringValueToPointer(model.Name),
|
InstanceName: conversion.StringValueToPointer(model.Name),
|
||||||
Parameters: payloadParams,
|
|
||||||
PlanId: conversion.StringValueToPointer(model.PlanId),
|
PlanId: conversion.StringValueToPointer(model.PlanId),
|
||||||
|
Parameters: payloadParams,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -605,20 +667,39 @@ func toUpdatePayload(model *Model, parameters *parametersModel) (*mariadb.Partia
|
||||||
if model == nil {
|
if model == nil {
|
||||||
return nil, fmt.Errorf("nil model")
|
return nil, fmt.Errorf("nil model")
|
||||||
}
|
}
|
||||||
|
payloadParams, err := toInstanceParams(parameters)
|
||||||
if parameters == nil {
|
if err != nil {
|
||||||
return &mariadb.PartialUpdateInstancePayload{
|
return nil, fmt.Errorf("convert parameters: %w", err)
|
||||||
PlanId: conversion.StringValueToPointer(model.PlanId),
|
|
||||||
}, nil
|
|
||||||
}
|
}
|
||||||
return &mariadb.PartialUpdateInstancePayload{
|
return &mariadb.PartialUpdateInstancePayload{
|
||||||
Parameters: &mariadb.InstanceParameters{
|
PlanId: conversion.StringValueToPointer(model.PlanId),
|
||||||
SgwAcl: conversion.StringValueToPointer(parameters.SgwAcl),
|
Parameters: payloadParams,
|
||||||
},
|
|
||||||
PlanId: conversion.StringValueToPointer(model.PlanId),
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func toInstanceParams(parameters *parametersModel) (*mariadb.InstanceParameters, error) {
|
||||||
|
if parameters == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
payloadParams := &mariadb.InstanceParameters{}
|
||||||
|
|
||||||
|
payloadParams.SgwAcl = conversion.StringValueToPointer(parameters.SgwAcl)
|
||||||
|
payloadParams.EnableMonitoring = conversion.BoolValueToPointer(parameters.EnableMonitoring)
|
||||||
|
payloadParams.Graphite = conversion.StringValueToPointer(parameters.Graphite)
|
||||||
|
payloadParams.MaxDiskThreshold = conversion.Int64ValueToPointer(parameters.MaxDiskThreshold)
|
||||||
|
payloadParams.MetricsFrequency = conversion.Int64ValueToPointer(parameters.MetricsFrequency)
|
||||||
|
payloadParams.MetricsPrefix = conversion.StringValueToPointer(parameters.MetricsPrefix)
|
||||||
|
payloadParams.MonitoringInstanceId = conversion.StringValueToPointer(parameters.MonitoringInstanceId)
|
||||||
|
|
||||||
|
syslog, err := conversion.StringListToPointer(parameters.Syslog)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("convert syslog: %w", err)
|
||||||
|
}
|
||||||
|
payloadParams.Syslog = syslog
|
||||||
|
|
||||||
|
return payloadParams, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (r *instanceResource) loadPlanId(ctx context.Context, model *Model) error {
|
func (r *instanceResource) loadPlanId(ctx context.Context, model *Model) error {
|
||||||
projectId := model.ProjectId.ValueString()
|
projectId := model.ProjectId.ValueString()
|
||||||
res, err := r.client.ListOfferings(ctx, projectId).Execute()
|
res, err := r.client.ListOfferings(ctx, projectId).Execute()
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,53 @@
|
||||||
package mariadb
|
package mariadb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
"github.com/hashicorp/terraform-plugin-framework/attr"
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||||
|
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
|
||||||
"github.com/stackitcloud/stackit-sdk-go/core/utils"
|
"github.com/stackitcloud/stackit-sdk-go/core/utils"
|
||||||
"github.com/stackitcloud/stackit-sdk-go/services/mariadb"
|
"github.com/stackitcloud/stackit-sdk-go/services/mariadb"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var fixtureModelParameters = types.ObjectValueMust(parametersTypes, map[string]attr.Value{
|
||||||
|
"sgw_acl": types.StringValue("acl"),
|
||||||
|
"enable_monitoring": types.BoolValue(true),
|
||||||
|
"graphite": types.StringValue("graphite"),
|
||||||
|
"max_disk_threshold": types.Int64Value(10),
|
||||||
|
"metrics_frequency": types.Int64Value(10),
|
||||||
|
"metrics_prefix": types.StringValue("prefix"),
|
||||||
|
"monitoring_instance_id": types.StringValue("mid"),
|
||||||
|
"syslog": types.ListValueMust(types.StringType, []attr.Value{
|
||||||
|
types.StringValue("syslog"),
|
||||||
|
types.StringValue("syslog2"),
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
var fixtureNullModelParameters = types.ObjectValueMust(parametersTypes, map[string]attr.Value{
|
||||||
|
"sgw_acl": types.StringNull(),
|
||||||
|
"enable_monitoring": types.BoolNull(),
|
||||||
|
"graphite": types.StringNull(),
|
||||||
|
"max_disk_threshold": types.Int64Null(),
|
||||||
|
"metrics_frequency": types.Int64Null(),
|
||||||
|
"metrics_prefix": types.StringNull(),
|
||||||
|
"monitoring_instance_id": types.StringNull(),
|
||||||
|
"syslog": types.ListNull(types.StringType),
|
||||||
|
})
|
||||||
|
|
||||||
|
var fixtureInstanceParameters = mariadb.InstanceParameters{
|
||||||
|
SgwAcl: utils.Ptr("acl"),
|
||||||
|
EnableMonitoring: utils.Ptr(true),
|
||||||
|
Graphite: utils.Ptr("graphite"),
|
||||||
|
MaxDiskThreshold: utils.Ptr(int64(10)),
|
||||||
|
MetricsFrequency: utils.Ptr(int64(10)),
|
||||||
|
MetricsPrefix: utils.Ptr("prefix"),
|
||||||
|
MonitoringInstanceId: utils.Ptr("mid"),
|
||||||
|
Syslog: &[]string{"syslog", "syslog2"},
|
||||||
|
}
|
||||||
|
|
||||||
func TestMapFields(t *testing.T) {
|
func TestMapFields(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
description string
|
description string
|
||||||
|
|
@ -47,7 +85,14 @@ func TestMapFields(t *testing.T) {
|
||||||
Name: utils.Ptr("name"),
|
Name: utils.Ptr("name"),
|
||||||
CfOrganizationGuid: utils.Ptr("org"),
|
CfOrganizationGuid: utils.Ptr("org"),
|
||||||
Parameters: &map[string]interface{}{
|
Parameters: &map[string]interface{}{
|
||||||
"sgw_acl": "acl",
|
"sgw_acl": "acl",
|
||||||
|
"enable_monitoring": true,
|
||||||
|
"graphite": "graphite",
|
||||||
|
"max_disk_threshold": int64(10),
|
||||||
|
"metrics_frequency": int64(10),
|
||||||
|
"metrics_prefix": "prefix",
|
||||||
|
"monitoring_instance_id": "mid",
|
||||||
|
"syslog": []string{"syslog", "syslog2"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Model{
|
Model{
|
||||||
|
|
@ -61,9 +106,7 @@ func TestMapFields(t *testing.T) {
|
||||||
DashboardUrl: types.StringValue("dashboard"),
|
DashboardUrl: types.StringValue("dashboard"),
|
||||||
ImageUrl: types.StringValue("image"),
|
ImageUrl: types.StringValue("image"),
|
||||||
CfOrganizationGuid: types.StringValue("org"),
|
CfOrganizationGuid: types.StringValue("org"),
|
||||||
Parameters: types.ObjectValueMust(parametersTypes, map[string]attr.Value{
|
Parameters: fixtureModelParameters,
|
||||||
"sgw_acl": types.StringValue("acl"),
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
|
|
@ -125,61 +168,48 @@ func TestMapFields(t *testing.T) {
|
||||||
|
|
||||||
func TestToCreatePayload(t *testing.T) {
|
func TestToCreatePayload(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
description string
|
description string
|
||||||
input *Model
|
input *Model
|
||||||
inputParameters *parametersModel
|
expected *mariadb.CreateInstancePayload
|
||||||
expected *mariadb.CreateInstancePayload
|
isValid bool
|
||||||
isValid bool
|
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"default_values",
|
"default_values",
|
||||||
&Model{},
|
&Model{},
|
||||||
¶metersModel{},
|
&mariadb.CreateInstancePayload{},
|
||||||
&mariadb.CreateInstancePayload{
|
|
||||||
Parameters: &mariadb.InstanceParameters{},
|
|
||||||
},
|
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"simple_values",
|
"simple_values",
|
||||||
&Model{
|
&Model{
|
||||||
Name: types.StringValue("name"),
|
Name: types.StringValue("name"),
|
||||||
PlanId: types.StringValue("plan"),
|
PlanId: types.StringValue("plan"),
|
||||||
},
|
Parameters: fixtureModelParameters,
|
||||||
¶metersModel{
|
|
||||||
SgwAcl: types.StringValue("sgw"),
|
|
||||||
},
|
},
|
||||||
&mariadb.CreateInstancePayload{
|
&mariadb.CreateInstancePayload{
|
||||||
InstanceName: utils.Ptr("name"),
|
InstanceName: utils.Ptr("name"),
|
||||||
Parameters: &mariadb.InstanceParameters{
|
Parameters: &fixtureInstanceParameters,
|
||||||
SgwAcl: utils.Ptr("sgw"),
|
PlanId: utils.Ptr("plan"),
|
||||||
},
|
|
||||||
PlanId: utils.Ptr("plan"),
|
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"null_fields_and_int_conversions",
|
"null_fields_and_int_conversions",
|
||||||
&Model{
|
&Model{
|
||||||
Name: types.StringValue(""),
|
Name: types.StringValue(""),
|
||||||
PlanId: types.StringValue(""),
|
PlanId: types.StringValue(""),
|
||||||
},
|
Parameters: fixtureNullModelParameters,
|
||||||
¶metersModel{
|
|
||||||
SgwAcl: types.StringNull(),
|
|
||||||
},
|
},
|
||||||
&mariadb.CreateInstancePayload{
|
&mariadb.CreateInstancePayload{
|
||||||
InstanceName: utils.Ptr(""),
|
InstanceName: utils.Ptr(""),
|
||||||
Parameters: &mariadb.InstanceParameters{
|
Parameters: &mariadb.InstanceParameters{},
|
||||||
SgwAcl: nil,
|
PlanId: utils.Ptr(""),
|
||||||
},
|
|
||||||
PlanId: utils.Ptr(""),
|
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nil_model",
|
"nil_model",
|
||||||
nil,
|
nil,
|
||||||
¶metersModel{},
|
|
||||||
nil,
|
nil,
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
|
|
@ -189,7 +219,6 @@ func TestToCreatePayload(t *testing.T) {
|
||||||
Name: types.StringValue("name"),
|
Name: types.StringValue("name"),
|
||||||
PlanId: types.StringValue("plan"),
|
PlanId: types.StringValue("plan"),
|
||||||
},
|
},
|
||||||
nil,
|
|
||||||
&mariadb.CreateInstancePayload{
|
&mariadb.CreateInstancePayload{
|
||||||
InstanceName: utils.Ptr("name"),
|
InstanceName: utils.Ptr("name"),
|
||||||
PlanId: utils.Ptr("plan"),
|
PlanId: utils.Ptr("plan"),
|
||||||
|
|
@ -199,7 +228,17 @@ func TestToCreatePayload(t *testing.T) {
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.description, func(t *testing.T) {
|
t.Run(tt.description, func(t *testing.T) {
|
||||||
output, err := toCreatePayload(tt.input, tt.inputParameters)
|
var parameters *parametersModel
|
||||||
|
if tt.input != nil {
|
||||||
|
if !(tt.input.Parameters.IsNull() || tt.input.Parameters.IsUnknown()) {
|
||||||
|
parameters = ¶metersModel{}
|
||||||
|
diags := tt.input.Parameters.As(context.Background(), parameters, basetypes.ObjectAsOptions{})
|
||||||
|
if diags.HasError() {
|
||||||
|
t.Fatalf("Error converting parameters: %v", diags.Errors())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
output, err := toCreatePayload(tt.input, parameters)
|
||||||
if !tt.isValid && err == nil {
|
if !tt.isValid && err == nil {
|
||||||
t.Fatalf("Should have failed")
|
t.Fatalf("Should have failed")
|
||||||
}
|
}
|
||||||
|
|
@ -218,57 +257,44 @@ func TestToCreatePayload(t *testing.T) {
|
||||||
|
|
||||||
func TestToUpdatePayload(t *testing.T) {
|
func TestToUpdatePayload(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
description string
|
description string
|
||||||
input *Model
|
input *Model
|
||||||
inputParameters *parametersModel
|
expected *mariadb.PartialUpdateInstancePayload
|
||||||
expected *mariadb.PartialUpdateInstancePayload
|
isValid bool
|
||||||
isValid bool
|
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"default_values",
|
"default_values",
|
||||||
&Model{},
|
&Model{},
|
||||||
¶metersModel{},
|
&mariadb.PartialUpdateInstancePayload{},
|
||||||
&mariadb.PartialUpdateInstancePayload{
|
|
||||||
Parameters: &mariadb.InstanceParameters{},
|
|
||||||
},
|
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"simple_values",
|
"simple_values",
|
||||||
&Model{
|
&Model{
|
||||||
PlanId: types.StringValue("plan"),
|
PlanId: types.StringValue("plan"),
|
||||||
},
|
Parameters: fixtureModelParameters,
|
||||||
¶metersModel{
|
|
||||||
SgwAcl: types.StringValue("sgw"),
|
|
||||||
},
|
},
|
||||||
&mariadb.PartialUpdateInstancePayload{
|
&mariadb.PartialUpdateInstancePayload{
|
||||||
Parameters: &mariadb.InstanceParameters{
|
Parameters: &fixtureInstanceParameters,
|
||||||
SgwAcl: utils.Ptr("sgw"),
|
PlanId: utils.Ptr("plan"),
|
||||||
},
|
|
||||||
PlanId: utils.Ptr("plan"),
|
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"null_fields_and_int_conversions",
|
"null_fields_and_int_conversions",
|
||||||
&Model{
|
&Model{
|
||||||
PlanId: types.StringValue(""),
|
PlanId: types.StringValue(""),
|
||||||
},
|
Parameters: fixtureNullModelParameters,
|
||||||
¶metersModel{
|
|
||||||
SgwAcl: types.StringNull(),
|
|
||||||
},
|
},
|
||||||
&mariadb.PartialUpdateInstancePayload{
|
&mariadb.PartialUpdateInstancePayload{
|
||||||
Parameters: &mariadb.InstanceParameters{
|
Parameters: &mariadb.InstanceParameters{},
|
||||||
SgwAcl: nil,
|
PlanId: utils.Ptr(""),
|
||||||
},
|
|
||||||
PlanId: utils.Ptr(""),
|
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nil_model",
|
"nil_model",
|
||||||
nil,
|
nil,
|
||||||
¶metersModel{},
|
|
||||||
nil,
|
nil,
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
|
|
@ -277,7 +303,6 @@ func TestToUpdatePayload(t *testing.T) {
|
||||||
&Model{
|
&Model{
|
||||||
PlanId: types.StringValue("plan"),
|
PlanId: types.StringValue("plan"),
|
||||||
},
|
},
|
||||||
nil,
|
|
||||||
&mariadb.PartialUpdateInstancePayload{
|
&mariadb.PartialUpdateInstancePayload{
|
||||||
PlanId: utils.Ptr("plan"),
|
PlanId: utils.Ptr("plan"),
|
||||||
},
|
},
|
||||||
|
|
@ -286,7 +311,17 @@ func TestToUpdatePayload(t *testing.T) {
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.description, func(t *testing.T) {
|
t.Run(tt.description, func(t *testing.T) {
|
||||||
output, err := toUpdatePayload(tt.input, tt.inputParameters)
|
var parameters *parametersModel
|
||||||
|
if tt.input != nil {
|
||||||
|
if !(tt.input.Parameters.IsNull() || tt.input.Parameters.IsUnknown()) {
|
||||||
|
parameters = ¶metersModel{}
|
||||||
|
diags := tt.input.Parameters.As(context.Background(), parameters, basetypes.ObjectAsOptions{})
|
||||||
|
if diags.HasError() {
|
||||||
|
t.Fatalf("Error converting parameters: %v", diags.Errors())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
output, err := toUpdatePayload(tt.input, parameters)
|
||||||
if !tt.isValid && err == nil {
|
if !tt.isValid && err == nil {
|
||||||
t.Fatalf("Should have failed")
|
t.Fatalf("Should have failed")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,39 @@ import (
|
||||||
|
|
||||||
// Instance resource data
|
// Instance resource data
|
||||||
var instanceResource = map[string]string{
|
var instanceResource = map[string]string{
|
||||||
"project_id": testutil.ProjectId,
|
"project_id": testutil.ProjectId,
|
||||||
"name": testutil.ResourceNameWithDateTime("mariadb"),
|
"name": testutil.ResourceNameWithDateTime("mariadb"),
|
||||||
"plan_id": "683be856-3587-42de-b1b5-a792ff854f52",
|
"plan_id": "683be856-3587-42de-b1b5-a792ff854f52",
|
||||||
"plan_name": "stackit-mariadb-1.4.10-single",
|
"plan_name": "stackit-mariadb-1.4.10-single",
|
||||||
"version": "10.6",
|
"version": "10.6",
|
||||||
"sgw_acl-1": "192.168.0.0/16",
|
"sgw_acl-1": "192.168.0.0/16",
|
||||||
"sgw_acl-2": "192.168.0.0/24",
|
"sgw_acl-2": "192.168.0.0/24",
|
||||||
|
"max_disk_threshold": "80",
|
||||||
|
"enable_monitoring": "false",
|
||||||
|
"metrics_prefix": "stackit_acc",
|
||||||
|
"syslog-0": "syslog.example.com:514",
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceConfig(acls string) string {
|
func parametersConfig(params map[string]string) string {
|
||||||
|
nonStringParams := []string{
|
||||||
|
"enable_monitoring",
|
||||||
|
"max_disk_threshold",
|
||||||
|
"metrics_frequency",
|
||||||
|
"syslog",
|
||||||
|
}
|
||||||
|
parameters := "parameters = {"
|
||||||
|
for k, v := range params {
|
||||||
|
if utils.Contains(nonStringParams, k) {
|
||||||
|
parameters += fmt.Sprintf("%s = %s\n", k, v)
|
||||||
|
} else {
|
||||||
|
parameters += fmt.Sprintf("%s = %q\n", k, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parameters += "\n}"
|
||||||
|
return parameters
|
||||||
|
}
|
||||||
|
|
||||||
|
func resourceConfig(params map[string]string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
%s
|
%s
|
||||||
|
|
||||||
|
|
@ -36,9 +59,7 @@ func resourceConfig(acls string) string {
|
||||||
name = "%s"
|
name = "%s"
|
||||||
plan_name = "%s"
|
plan_name = "%s"
|
||||||
version = "%s"
|
version = "%s"
|
||||||
parameters = {
|
%s
|
||||||
sgw_acl = "%s"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "stackit_mariadb_credential" "credential" {
|
resource "stackit_mariadb_credential" "credential" {
|
||||||
|
|
@ -51,7 +72,7 @@ func resourceConfig(acls string) string {
|
||||||
instanceResource["name"],
|
instanceResource["name"],
|
||||||
instanceResource["plan_name"],
|
instanceResource["plan_name"],
|
||||||
instanceResource["version"],
|
instanceResource["version"],
|
||||||
acls,
|
parametersConfig(params),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
func TestAccMariaDBResource(t *testing.T) {
|
func TestAccMariaDBResource(t *testing.T) {
|
||||||
|
|
@ -62,7 +83,15 @@ func TestAccMariaDBResource(t *testing.T) {
|
||||||
|
|
||||||
// Creation
|
// Creation
|
||||||
{
|
{
|
||||||
Config: resourceConfig(instanceResource["sgw_acl-1"]),
|
Config: resourceConfig(
|
||||||
|
map[string]string{
|
||||||
|
"sgw_acl": instanceResource["sgw_acl-1"],
|
||||||
|
"max_disk_threshold": instanceResource["max_disk_threshold"],
|
||||||
|
"metrics_frequency": "10",
|
||||||
|
"enable_monitoring": instanceResource["enable_monitoring"],
|
||||||
|
"metrics_prefix": instanceResource["metrics_prefix"],
|
||||||
|
"syslog": fmt.Sprintf(`[%q]`, instanceResource["syslog-0"]),
|
||||||
|
}),
|
||||||
Check: resource.ComposeAggregateTestCheckFunc(
|
Check: resource.ComposeAggregateTestCheckFunc(
|
||||||
// Instance data
|
// Instance data
|
||||||
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "project_id", instanceResource["project_id"]),
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "project_id", instanceResource["project_id"]),
|
||||||
|
|
@ -72,6 +101,12 @@ func TestAccMariaDBResource(t *testing.T) {
|
||||||
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "version", instanceResource["version"]),
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "version", instanceResource["version"]),
|
||||||
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "name", instanceResource["name"]),
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "name", instanceResource["name"]),
|
||||||
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "parameters.sgw_acl", instanceResource["sgw_acl-1"]),
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "parameters.sgw_acl", instanceResource["sgw_acl-1"]),
|
||||||
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "parameters.max_disk_threshold", instanceResource["max_disk_threshold"]),
|
||||||
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "parameters.metrics_frequency", "10"),
|
||||||
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "parameters.enable_monitoring", instanceResource["enable_monitoring"]),
|
||||||
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "parameters.metrics_prefix", instanceResource["metrics_prefix"]),
|
||||||
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "parameters.syslog.#", "1"),
|
||||||
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "parameters.syslog.0", instanceResource["syslog-0"]),
|
||||||
|
|
||||||
// Credential data
|
// Credential data
|
||||||
resource.TestCheckResourceAttrPair(
|
resource.TestCheckResourceAttrPair(
|
||||||
|
|
@ -101,7 +136,14 @@ func TestAccMariaDBResource(t *testing.T) {
|
||||||
instance_id = stackit_mariadb_credential.credential.instance_id
|
instance_id = stackit_mariadb_credential.credential.instance_id
|
||||||
credential_id = stackit_mariadb_credential.credential.credential_id
|
credential_id = stackit_mariadb_credential.credential.credential_id
|
||||||
}`,
|
}`,
|
||||||
resourceConfig(instanceResource["sgw_acl-1"]),
|
resourceConfig(map[string]string{
|
||||||
|
"sgw_acl": instanceResource["sgw_acl-1"],
|
||||||
|
"max_disk_threshold": instanceResource["max_disk_threshold"],
|
||||||
|
"metrics_frequency": "10",
|
||||||
|
"enable_monitoring": instanceResource["enable_monitoring"],
|
||||||
|
"metrics_prefix": instanceResource["metrics_prefix"],
|
||||||
|
"syslog": fmt.Sprintf(`[%q]`, instanceResource["syslog-0"]),
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
Check: resource.ComposeAggregateTestCheckFunc(
|
Check: resource.ComposeAggregateTestCheckFunc(
|
||||||
// Instance data
|
// Instance data
|
||||||
|
|
@ -113,6 +155,12 @@ func TestAccMariaDBResource(t *testing.T) {
|
||||||
resource.TestCheckResourceAttr("data.stackit_mariadb_instance.instance", "plan_id", instanceResource["plan_id"]),
|
resource.TestCheckResourceAttr("data.stackit_mariadb_instance.instance", "plan_id", instanceResource["plan_id"]),
|
||||||
resource.TestCheckResourceAttr("data.stackit_mariadb_instance.instance", "name", instanceResource["name"]),
|
resource.TestCheckResourceAttr("data.stackit_mariadb_instance.instance", "name", instanceResource["name"]),
|
||||||
resource.TestCheckResourceAttr("data.stackit_mariadb_instance.instance", "parameters.sgw_acl", instanceResource["sgw_acl-1"]),
|
resource.TestCheckResourceAttr("data.stackit_mariadb_instance.instance", "parameters.sgw_acl", instanceResource["sgw_acl-1"]),
|
||||||
|
resource.TestCheckResourceAttr("data.stackit_mariadb_instance.instance", "parameters.max_disk_threshold", instanceResource["max_disk_threshold"]),
|
||||||
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "parameters.metrics_frequency", "10"),
|
||||||
|
resource.TestCheckResourceAttr("data.stackit_mariadb_instance.instance", "parameters.enable_monitoring", instanceResource["enable_monitoring"]),
|
||||||
|
resource.TestCheckResourceAttr("data.stackit_mariadb_instance.instance", "parameters.metrics_prefix", instanceResource["metrics_prefix"]),
|
||||||
|
resource.TestCheckResourceAttr("data.stackit_mariadb_instance.instance", "parameters.syslog.#", "1"),
|
||||||
|
resource.TestCheckResourceAttr("data.stackit_mariadb_instance.instance", "parameters.syslog.0", instanceResource["syslog-0"]),
|
||||||
|
|
||||||
// Credential data
|
// Credential data
|
||||||
resource.TestCheckResourceAttr("data.stackit_mariadb_credential.credential", "project_id", instanceResource["project_id"]),
|
resource.TestCheckResourceAttr("data.stackit_mariadb_credential.credential", "project_id", instanceResource["project_id"]),
|
||||||
|
|
@ -161,7 +209,14 @@ func TestAccMariaDBResource(t *testing.T) {
|
||||||
},
|
},
|
||||||
// Update
|
// Update
|
||||||
{
|
{
|
||||||
Config: resourceConfig(instanceResource["sgw_acl-2"]),
|
Config: resourceConfig(map[string]string{
|
||||||
|
"sgw_acl": instanceResource["sgw_acl-2"],
|
||||||
|
"max_disk_threshold": instanceResource["max_disk_threshold"],
|
||||||
|
"metrics_frequency": "10",
|
||||||
|
"enable_monitoring": instanceResource["enable_monitoring"],
|
||||||
|
"metrics_prefix": instanceResource["metrics_prefix"],
|
||||||
|
"syslog": fmt.Sprintf(`[%q]`, instanceResource["syslog-0"]),
|
||||||
|
}),
|
||||||
Check: resource.ComposeAggregateTestCheckFunc(
|
Check: resource.ComposeAggregateTestCheckFunc(
|
||||||
// Instance data
|
// Instance data
|
||||||
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "project_id", instanceResource["project_id"]),
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "project_id", instanceResource["project_id"]),
|
||||||
|
|
@ -171,6 +226,12 @@ func TestAccMariaDBResource(t *testing.T) {
|
||||||
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "version", instanceResource["version"]),
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "version", instanceResource["version"]),
|
||||||
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "name", instanceResource["name"]),
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "name", instanceResource["name"]),
|
||||||
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "parameters.sgw_acl", instanceResource["sgw_acl-2"]),
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "parameters.sgw_acl", instanceResource["sgw_acl-2"]),
|
||||||
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "parameters.max_disk_threshold", instanceResource["max_disk_threshold"]),
|
||||||
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "parameters.metrics_frequency", "10"),
|
||||||
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "parameters.enable_monitoring", instanceResource["enable_monitoring"]),
|
||||||
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "parameters.metrics_prefix", instanceResource["metrics_prefix"]),
|
||||||
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "parameters.syslog.#", "1"),
|
||||||
|
resource.TestCheckResourceAttr("stackit_mariadb_instance.instance", "parameters.syslog.0", instanceResource["syslog-0"]),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
// Deletion is done by the framework implicitly
|
// Deletion is done by the framework implicitly
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ func (r *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques
|
||||||
"max_disk_threshold": "The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.",
|
"max_disk_threshold": "The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.",
|
||||||
"metrics_frequency": "The frequency in seconds at which metrics are emitted.",
|
"metrics_frequency": "The frequency in seconds at which metrics are emitted.",
|
||||||
"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",
|
"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",
|
||||||
"monitoring_instance_id": "The monitoring instance ID.",
|
"monitoring_instance_id": "The ID of the STACKIT monitoring instance.",
|
||||||
"plugins": "List of plugins to install. Must be a supported plugin name.",
|
"plugins": "List of plugins to install. Must be a supported plugin name.",
|
||||||
"roles": "List of roles to assign to the instance.",
|
"roles": "List of roles to assign to the instance.",
|
||||||
"syslog": "List of syslog servers to send logs to.",
|
"syslog": "List of syslog servers to send logs to.",
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r
|
||||||
"max_disk_threshold": "The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.",
|
"max_disk_threshold": "The maximum disk threshold in MB. If the disk usage exceeds this threshold, the instance will be stopped.",
|
||||||
"metrics_frequency": "The frequency in seconds at which metrics are emitted.",
|
"metrics_frequency": "The frequency in seconds at which metrics are emitted.",
|
||||||
"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",
|
"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",
|
||||||
"monitoring_instance_id": "The monitoring instance ID.",
|
"monitoring_instance_id": "The ID of the STACKIT monitoring instance.",
|
||||||
"plugins": "List of plugins to install. Must be a supported plugin name.",
|
"plugins": "List of plugins to install. Must be a supported plugin name.",
|
||||||
"roles": "List of roles to assign to the instance.",
|
"roles": "List of roles to assign to the instance.",
|
||||||
"syslog": "List of syslog servers to send logs to.",
|
"syslog": "List of syslog servers to send logs to.",
|
||||||
|
|
@ -261,6 +261,10 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r
|
||||||
Description: parametersDescriptions["monitoring_instance_id"],
|
Description: parametersDescriptions["monitoring_instance_id"],
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
Validators: []validator.String{
|
||||||
|
validate.UUID(),
|
||||||
|
validate.NoSeparator(),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"plugins": schema.ListAttribute{
|
"plugins": schema.ListAttribute{
|
||||||
Description: parametersDescriptions["plugins"],
|
Description: parametersDescriptions["plugins"],
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ func (r *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques
|
||||||
"metrics_frequency": "The frequency in seconds at which metrics are emitted.",
|
"metrics_frequency": "The frequency in seconds at which metrics are emitted.",
|
||||||
"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",
|
"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",
|
||||||
"min_replicas_max_lag": "The minimum replicas maximum lag.",
|
"min_replicas_max_lag": "The minimum replicas maximum lag.",
|
||||||
"monitoring_instance_id": "The monitoring instance ID.",
|
"monitoring_instance_id": "The ID of the STACKIT monitoring instance.",
|
||||||
"notify_keyspace_events": "The notify keyspace events.",
|
"notify_keyspace_events": "The notify keyspace events.",
|
||||||
"snapshot": "The snapshot configuration.",
|
"snapshot": "The snapshot configuration.",
|
||||||
"syslog": "List of syslog servers to send logs to.",
|
"syslog": "List of syslog servers to send logs to.",
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r
|
||||||
"metrics_frequency": "The frequency in seconds at which metrics are emitted.",
|
"metrics_frequency": "The frequency in seconds at which metrics are emitted.",
|
||||||
"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",
|
"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",
|
||||||
"min_replicas_max_lag": "The minimum replicas maximum lag.",
|
"min_replicas_max_lag": "The minimum replicas maximum lag.",
|
||||||
"monitoring_instance_id": "The monitoring instance ID.",
|
"monitoring_instance_id": "The ID of the STACKIT monitoring instance.",
|
||||||
"notify_keyspace_events": "The notify keyspace events.",
|
"notify_keyspace_events": "The notify keyspace events.",
|
||||||
"snapshot": "The snapshot configuration.",
|
"snapshot": "The snapshot configuration.",
|
||||||
"syslog": "List of syslog servers to send logs to.",
|
"syslog": "List of syslog servers to send logs to.",
|
||||||
|
|
@ -329,6 +329,10 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r
|
||||||
Description: parametersDescriptions["monitoring_instance_id"],
|
Description: parametersDescriptions["monitoring_instance_id"],
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
Validators: []validator.String{
|
||||||
|
validate.UUID(),
|
||||||
|
validate.NoSeparator(),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"notify_keyspace_events": schema.StringAttribute{
|
"notify_keyspace_events": schema.StringAttribute{
|
||||||
Description: parametersDescriptions["notify_keyspace_events"],
|
Description: parametersDescriptions["notify_keyspace_events"],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue