Skip to content
12 changes: 11 additions & 1 deletion mmv1/products/netapp/StoragePool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,17 @@ properties:
immutable: true
min_version: beta
default_from_api: true
deprecation_message: '`scaleTier` is deprecated and will be removed in a future major release. Use `scaleType` instead.'
- name: 'scaleType'
type: Enum
description: |
The scale type of the storage pool. Defaults to `SCALE_TYPE_DEFAULT` if not specified.
enum_values:
- 'SCALE_TYPE_UNSPECIFIED'
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with other enums in netapp_storage_pool, I am keeping SCALE_TYPE_UNSPECIFIED.

#ref: #16473 (comment)

- 'SCALE_TYPE_DEFAULT'
- 'SCALE_TYPE_SCALEOUT'
immutable: true
default_from_api: true
- name: 'mode'
type: Enum
description: |
Expand All @@ -270,5 +281,4 @@ properties:
- 'DEFAULT'
- 'ONTAP'
immutable: true
min_version: beta
default_from_api: true
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,90 @@ resource "google_netapp_storage_pool" "test_pool" {
`, context)
}

{{- if ne $.TargetVersionName "ga" }}
func TestAccNetappStoragePool_ScaleTierEnterprise(t *testing.T) {
func TestAccNetappStoragePool_ontapMode(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"network_name": acctest.BootstrapSharedServiceNetworkingConnection(t, "gcnv-network-config-3", acctest.ServiceNetworkWithParentService("netapp.servicenetworking.goog")),
"random_suffix": acctest.RandString(t, 10),
}

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
Steps: []resource.TestStep{
{
Config: testAccNetappStoragePool_ontapMode(context),
},
{
ResourceName: "google_netapp_storage_pool.test_pool",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"location", "name", "labels", "terraform_labels"},
},
{
Config: testAccNetappStoragePool_ontapModeUpdate(context),
},
{
ResourceName: "google_netapp_storage_pool.test_pool",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"location", "name", "labels", "terraform_labels"},
},
},
})
}

func testAccNetappStoragePool_ontapMode(context map[string]interface{}) string {
return acctest.Nprintf(`

data "google_compute_network" "default" {
name = "%{network_name}"
}

resource "google_netapp_storage_pool" "test_pool" {
name = "tf-test-pool%{random_suffix}"
location = "us-central1-a"
service_level = "FLEX"
type = "UNIFIED"
mode = "ONTAP"
capacity_gib = "2048"
network = data.google_compute_network.default.id
description = "testing ontap mode"
labels = {
key = "test"
value = "pool"
}
}
`, context)
}

func testAccNetappStoragePool_ontapModeUpdate(context map[string]interface{}) string {
return acctest.Nprintf(`

data "google_compute_network" "default" {
name = "%{network_name}"
}

resource "google_netapp_storage_pool" "test_pool" {
name = "tf-test-pool%{random_suffix}"
location = "us-central1-a"
service_level = "FLEX"
type = "UNIFIED"
mode = "ONTAP"
capacity_gib = "2048"
network = data.google_compute_network.default.id
description = "updated description"
labels = {
key = "test"
value = "pool"
}
total_throughput_mibps = "200"
}
`, context)
}

func TestAccNetappStoragePool_ScaleType(t *testing.T) {
context := map[string]interface{}{
"network_name": acctest.BootstrapSharedServiceNetworkingConnection(t, "gcnv-network-config-3", acctest.ServiceNetworkWithParentService("netapp.servicenetworking.goog")),
"random_suffix": acctest.RandString(t, 10),
Expand All @@ -825,7 +907,7 @@ func TestAccNetappStoragePool_ScaleTierEnterprise(t *testing.T) {
},
Steps: []resource.TestStep{
{
Config: testAccNetappStoragePool_ScaleTierEnterprise(context),
Config: testAccNetappStoragePool_ScaleType(context),
},
{
ResourceName: "google_netapp_storage_pool.test_pool",
Expand All @@ -834,7 +916,7 @@ func TestAccNetappStoragePool_ScaleTierEnterprise(t *testing.T) {
ImportStateVerifyIgnore: []string{"location", "name", "labels", "terraform_labels"},
},
{
Config: testAccNetappStoragePool_ScaleTierEnterprise_update(context),
Config: testAccNetappStoragePool_ScaleType_update(context),
},
{
ResourceName: "google_netapp_storage_pool.test_pool",
Expand All @@ -846,12 +928,12 @@ func TestAccNetappStoragePool_ScaleTierEnterprise(t *testing.T) {
})
}

func testAccNetappStoragePool_ScaleTierEnterprise(context map[string]interface{}) string {
func testAccNetappStoragePool_ScaleType(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_netapp_storage_pool" "test_pool" {
provider = google-beta
name = "tf-test-pool%{random_suffix}"
location = "us-central1-a"
location = "us-central1-c"
service_level = "FLEX"
type = "UNIFIED"
capacity_gib = "12288"
Expand All @@ -861,7 +943,7 @@ resource "google_netapp_storage_pool" "test_pool" {
key = "test"
value = "pool"
}
scale_tier = "SCALE_TIER_ENTERPRISE"
scale_type = "SCALE_TYPE_SCALEOUT"
}

data "google_compute_network" "default" {
Expand All @@ -871,12 +953,12 @@ data "google_compute_network" "default" {
`, context)
}

func testAccNetappStoragePool_ScaleTierEnterprise_update(context map[string]interface{}) string {
func testAccNetappStoragePool_ScaleType_update(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_netapp_storage_pool" "test_pool" {
provider = google-beta
name = "tf-test-pool%{random_suffix}"
location = "us-central1-a"
location = "us-central1-c"
service_level = "FLEX"
type = "UNIFIED"
capacity_gib = "13312"
Expand All @@ -886,7 +968,7 @@ resource "google_netapp_storage_pool" "test_pool" {
key = "test"
value = "pool"
}
scale_tier = "SCALE_TIER_ENTERPRISE"
scale_type = "SCALE_TYPE_SCALEOUT"
}

data "google_compute_network" "default" {
Expand All @@ -896,20 +978,23 @@ data "google_compute_network" "default" {
`, context)
}

func TestAccNetappStoragePool_ontapMode(t *testing.T) {
t.Parallel()

{{- if ne $.TargetVersionName "ga" }}
func TestAccNetappStoragePool_ScaleTier(t *testing.T) {
context := map[string]interface{}{
"network_name": acctest.BootstrapSharedServiceNetworkingConnection(t, "gcnv-network-config-3", acctest.ServiceNetworkWithParentService("netapp.servicenetworking.goog")),
"random_suffix": acctest.RandString(t, 10),
}

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
CheckDestroy: testAccCheckNetappVolumeDestroyProducer(t),
ExternalProviders: map[string]resource.ExternalProvider{
"time": {},
},
Steps: []resource.TestStep{
{
Config: testAccNetappStoragePool_ontapMode(context),
Config: testAccNetappStoragePool_ScaleTier(context),
},
{
ResourceName: "google_netapp_storage_pool.test_pool",
Expand All @@ -918,7 +1003,7 @@ func TestAccNetappStoragePool_ontapMode(t *testing.T) {
ImportStateVerifyIgnore: []string{"location", "name", "labels", "terraform_labels"},
},
{
Config: testAccNetappStoragePool_ontapModeUpdate(context),
Config: testAccNetappStoragePool_ScaleTier_update(context),
},
{
ResourceName: "google_netapp_storage_pool.test_pool",
Expand All @@ -930,51 +1015,52 @@ func TestAccNetappStoragePool_ontapMode(t *testing.T) {
})
}

func testAccNetappStoragePool_ontapMode(context map[string]interface{}) string {
func testAccNetappStoragePool_ScaleTier(context map[string]interface{}) string {
return acctest.Nprintf(`

data "google_compute_network" "default" {
name = "%{network_name}"
resource "google_netapp_storage_pool" "test_pool" {
provider = google-beta
name = "tf-test-pool%{random_suffix}"
location = "us-central1-a"
service_level = "FLEX"
type = "UNIFIED"
capacity_gib = "12288"
network = data.google_compute_network.default.id
description = "this is a test description"
labels = {
key = "test"
value = "pool"
}
scale_tier = "SCALE_TIER_ENTERPRISE"
}

resource "google_netapp_storage_pool" "test_pool" {
name = "tf-test-pool%{random_suffix}"
location = "us-central1-a"
service_level = "FLEX"
type = "UNIFIED"
mode = "ONTAP"
capacity_gib = "2048"
network = data.google_compute_network.default.id
description = "testing ontap mode"
labels = {
key = "test"
value = "pool"
}
data "google_compute_network" "default" {
provider = google-beta
name = "%{network_name}"
}
`, context)
}

func testAccNetappStoragePool_ontapModeUpdate(context map[string]interface{}) string {
func testAccNetappStoragePool_ScaleTier_update(context map[string]interface{}) string {
return acctest.Nprintf(`

data "google_compute_network" "default" {
name = "%{network_name}"
}

resource "google_netapp_storage_pool" "test_pool" {
name = "tf-test-pool%{random_suffix}"
location = "us-central1-a"
service_level = "FLEX"
type = "UNIFIED"
mode = "ONTAP"
capacity_gib = "2048"
network = data.google_compute_network.default.id
description = "updated description"
labels = {
provider = google-beta
name = "tf-test-pool%{random_suffix}"
location = "us-central1-a"
service_level = "FLEX"
type = "UNIFIED"
capacity_gib = "13312"
network = data.google_compute_network.default.id
description = "this is a test description"
labels = {
key = "test"
value = "pool"
}
total_throughput_mibps = "200"
scale_tier = "SCALE_TIER_ENTERPRISE"
}

data "google_compute_network" "default" {
provider = google-beta
name = "%{network_name}"
}
`, context)
}
Expand Down
Loading
Loading