Skip to content

Commit

Permalink
Pull request #1319: feat(opensearch): add node_group name to hosts li…
Browse files Browse the repository at this point in the history
…st and change type from set to list

Merge in CLOUD/terraform-provider-yandex-mirror from feat/opensearch-hosts to master

Squashed commit of the following:

commit a828b3ce359f7b7050c52767f5259151c0391f6f
Author: Aleksandr Tuliakov <[email protected]>
Date:   Tue Jul 30 21:42:21 2024 +0200

    chore(opensearch): update docs

commit 0bbcb7b30a3f269bb979b00d4ef9ca1670e1c34b
Author: Aleksandr Tuliakov <[email protected]>
Date:   Mon Jul 29 15:58:00 2024 +0200

    chore(opensearch): update changelog

commit dda7e944c9fc88d6703b75b72dd08a3fecc6bc4f
Author: Aleksandr Tuliakov <[email protected]>
Date:   Mon Jul 29 10:52:19 2024 +0200

    feat(opensearch): add node_group name to hosts list and change type from set to list
  • Loading branch information
MrChaos1993 committed Aug 1, 2024
1 parent de9f1a4 commit 677bcd5
Show file tree
Hide file tree
Showing 8 changed files with 374 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .changes/unreleased/FEATURES-20240729-155747.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: FEATURES
body: 'opensearch: add `node_group` name to `hosts` list'
time: 2024-07-29T15:57:47.159745+02:00
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ The `hosts` block supports:

* `assign_public_ip` - Sets whether the host should get a public IP address. Can be either `true` or `false`.

* `node_group` - Name of the node group.

The `maintenance_window` block supports:

* `type` - Type of a maintenance window. Can be either `ANYTIME` or `WEEKLY`. A day and hour need to be specified with the weekly window.
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/mdb_opensearch_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ The `hosts` block supports:

* `assign_public_ip` - Sets whether the host should get a public IP address. Can be either `true` or `false`.

* `node_group` - Name of the node group.

## Import

A cluster can be imported using the `id` of the resource, e.g.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ type dashboardNode struct {
AssignPublicIP types.Bool `tfsdk:"assign_public_ip"`
}

// return StateUpgrader implementation from 0 (prior state version) to 1 (Schema.Version)
// return StateUpgrader implementation from 0 (prior state version) to 2 (Schema.Version)
func NewUpgraderFromV0(ctx context.Context) resource.StateUpgrader {
return resource.StateUpgrader{
PriorSchema: &schema.Schema{
Expand Down Expand Up @@ -266,7 +266,7 @@ func NewUpgraderFromV0(ctx context.Context) resource.StateUpgrader {
},
Description: "Deployment environment of the OpenSearch cluster.",
},
"hosts": common_schema.Hosts(),
"hosts": hostsWithoutNodeGroup(),
"network_id": schema.StringAttribute{
Required: true,
PlanModifiers: []planmodifier.String{
Expand Down Expand Up @@ -430,6 +430,12 @@ func NewUpgraderFromV0(ctx context.Context) resource.StateUpgrader {
return
}

newHosts, diags := transformHosts(ctx, oldModel.Hosts)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
}

newModel := model.OpenSearch{
ID: oldModel.ID,
ClusterID: oldModel.ID,
Expand All @@ -439,7 +445,7 @@ func NewUpgraderFromV0(ctx context.Context) resource.StateUpgrader {
Labels: oldModel.Labels,
Environment: oldModel.Environment,
Config: newConfigObj,
Hosts: oldModel.Hosts,
Hosts: newHosts,
NetworkID: oldModel.NetworkID,
Health: oldModel.Health,
Status: oldModel.Status,
Expand Down
Loading

0 comments on commit 677bcd5

Please sign in to comment.