Skip to content

Commit 338c289

Browse files
Abel MarquezMaxrovr
authored andcommitted
Added Support for AutoScale-DB-Vault | ExaDB-XS
1 parent 5483010 commit 338c289

10 files changed

+95
-10
lines changed

examples/database/db_systems/db_exadbxs/exascale_db_storage_vault.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ resource "oci_database_exascale_db_storage_vault" "test_exascale_db_storage_vaul
1212
additional_flash_cache_in_percent = 20
1313
cluster_placement_group_id = var.cpg_id
1414
subscription_id = var.subscription_id
15+
autoscale_limit_in_gbs = var.autoscale_limit_in_gbs
16+
is_autoscale_enabled = var.is_autoscale_enabled
1517
}
1618

1719
data "oci_database_exascale_db_storage_vaults" "test_exascale_db_storage_vaults" {

examples/database/db_systems/db_exadbxs/variables.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,12 @@ variable "cpg_id" {
2727

2828
variable "subscription_id" {
2929
default = null
30+
}
31+
32+
variable "autoscale_limit_in_gbs" {
33+
default = null
34+
}
35+
36+
variable "is_autoscale_enabled" {
37+
default = null
3038
}

internal/integrationtest/database_exadb_vm_cluster_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ var (
200200
`
201201

202202
ExadbVmClusterVariables = `
203-
variable "grid_image_id" {}
204-
`
203+
variable "grid_image_id" {}`
205204

206205
DatabaseExadbVmClusterResourceDependencies = AvailabilityDomainConfig + ExadbVmClusterNetwork + ExadbVmClusterVariables +
207-
acctest.GenerateResourceFromRepresentationMap("oci_database_exascale_db_storage_vault", "test_exascale_db_storage_vault", acctest.Required, acctest.Create, DatabaseExascaleDbStorageVaultRepresentation)
206+
acctest.GenerateResourceFromRepresentationMap("oci_database_exascale_db_storage_vault", "test_exascale_db_storage_vault", acctest.Required, acctest.Create,
207+
DatabaseExascaleDbStorageVaultRepresentation)
208208
)
209209

210210
// issue-routing-tag: database/ExaCS

internal/integrationtest/database_exascale_db_storage_vault_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ var (
5555
"compartment_id": acctest.Representation{RepType: acctest.Required, Create: `${var.compartment_id}`},
5656
"display_name": acctest.Representation{RepType: acctest.Required, Create: `TFExascaleDbStorageVault`, Update: `TFExascaleDbStorageVaultUpdatedName`},
5757
"high_capacity_database_storage": acctest.RepresentationGroup{RepType: acctest.Required, Group: DatabaseExascaleDbStorageVaultHighCapacityDatabaseStorageRepresentation},
58+
"autoscale_limit_in_gbs": acctest.Representation{RepType: acctest.Optional, Create: `1000`, Update: `1800`},
59+
"is_autoscale_enabled": acctest.Representation{RepType: acctest.Optional, Create: `false`, Update: `true`},
5860
"additional_flash_cache_in_percent": acctest.Representation{RepType: acctest.Optional, Create: `20`, Update: `25`},
5961
"description": acctest.Representation{RepType: acctest.Optional, Create: `ExaScale DB Storage Vault - description`, Update: `ExaScale DB Storage Vault - updated description`},
6062
"time_zone": acctest.Representation{RepType: acctest.Optional, Create: `US/Pacific`},
@@ -145,6 +147,7 @@ func TestDatabaseExascaleDbStorageVaultResource_basic(t *testing.T) {
145147
Config: config + compartmentIdVariableStr + DatabaseExascaleDbStorageVaultResourceDependencies +
146148
acctest.GenerateResourceFromRepresentationMap("oci_database_exascale_db_storage_vault", "test_exascale_db_storage_vault", acctest.Optional, acctest.Create, DatabaseExascaleDbStorageVaultRepresentation),
147149
Check: acctest.ComposeAggregateTestCheckFuncWrapper(
150+
resource.TestCheckResourceAttr(resourceName, "autoscale_limit_in_gbs", "1000"),
148151
resource.TestCheckResourceAttrSet(resourceName, "id"),
149152
resource.TestCheckResourceAttrSet(resourceName, "state"),
150153
resource.TestCheckResourceAttrSet(resourceName, "availability_domain"),
@@ -154,6 +157,7 @@ func TestDatabaseExascaleDbStorageVaultResource_basic(t *testing.T) {
154157
resource.TestCheckResourceAttr(resourceName, "attached_shape_attributes.#", "0"), // attached_shape_attributes should be null for a vault with no cluster
155158
//resource.TestCheckResourceAttr(resourceName, "vm_cluster_count", "0"),
156159
resource.TestCheckResourceAttr(resourceName, "high_capacity_database_storage.#", "1"),
160+
resource.TestCheckResourceAttr(resourceName, "is_autoscale_enabled", "false"),
157161
resource.TestCheckResourceAttr(resourceName, "high_capacity_database_storage.0.total_size_in_gbs", "800"),
158162
resource.TestCheckResourceAttr(resourceName, "additional_flash_cache_in_percent", "20"),
159163
resource.TestCheckResourceAttr(resourceName, "description", "ExaScale DB Storage Vault - description"),
@@ -182,6 +186,7 @@ func TestDatabaseExascaleDbStorageVaultResource_basic(t *testing.T) {
182186
"compartment_id": acctest.Representation{RepType: acctest.Required, Create: `${var.compartment_id_for_update}`},
183187
})),
184188
Check: acctest.ComposeAggregateTestCheckFuncWrapper(
189+
resource.TestCheckResourceAttr(resourceName, "autoscale_limit_in_gbs", "1000"),
185190
resource.TestCheckResourceAttrSet(resourceName, "id"),
186191
resource.TestCheckResourceAttrSet(resourceName, "state"),
187192
resource.TestCheckResourceAttrSet(resourceName, "availability_domain"),
@@ -191,6 +196,7 @@ func TestDatabaseExascaleDbStorageVaultResource_basic(t *testing.T) {
191196
resource.TestCheckResourceAttr(resourceName, "attached_shape_attributes.#", "0"), // attached_shape_attributes should be null for a vault with no cluster
192197
//resource.TestCheckResourceAttr(resourceName, "vm_cluster_count", "0"),
193198
resource.TestCheckResourceAttr(resourceName, "high_capacity_database_storage.#", "1"),
199+
resource.TestCheckResourceAttr(resourceName, "is_autoscale_enabled", "false"),
194200
resource.TestCheckResourceAttr(resourceName, "high_capacity_database_storage.0.total_size_in_gbs", "800"),
195201
resource.TestCheckResourceAttr(resourceName, "additional_flash_cache_in_percent", "20"),
196202
resource.TestCheckResourceAttr(resourceName, "description", "ExaScale DB Storage Vault - description"),
@@ -214,6 +220,7 @@ func TestDatabaseExascaleDbStorageVaultResource_basic(t *testing.T) {
214220
Config: config + compartmentIdVariableStr + DatabaseExascaleDbStorageVaultResourceDependencies +
215221
acctest.GenerateResourceFromRepresentationMap("oci_database_exascale_db_storage_vault", "test_exascale_db_storage_vault", acctest.Optional, acctest.Update, DatabaseExascaleDbStorageVaultRepresentation),
216222
Check: acctest.ComposeAggregateTestCheckFuncWrapper(
223+
resource.TestCheckResourceAttr(resourceName, "autoscale_limit_in_gbs", "1800"),
217224
resource.TestCheckResourceAttrSet(resourceName, "id"),
218225
resource.TestCheckResourceAttrSet(resourceName, "state"),
219226
resource.TestCheckResourceAttrSet(resourceName, "availability_domain"),
@@ -223,6 +230,7 @@ func TestDatabaseExascaleDbStorageVaultResource_basic(t *testing.T) {
223230
resource.TestCheckResourceAttr(resourceName, "attached_shape_attributes.#", "0"), // attached_shape_attributes should be null for a vault with no cluster
224231
//resource.TestCheckResourceAttr(resourceName, "vm_cluster_count", "0"),
225232
resource.TestCheckResourceAttr(resourceName, "high_capacity_database_storage.#", "1"),
233+
resource.TestCheckResourceAttr(resourceName, "is_autoscale_enabled", "true"),
226234
resource.TestCheckResourceAttr(resourceName, "high_capacity_database_storage.0.total_size_in_gbs", "1600"),
227235
resource.TestCheckResourceAttr(resourceName, "additional_flash_cache_in_percent", "25"),
228236
resource.TestCheckResourceAttr(resourceName, "description", "ExaScale DB Storage Vault - updated description"),
@@ -253,8 +261,8 @@ func TestDatabaseExascaleDbStorageVaultResource_basic(t *testing.T) {
253261
resource.TestCheckResourceAttr(datasourceName, "display_name", "TFExascaleDbStorageVaultUpdatedName"),
254262
resource.TestCheckResourceAttr(datasourceName, "state", "AVAILABLE"),
255263
resource.TestCheckResourceAttr(datasourceName, "vm_cluster_count_greater_than_or_equal_to", "0"),
256-
257264
resource.TestCheckResourceAttr(datasourceName, "exascale_db_storage_vaults.#", "1"),
265+
resource.TestCheckResourceAttr(datasourceName, "exascale_db_storage_vaults.0.autoscale_limit_in_gbs", "1800"),
258266
resource.TestCheckResourceAttrSet(datasourceName, "exascale_db_storage_vaults.0.id"),
259267
resource.TestCheckResourceAttrSet(datasourceName, "exascale_db_storage_vaults.0.state"),
260268
resource.TestCheckResourceAttrSet(datasourceName, "exascale_db_storage_vaults.0.time_created"),
@@ -265,6 +273,7 @@ func TestDatabaseExascaleDbStorageVaultResource_basic(t *testing.T) {
265273
//resource.TestCheckResourceAttr(datasourceName, "exascale_db_storage_vaults.0.vm_cluster_count", "0"),
266274
resource.TestCheckResourceAttr(datasourceName, "exascale_db_storage_vaults.0.high_capacity_database_storage.#", "1"),
267275
resource.TestCheckResourceAttrSet(datasourceName, "exascale_db_storage_vaults.0.high_capacity_database_storage.0.available_size_in_gbs"),
276+
resource.TestCheckResourceAttr(datasourceName, "exascale_db_storage_vaults.0.is_autoscale_enabled", "true"),
268277
resource.TestCheckResourceAttr(datasourceName, "exascale_db_storage_vaults.0.high_capacity_database_storage.0.total_size_in_gbs", "1600"),
269278
resource.TestCheckResourceAttr(datasourceName, "exascale_db_storage_vaults.0.additional_flash_cache_in_percent", "25"),
270279
resource.TestCheckResourceAttr(datasourceName, "exascale_db_storage_vaults.0.description", "ExaScale DB Storage Vault - updated description"),
@@ -282,6 +291,7 @@ func TestDatabaseExascaleDbStorageVaultResource_basic(t *testing.T) {
282291
Check: acctest.ComposeAggregateTestCheckFuncWrapper(
283292
resource.TestCheckResourceAttrSet(singularDatasourceName, "exascale_db_storage_vault_id"),
284293

294+
resource.TestCheckResourceAttr(singularDatasourceName, "autoscale_limit_in_gbs", "1800"),
285295
resource.TestCheckResourceAttrSet(singularDatasourceName, "id"),
286296
resource.TestCheckResourceAttrSet(singularDatasourceName, "state"),
287297
resource.TestCheckResourceAttrSet(singularDatasourceName, "time_created"),
@@ -292,6 +302,7 @@ func TestDatabaseExascaleDbStorageVaultResource_basic(t *testing.T) {
292302
//resource.TestCheckResourceAttr(singularDatasourceName, "vm_cluster_count", "0"),
293303
resource.TestCheckResourceAttr(singularDatasourceName, "high_capacity_database_storage.#", "1"),
294304
resource.TestCheckResourceAttrSet(singularDatasourceName, "high_capacity_database_storage.0.available_size_in_gbs"),
305+
resource.TestCheckResourceAttr(singularDatasourceName, "is_autoscale_enabled", "true"),
295306
resource.TestCheckResourceAttr(singularDatasourceName, "high_capacity_database_storage.0.total_size_in_gbs", "1600"),
296307
resource.TestCheckResourceAttr(singularDatasourceName, "additional_flash_cache_in_percent", "25"),
297308
resource.TestCheckResourceAttr(singularDatasourceName, "time_zone", "US/Pacific"),

internal/service/database/database_exascale_db_storage_vault_data_source.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ func (s *DatabaseExascaleDbStorageVaultDataSourceCrud) SetData() error {
7272

7373
s.D.Set("attached_shape_attributes", s.Res.AttachedShapeAttributes)
7474

75+
if s.Res.AutoscaleLimitInGBs != nil {
76+
s.D.Set("autoscale_limit_in_gbs", *s.Res.AutoscaleLimitInGBs)
77+
}
78+
7579
if s.Res.AvailabilityDomain != nil {
7680
s.D.Set("availability_domain", *s.Res.AvailabilityDomain)
7781
}
@@ -108,6 +112,10 @@ func (s *DatabaseExascaleDbStorageVaultDataSourceCrud) SetData() error {
108112
s.D.Set("high_capacity_database_storage", nil)
109113
}
110114

115+
if s.Res.IsAutoscaleEnabled != nil {
116+
s.D.Set("is_autoscale_enabled", *s.Res.IsAutoscaleEnabled)
117+
}
118+
111119
if s.Res.LifecycleDetails != nil {
112120
s.D.Set("lifecycle_details", *s.Res.LifecycleDetails)
113121
}

internal/service/database/database_exascale_db_storage_vault_resource.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ func DatabaseExascaleDbStorageVaultResource() *schema.Resource {
7070
Optional: true,
7171
Computed: true,
7272
},
73+
"autoscale_limit_in_gbs": {
74+
Type: schema.TypeInt,
75+
Optional: true,
76+
Computed: true,
77+
},
7378
"cluster_placement_group_id": {
7479
Type: schema.TypeString,
7580
Optional: true,
@@ -100,6 +105,11 @@ func DatabaseExascaleDbStorageVaultResource() *schema.Resource {
100105
Computed: true,
101106
Elem: schema.TypeString,
102107
},
108+
"is_autoscale_enabled": {
109+
Type: schema.TypeBool,
110+
Optional: true,
111+
Computed: true,
112+
},
103113
"subscription_id": {
104114
Type: schema.TypeString,
105115
Optional: true,
@@ -245,6 +255,11 @@ func (s *DatabaseExascaleDbStorageVaultResourceCrud) Create() error {
245255
request.AdditionalFlashCacheInPercent = &tmp
246256
}
247257

258+
if autoscaleLimitInGBs, ok := s.D.GetOkExists("autoscale_limit_in_gbs"); ok {
259+
tmp := autoscaleLimitInGBs.(int)
260+
request.AutoscaleLimitInGBs = &tmp
261+
}
262+
248263
if availabilityDomain, ok := s.D.GetOkExists("availability_domain"); ok {
249264
tmp := availabilityDomain.(string)
250265
request.AvailabilityDomain = &tmp
@@ -298,6 +313,11 @@ func (s *DatabaseExascaleDbStorageVaultResourceCrud) Create() error {
298313
}
299314
}
300315

316+
if isAutoscaleEnabled, ok := s.D.GetOkExists("is_autoscale_enabled"); ok {
317+
tmp := isAutoscaleEnabled.(bool)
318+
request.IsAutoscaleEnabled = &tmp
319+
}
320+
301321
if subscriptionId, ok := s.D.GetOkExists("subscription_id"); ok {
302322
tmp := subscriptionId.(string)
303323
request.SubscriptionId = &tmp
@@ -370,6 +390,11 @@ func (s *DatabaseExascaleDbStorageVaultResourceCrud) Update() error {
370390
request.AdditionalFlashCacheInPercent = &tmp
371391
}
372392

393+
if autoscaleLimitInGBs, ok := s.D.GetOkExists("autoscale_limit_in_gbs"); ok {
394+
tmp := autoscaleLimitInGBs.(int)
395+
request.AutoscaleLimitInGBs = &tmp
396+
}
397+
373398
if definedTags, ok := s.D.GetOkExists("defined_tags"); ok {
374399
convertedDefinedTags, err := tfresource.MapToDefinedTags(definedTags.(map[string]interface{}))
375400
if err != nil {
@@ -406,6 +431,11 @@ func (s *DatabaseExascaleDbStorageVaultResourceCrud) Update() error {
406431
}
407432
}
408433

434+
if isAutoscaleEnabled, ok := s.D.GetOkExists("is_autoscale_enabled"); ok {
435+
tmp := isAutoscaleEnabled.(bool)
436+
request.IsAutoscaleEnabled = &tmp
437+
}
438+
409439
request.RequestMetadata.RetryPolicy = tfresource.GetRetryPolicy(s.DisableNotFoundRetries, "database")
410440

411441
response, err := s.Client.UpdateExascaleDbStorageVault(context.Background(), request)
@@ -454,6 +484,10 @@ func (s *DatabaseExascaleDbStorageVaultResourceCrud) SetData() error {
454484

455485
s.D.Set("attached_shape_attributes", s.Res.AttachedShapeAttributes)
456486

487+
if s.Res.AutoscaleLimitInGBs != nil {
488+
s.D.Set("autoscale_limit_in_gbs", *s.Res.AutoscaleLimitInGBs)
489+
}
490+
457491
if s.Res.AvailabilityDomain != nil {
458492
s.D.Set("availability_domain", *s.Res.AvailabilityDomain)
459493
}
@@ -490,6 +524,10 @@ func (s *DatabaseExascaleDbStorageVaultResourceCrud) SetData() error {
490524
s.D.Set("high_capacity_database_storage", nil)
491525
}
492526

527+
if s.Res.IsAutoscaleEnabled != nil {
528+
s.D.Set("is_autoscale_enabled", *s.Res.IsAutoscaleEnabled)
529+
}
530+
493531
if s.Res.LifecycleDetails != nil {
494532
s.D.Set("lifecycle_details", *s.Res.LifecycleDetails)
495533
}

internal/service/database/database_exascale_db_storage_vaults_data_source.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ func (s *DatabaseExascaleDbStorageVaultsDataSourceCrud) SetData() error {
170170

171171
exascaleDbStorageVault["attached_shape_attributes"] = r.AttachedShapeAttributes
172172

173+
if r.AutoscaleLimitInGBs != nil {
174+
exascaleDbStorageVault["autoscale_limit_in_gbs"] = *r.AutoscaleLimitInGBs
175+
}
176+
173177
if r.AvailabilityDomain != nil {
174178
exascaleDbStorageVault["availability_domain"] = *r.AvailabilityDomain
175179
}
@@ -206,6 +210,10 @@ func (s *DatabaseExascaleDbStorageVaultsDataSourceCrud) SetData() error {
206210
exascaleDbStorageVault["id"] = *r.Id
207211
}
208212

213+
if r.IsAutoscaleEnabled != nil {
214+
exascaleDbStorageVault["is_autoscale_enabled"] = *r.IsAutoscaleEnabled
215+
}
216+
209217
if r.LifecycleDetails != nil {
210218
exascaleDbStorageVault["lifecycle_details"] = *r.LifecycleDetails
211219
}

website/docs/d/database_exascale_db_storage_vault.html.markdown

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ The following arguments are supported:
3333

3434
The following attributes are exported:
3535

36-
* `additional_flash_cache_in_percent` - The size of additional Flash Cache in percentage of High Capacity database storage.
37-
* `attached_shape_attributes` - The shapeAttribute of the Exadata VM cluster(s) associated with the Exadata Database Storage Vault.
36+
* `additional_flash_cache_in_percent` - The size of additional Flash Cache in percentage of High Capacity database storage.
37+
* `attached_shape_attributes` - The shapeAttribute of the Exadata VM cluster(s) associated with the Exadata Database Storage Vault.
38+
* `autoscale_limit_in_gbs` - Maximum limit storage size in gigabytes, that is applicable for the Database Storage Vault.
3839
* `availability_domain` - The name of the availability domain in which the Exadata Database Storage Vault is located.
3940
* `cluster_placement_group_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the cluster placement group of the Exadata Infrastructure.
4041
* `compartment_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment.
@@ -47,6 +48,7 @@ The following attributes are exported:
4748
* `available_size_in_gbs` - Available Capacity
4849
* `total_size_in_gbs` - Total Capacity
4950
* `id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the Exadata Database Storage Vault.
51+
* `is_autoscale_enabled` - Indicates if autoscale feature is enabled for the Database Storage Vault. The default value is `FALSE`.
5052
* `lifecycle_details` - Additional information about the current lifecycle state.
5153
* `state` - The current state of the Exadata Database Storage Vault.
5254
* `subscription_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the subscription with which resource needs to be associated with.

website/docs/d/database_exascale_db_storage_vaults.html.markdown

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ The following attributes are exported:
5757

5858
The following attributes are exported:
5959

60-
* `additional_flash_cache_in_percent` - The size of additional Flash Cache in percentage of High Capacity database storage.
61-
* `attached_shape_attributes` - The shapeAttribute of the Exadata VM cluster(s) associated with the Exadata Database Storage Vault.
60+
* `additional_flash_cache_in_percent` - The size of additional Flash Cache in percentage of High Capacity database storage.
61+
* `attached_shape_attributes` - The shapeAttribute of the Exadata VM cluster(s) associated with the Exadata Database Storage Vault.
62+
* `autoscale_limit_in_gbs` - Maximum limit storage size in gigabytes, that is applicable for the Database Storage Vault.
6263
* `availability_domain` - The name of the availability domain in which the Exadata Database Storage Vault is located.
6364
* `cluster_placement_group_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the cluster placement group of the Exadata Infrastructure.
6465
* `compartment_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment.
@@ -71,6 +72,7 @@ The following attributes are exported:
7172
* `available_size_in_gbs` - Available Capacity
7273
* `total_size_in_gbs` - Total Capacity
7374
* `id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the Exadata Database Storage Vault.
75+
* `is_autoscale_enabled` - Indicates if autoscale feature is enabled for the Database Storage Vault. The default value is `FALSE`.
7476
* `lifecycle_details` - Additional information about the current lifecycle state.
7577
* `state` - The current state of the Exadata Database Storage Vault.
7678
* `subscription_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the subscription with which resource needs to be associated with.

0 commit comments

Comments
 (0)