Skip to content

Commit 84ec7cb

Browse files
rashik-bhasinNagendraNigade
authored andcommitted
Added - Support for ADBS refreshable clone reconnect
1 parent 20fec0b commit 84ec7cb

10 files changed

+103
-0
lines changed

internal/integrationtest/database_autonomous_database_resource_test.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2502,6 +2502,8 @@ func TestResourceDatabaseAutonomousDatabaseResource_refreshableClone(t *testing.
25022502
// time_of_last_refresh and time_of_next_refresh returned when refreshable_mode=AUTOMATIC, not available immediately
25032503
//resource.TestCheckResourceAttrSet(resourceName, "autonomous_databases.0.time_of_last_refresh"),
25042504
//resource.TestCheckResourceAttrSet(resourceName, "autonomous_databases.0.time_of_next_refresh"),
2505+
resource.TestCheckResourceAttrSet(resourceName, "time_until_reconnect_clone_enabled"),
2506+
resource.TestCheckResourceAttr(resourceName, "is_reconnect_clone_enabled", "true"),
25052507

25062508
func(s *terraform.State) (err error) {
25072509
resId2, err = acctest.FromInstanceState(s, resourceName, "id")
@@ -2512,6 +2514,49 @@ func TestResourceDatabaseAutonomousDatabaseResource_refreshableClone(t *testing.
25122514
},
25132515
),
25142516
},
2517+
// verify reconnecting a refreshable clone
2518+
{
2519+
Config: config + compartmentIdVariableStr + AutonomousDatabaseResourceDependencies +
2520+
acctest.GenerateResourceFromRepresentationMap("oci_database_autonomous_database", "test_autonomous_database_source", acctest.Optional, acctest.Create, autonomousDatabaseRefreshableCloneSourceADBRepresentation) +
2521+
acctest.GenerateResourceFromRepresentationMap("oci_database_autonomous_database", "test_autonomous_database", acctest.Optional, acctest.Update, autonomousDatabaseRefreshableCloneRepresentation),
2522+
Check: resource.ComposeAggregateTestCheckFunc(
2523+
resource.TestCheckResourceAttr(resourceName, "compartment_id", compartmentId),
2524+
resource.TestCheckResourceAttr(resourceName, "cpu_core_count", "1"),
2525+
resource.TestCheckResourceAttr(resourceName, "data_storage_size_in_tbs", "1"),
2526+
resource.TestCheckResourceAttr(resourceName, "db_name", adbDbRefreshableCloneName),
2527+
resource.TestCheckResourceAttr(resourceName, "db_workload", "OLTP"),
2528+
resource.TestCheckResourceAttr(resourceName, "defined_tags.%", "1"),
2529+
resource.TestCheckResourceAttr(resourceName, "display_name", "displayName2"),
2530+
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
2531+
resource.TestCheckResourceAttrSet(resourceName, "id"),
2532+
resource.TestCheckResourceAttr(resourceName, "is_auto_scaling_enabled", "false"),
2533+
resource.TestCheckResourceAttr(resourceName, "is_data_guard_enabled", "false"),
2534+
resource.TestCheckResourceAttr(resourceName, "is_dedicated", "false"),
2535+
resource.TestCheckResourceAttr(resourceName, "is_free_tier", "false"),
2536+
resource.TestCheckResourceAttr(resourceName, "is_preview", "false"),
2537+
resource.TestCheckResourceAttr(resourceName, "is_preview_version_with_service_terms_accepted", "false"),
2538+
resource.TestCheckResourceAttr(resourceName, "is_refreshable_clone", "true"),
2539+
resource.TestCheckResourceAttr(resourceName, "license_model", "LICENSE_INCLUDED"),
2540+
resource.TestCheckResourceAttrSet(resourceName, "open_mode"),
2541+
resource.TestCheckResourceAttr(resourceName, "refreshable_mode", "MANUAL"),
2542+
resource.TestCheckResourceAttr(resourceName, "source", "CLONE_TO_REFRESHABLE"),
2543+
resource.TestCheckResourceAttrSet(resourceName, "source_id"),
2544+
resource.TestCheckResourceAttrSet(resourceName, "state"),
2545+
// time_of_last_refresh_point apply when refreshable_mode both MANUAL and AUTOMATIC, not available immediately
2546+
//resource.TestCheckResourceAttrSet(resourceName, "autonomous_databases.0.time_of_last_refresh_point"),
2547+
// time_of_last_refresh and time_of_next_refresh returned when refreshable_mode=AUTOMATIC, not available immediately
2548+
//resource.TestCheckResourceAttrSet(resourceName, "autonomous_databases.0.time_of_last_refresh"),
2549+
//resource.TestCheckResourceAttrSet(resourceName, "autonomous_databases.0.time_of_next_refresh"),
2550+
resource.TestCheckResourceAttr(resourceName, "is_reconnect_clone_enabled", "false"),
2551+
func(s *terraform.State) (err error) {
2552+
resId2, err = acctest.FromInstanceState(s, resourceName, "id")
2553+
if resId != resId2 {
2554+
return fmt.Errorf("Resource recreated when it was supposed to be updated.")
2555+
}
2556+
return err
2557+
},
2558+
),
2559+
},
25152560
})
25162561
}
25172562

internal/integrationtest/database_autonomous_database_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,8 @@ func TestDatabaseAutonomousDatabaseResource_basic(t *testing.T) {
549549
resource.TestCheckResourceAttr(datasourceName, "autonomous_databases.0.is_auto_scaling_enabled", "false"),
550550
resource.TestCheckResourceAttr(datasourceName, "autonomous_databases.0.is_dedicated", "false"),
551551
resource.TestCheckResourceAttrSet(datasourceName, "autonomous_databases.0.is_preview"),
552+
resource.TestCheckResourceAttrSet(datasourceName, "autonomous_databases.0.is_reconnect_clone_enabled"),
553+
resource.TestCheckResourceAttrSet(datasourceName, "autonomous_databases.0.is_refreshable_clone"),
552554
resource.TestCheckResourceAttrSet(datasourceName, "autonomous_databases.0.kms_key_id"),
553555
resource.TestCheckResourceAttr(datasourceName, "autonomous_databases.0.license_model", "LICENSE_INCLUDED"),
554556
resource.TestCheckResourceAttrSet(datasourceName, "autonomous_databases.0.open_mode"),

internal/service/database/database_autonomous_database_data_source.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ func (s *DatabaseAutonomousDatabaseDataSourceCrud) SetData() error {
182182
s.D.Set("is_preview", *s.Res.IsPreview)
183183
}
184184

185+
if s.Res.IsReconnectCloneEnabled != nil {
186+
s.D.Set("is_reconnect_clone_enabled", *s.Res.IsReconnectCloneEnabled)
187+
}
188+
185189
if s.Res.IsRefreshableClone != nil {
186190
s.D.Set("is_refreshable_clone", *s.Res.IsRefreshableClone)
187191
}
@@ -320,6 +324,10 @@ func (s *DatabaseAutonomousDatabaseDataSourceCrud) SetData() error {
320324
s.D.Set("time_reclamation_of_free_autonomous_database", s.Res.TimeReclamationOfFreeAutonomousDatabase.String())
321325
}
322326

327+
if s.Res.TimeUntilReconnectCloneEnabled != nil {
328+
s.D.Set("time_until_reconnect_clone_enabled", s.Res.TimeUntilReconnectCloneEnabled.String())
329+
}
330+
323331
if s.Res.UsedDataStorageSizeInTBs != nil {
324332
s.D.Set("used_data_storage_size_in_tbs", *s.Res.UsedDataStorageSizeInTBs)
325333
}

internal/service/database/database_autonomous_database_resource.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,10 @@ func DatabaseAutonomousDatabaseResource() *schema.Resource {
538538
Type: schema.TypeBool,
539539
Computed: true,
540540
},
541+
"is_reconnect_clone_enabled": {
542+
Type: schema.TypeBool,
543+
Computed: true,
544+
},
541545
"key_history_entry": {
542546
Type: schema.TypeList,
543547
Computed: true,
@@ -705,6 +709,10 @@ func DatabaseAutonomousDatabaseResource() *schema.Resource {
705709
Type: schema.TypeString,
706710
Computed: true,
707711
},
712+
"time_until_reconnect_clone_enabled": {
713+
Type: schema.TypeString,
714+
Computed: true,
715+
},
708716
"used_data_storage_size_in_tbs": {
709717
Type: schema.TypeInt,
710718
Computed: true,
@@ -1393,6 +1401,10 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) SetData() error {
13931401
s.D.Set("is_preview", *s.Res.IsPreview)
13941402
}
13951403

1404+
if s.Res.IsReconnectCloneEnabled != nil {
1405+
s.D.Set("is_reconnect_clone_enabled", *s.Res.IsReconnectCloneEnabled)
1406+
}
1407+
13961408
if s.Res.IsRefreshableClone != nil {
13971409
s.D.Set("is_refreshable_clone", *s.Res.IsRefreshableClone)
13981410
}
@@ -1537,6 +1549,10 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) SetData() error {
15371549
s.D.Set("time_reclamation_of_free_autonomous_database", s.Res.TimeReclamationOfFreeAutonomousDatabase.String())
15381550
}
15391551

1552+
if s.Res.TimeUntilReconnectCloneEnabled != nil {
1553+
s.D.Set("time_until_reconnect_clone_enabled", s.Res.TimeUntilReconnectCloneEnabled.String())
1554+
}
1555+
15401556
if s.Res.UsedDataStorageSizeInTBs != nil {
15411557
s.D.Set("used_data_storage_size_in_tbs", *s.Res.UsedDataStorageSizeInTBs)
15421558
}

internal/service/database/database_autonomous_databases_clones_data_source.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,10 @@ func DatabaseAutonomousDatabasesClonesDataSource() *schema.Resource {
332332
Type: schema.TypeBool,
333333
Computed: true,
334334
},
335+
"is_reconnect_clone_enabled": {
336+
Type: schema.TypeBool,
337+
Computed: true,
338+
},
335339
"is_refreshable_clone": {
336340
Type: schema.TypeBool,
337341
Computed: true,
@@ -567,6 +571,10 @@ func DatabaseAutonomousDatabasesClonesDataSource() *schema.Resource {
567571
Type: schema.TypeString,
568572
Computed: true,
569573
},
574+
"time_until_reconnect_clone_enabled": {
575+
Type: schema.TypeString,
576+
Computed: true,
577+
},
570578
"used_data_storage_size_in_tbs": {
571579
Type: schema.TypeInt,
572580
Computed: true,
@@ -785,6 +793,10 @@ func (s *DatabaseAutonomousDatabasesClonesDataSourceCrud) SetData() error {
785793
autonomousDatabasesClone["is_preview"] = *r.IsPreview
786794
}
787795

796+
if r.IsReconnectCloneEnabled != nil {
797+
autonomousDatabasesClone["is_reconnect_clone_enabled"] = *r.IsReconnectCloneEnabled
798+
}
799+
788800
if r.IsRefreshableClone != nil {
789801
autonomousDatabasesClone["is_refreshable_clone"] = *r.IsRefreshableClone
790802
}
@@ -919,6 +931,10 @@ func (s *DatabaseAutonomousDatabasesClonesDataSourceCrud) SetData() error {
919931
autonomousDatabasesClone["time_reclamation_of_free_autonomous_database"] = r.TimeReclamationOfFreeAutonomousDatabase.String()
920932
}
921933

934+
if r.TimeUntilReconnectCloneEnabled != nil {
935+
autonomousDatabasesClone["time_until_reconnect_clone_enabled"] = r.TimeUntilReconnectCloneEnabled.String()
936+
}
937+
922938
if r.UsedDataStorageSizeInTBs != nil {
923939
autonomousDatabasesClone["used_data_storage_size_in_tbs"] = *r.UsedDataStorageSizeInTBs
924940
}

internal/service/database/database_autonomous_databases_data_source.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,10 @@ func (s *DatabaseAutonomousDatabasesDataSourceCrud) SetData() error {
286286
autonomousDatabase["is_preview"] = *r.IsPreview
287287
}
288288

289+
if r.IsReconnectCloneEnabled != nil {
290+
autonomousDatabase["is_reconnect_clone_enabled"] = *r.IsReconnectCloneEnabled
291+
}
292+
289293
if r.IsRefreshableClone != nil {
290294
autonomousDatabase["is_refreshable_clone"] = *r.IsRefreshableClone
291295
}
@@ -424,6 +428,10 @@ func (s *DatabaseAutonomousDatabasesDataSourceCrud) SetData() error {
424428
autonomousDatabase["time_reclamation_of_free_autonomous_database"] = r.TimeReclamationOfFreeAutonomousDatabase.String()
425429
}
426430

431+
if r.TimeUntilReconnectCloneEnabled != nil {
432+
autonomousDatabase["time_until_reconnect_clone_enabled"] = r.TimeUntilReconnectCloneEnabled.String()
433+
}
434+
427435
if r.UsedDataStorageSizeInTBs != nil {
428436
autonomousDatabase["used_data_storage_size_in_tbs"] = *r.UsedDataStorageSizeInTBs
429437
}

website/docs/d/database_autonomous_database.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ The following attributes are exported:
9595
* `is_free_tier` - Indicates if this is an Always Free resource. The default value is false. Note that Always Free Autonomous Databases have 1 CPU and 20GB of memory. For Always Free databases, memory and CPU cannot be scaled.
9696
* `is_mtls_connection_required` - Indicates whether the Autonomous Database requires mTLS connections.
9797
* `is_preview` - Indicates if the Autonomous Database version is a preview version.
98+
* `is_reconnect_clone_enabled` - Indicates if the refreshable clone can be reconnected to its source database.
9899
* `is_refreshable_clone` - Indicates whether the Autonomous Database is a refreshable clone.
99100
* `key_history_entry` - Key History Entry.
100101
* `id` - The id of the Autonomous Database [Vault](https://docs.cloud.oracle.com/iaas/Content/KeyManagement/Concepts/keyoverview.htm#concepts) service key management history entry.
@@ -164,6 +165,7 @@ The following attributes are exported:
164165
* `time_of_last_switchover` - The timestamp of the last switchover operation for the Autonomous Database.
165166
* `time_of_next_refresh` - The date and time of next refresh.
166167
* `time_reclamation_of_free_autonomous_database` - The date and time the Always Free database will be stopped because of inactivity. If this time is reached without any database activity, the database will automatically be put into the STOPPED state.
168+
* `time_until_reconnect_clone_enabled` - The time and date as an RFC3339 formatted string, e.g., 2022-01-01T12:00:00.000Z, to set the limit for a refreshable clone to be reconnected to its source database.
167169
* `used_data_storage_size_in_tbs` - The amount of storage that has been used, in terabytes.
168170
* `vault_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the Oracle Cloud Infrastructure [vault](https://docs.cloud.oracle.com/iaas/Content/KeyManagement/Concepts/keyoverview.htm#concepts).
169171
* `whitelisted_ips` - The client IP access control list (ACL). This feature is available for autonomous databases on [shared Exadata infrastructure](https://docs.cloud.oracle.com/iaas/Content/Database/Concepts/adboverview.htm#AEI) and on Exadata Cloud@Customer. Only clients connecting from an IP address included in the ACL may access the Autonomous Database instance.

website/docs/d/database_autonomous_databases.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ The following attributes are exported:
121121
* `is_free_tier` - Indicates if this is an Always Free resource. The default value is false. Note that Always Free Autonomous Databases have 1 CPU and 20GB of memory. For Always Free databases, memory and CPU cannot be scaled.
122122
* `is_mtls_connection_required` - Indicates whether the Autonomous Database requires mTLS connections.
123123
* `is_preview` - Indicates if the Autonomous Database version is a preview version.
124+
* `is_reconnect_clone_enabled` - Indicates if the refreshable clone can be reconnected to its source database.
124125
* `is_refreshable_clone` - Indicates whether the Autonomous Database is a refreshable clone.
125126
* `key_history_entry` - Key History Entry.
126127
* `id` - The id of the Autonomous Database [Vault](https://docs.cloud.oracle.com/iaas/Content/KeyManagement/Concepts/keyoverview.htm#concepts) service key management history entry.
@@ -190,6 +191,7 @@ The following attributes are exported:
190191
* `time_of_last_switchover` - The timestamp of the last switchover operation for the Autonomous Database.
191192
* `time_of_next_refresh` - The date and time of next refresh.
192193
* `time_reclamation_of_free_autonomous_database` - The date and time the Always Free database will be stopped because of inactivity. If this time is reached without any database activity, the database will automatically be put into the STOPPED state.
194+
* `time_until_reconnect_clone_enabled` - The time and date as an RFC3339 formatted string, e.g., 2022-01-01T12:00:00.000Z, to set the limit for a refreshable clone to be reconnected to its source database.
193195
* `used_data_storage_size_in_tbs` - The amount of storage that has been used, in terabytes.
194196
* `vault_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the Oracle Cloud Infrastructure [vault](https://docs.cloud.oracle.com/iaas/Content/KeyManagement/Concepts/keyoverview.htm#concepts).
195197
* `whitelisted_ips` - The client IP access control list (ACL). This feature is available for autonomous databases on [shared Exadata infrastructure](https://docs.cloud.oracle.com/iaas/Content/Database/Concepts/adboverview.htm#AEI) and on Exadata Cloud@Customer. Only clients connecting from an IP address included in the ACL may access the Autonomous Database instance.

website/docs/d/database_autonomous_databases_clones.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ The following attributes are exported:
111111
* `is_free_tier` - Indicates if this is an Always Free resource. The default value is false. Note that Always Free Autonomous Databases have 1 CPU and 20GB of memory. For Always Free databases, memory and CPU cannot be scaled.
112112
* `is_mtls_connection_required` - Indicates whether the Autonomous Database requires mTLS connections.
113113
* `is_preview` - Indicates if the Autonomous Database version is a preview version.
114+
* `is_reconnect_clone_enabled` - Indicates if the refreshable clone can be reconnected to its source database.
114115
* `is_refreshable_clone` - Indicates whether the Autonomous Database is a refreshable clone.
115116
* `key_history_entry` - Key History Entry.
116117
* `id` - The id of the Autonomous Database [Vault](https://docs.cloud.oracle.com/iaas/Content/KeyManagement/Concepts/keyoverview.htm#concepts) service key management history entry.
@@ -180,6 +181,7 @@ The following attributes are exported:
180181
* `time_of_last_switchover` - The timestamp of the last switchover operation for the Autonomous Database.
181182
* `time_of_next_refresh` - The date and time of next refresh.
182183
* `time_reclamation_of_free_autonomous_database` - The date and time the Always Free database will be stopped because of inactivity. If this time is reached without any database activity, the database will automatically be put into the STOPPED state.
184+
* `time_until_reconnect_clone_enabled` - The time and date as an RFC3339 formatted string, e.g., 2022-01-01T12:00:00.000Z, to set the limit for a refreshable clone to be reconnected to its source database.
183185
* `used_data_storage_size_in_tbs` - The amount of storage that has been used, in terabytes.
184186
* `vault_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the Oracle Cloud Infrastructure [vault](https://docs.cloud.oracle.com/iaas/Content/KeyManagement/Concepts/keyoverview.htm#concepts).
185187
* `whitelisted_ips` - The client IP access control list (ACL). This feature is available for autonomous databases on [shared Exadata infrastructure](https://docs.cloud.oracle.com/iaas/Content/Database/Concepts/adboverview.htm#AEI) and on Exadata Cloud@Customer. Only clients connecting from an IP address included in the ACL may access the Autonomous Database instance.

website/docs/r/database_autonomous_database.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ The following attributes are exported:
244244
* `is_free_tier` - Indicates if this is an Always Free resource. The default value is false. Note that Always Free Autonomous Databases have 1 CPU and 20GB of memory. For Always Free databases, memory and CPU cannot be scaled.
245245
* `is_mtls_connection_required` - Indicates whether the Autonomous Database requires mTLS connections.
246246
* `is_preview` - Indicates if the Autonomous Database version is a preview version.
247+
* `is_reconnect_clone_enabled` - Indicates if the refreshable clone can be reconnected to its source database.
247248
* `is_refreshable_clone` - Indicates whether the Autonomous Database is a refreshable clone.
248249
* `key_history_entry` - Key History Entry.
249250
* `id` - The id of the Autonomous Database [Vault](https://docs.cloud.oracle.com/iaas/Content/KeyManagement/Concepts/keyoverview.htm#concepts) service key management history entry.
@@ -313,6 +314,7 @@ The following attributes are exported:
313314
* `time_of_last_switchover` - The timestamp of the last switchover operation for the Autonomous Database.
314315
* `time_of_next_refresh` - The date and time of next refresh.
315316
* `time_reclamation_of_free_autonomous_database` - The date and time the Always Free database will be stopped because of inactivity. If this time is reached without any database activity, the database will automatically be put into the STOPPED state.
317+
* `time_until_reconnect_clone_enabled` - The time and date as an RFC3339 formatted string, e.g., 2022-01-01T12:00:00.000Z, to set the limit for a refreshable clone to be reconnected to its source database.
316318
* `used_data_storage_size_in_tbs` - The amount of storage that has been used, in terabytes.
317319
* `vault_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the Oracle Cloud Infrastructure [vault](https://docs.cloud.oracle.com/iaas/Content/KeyManagement/Concepts/keyoverview.htm#concepts).
318320
* `whitelisted_ips` - The client IP access control list (ACL). This feature is available for autonomous databases on [shared Exadata infrastructure](https://docs.cloud.oracle.com/iaas/Content/Database/Concepts/adboverview.htm#AEI) and on Exadata Cloud@Customer. Only clients connecting from an IP address included in the ACL may access the Autonomous Database instance.

0 commit comments

Comments
 (0)