Skip to content

Commit

Permalink
Remove CSS cluster datastore validation
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirvshivkov committed Apr 5, 2023
1 parent 8519061 commit f15ade7
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 4 deletions.
Expand Up @@ -82,6 +82,30 @@ func TestAccCssClusterV1_tags(t *testing.T) {
})
}

func TestAccCssClusterV1_Opensearch(t *testing.T) {
name := fmt.Sprintf("css-%s", acctest.RandString(10))
var cluster clusters.Cluster

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {
common.TestAccPreCheck(t)
quotas.BookMany(t, sharedFlavorQuotas(t, 2, 40))
},
ProviderFactories: common.TestAccProviderFactories,
CheckDestroy: testAccCheckCssClusterV1Destroy,
Steps: []resource.TestStep{
{
Config: testAccCssClusterV1Opensearch(name),
Check: resource.ComposeTestCheckFunc(
testAccCheckCssClusterV1Exists(resourceClusterName, &cluster),
resource.TestCheckResourceAttr(resourceClusterName, "nodes.#", "1"),
resource.TestCheckResourceAttr(resourceClusterName, "datastore.version", "Opensearch_1.3.6"),
),
},
},
})
}

func TestAccCssClusterV1_validateDiskAndFlavor(t *testing.T) {
name := fmt.Sprintf("css-%s", acctest.RandString(10))

Expand Down Expand Up @@ -481,3 +505,36 @@ resource "opentelekomcloud_css_cluster_v1" "cluster" {
}
`, common.DataSourceSecGroupDefault, common.DataSourceSubnet, name, env.OS_KMS_ID, env.OS_AVAILABILITY_ZONE)
}

func testAccCssClusterV1Opensearch(name string) string {
return fmt.Sprintf(`
%s
%s
resource "opentelekomcloud_css_cluster_v1" "cluster" {
expect_node_num = 1
name = "%s"
node_config {
flavor = "css.medium.8"
network_info {
security_group_id = data.opentelekomcloud_networking_secgroup_v2.default_secgroup.id
network_id = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.network_id
vpc_id = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.vpc_id
}
volume {
volume_type = "COMMON"
size = 40
}
availability_zone = "%s"
}
datastore {
version = "Opensearch_1.3.6"
}
enable_https = true
enable_authority = true
admin_pass = "QwertyUI!"
}
`, common.DataSourceSecGroupDefault, common.DataSourceSubnet, name, env.OS_AVAILABILITY_ZONE)
}
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
"github.com/opentelekomcloud/gophertelekomcloud/openstack/css/v1/clusters"
"github.com/opentelekomcloud/gophertelekomcloud/openstack/css/v1/flavors"
Expand Down Expand Up @@ -161,9 +160,9 @@ func ResourceCssClusterV1() *schema.Resource {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
"7.6.2", "7.9.3", "7.10.2",
}, false),
// ValidateFunc: validation.StringInSlice([]string{
// "7.6.2", "7.9.3", "7.10.2", "Opensearch_1.3.6",
// }, false),
Default: "7.6.2",
},
},
Expand Down
@@ -0,0 +1,5 @@
---
fixes:
- |
**[CSS]** Remove CSS cluster datastore validation ``resource/opentelekomcloud_css_cluster_v1``
(`#2135 <https://github.com/opentelekomcloud/terraform-provider-opentelekomcloud/pull/2135>`_)

0 comments on commit f15ade7

Please sign in to comment.