Skip to content

Commit a53aa9f

Browse files
Terraform Team AutomationjiaqchenO
authored andcommitted
Added - Support for ADB-S: Provide Availability Domain Details in CP
1 parent f63667b commit a53aa9f

9 files changed

+59
-0
lines changed

internal/integrationtest/database_autonomous_database_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ func TestDatabaseAutonomousDatabaseResource_basic(t *testing.T) {
353353
resource.TestCheckResourceAttr(resourceName, "db_name", adbName),
354354
// verify computed field db_workload to be defaulted to OLTP
355355
resource.TestCheckResourceAttr(resourceName, "db_workload", "OLTP"),
356+
resource.TestCheckResourceAttrSet(resourceName, "availability_domain"),
356357

357358
func(s *terraform.State) (err error) {
358359
resId, err = acctest.FromInstanceState(s, resourceName, "id")
@@ -1255,6 +1256,7 @@ func TestDatabaseAutonomousDatabaseResource_basic(t *testing.T) {
12551256
resource.TestCheckResourceAttrSet(datasourceName, "autonomous_databases.0.allocated_storage_size_in_tbs"),
12561257
resource.TestCheckResourceAttrSet(datasourceName, "autonomous_databases.0.apex_details.#"),
12571258
resource.TestCheckResourceAttr(datasourceName, "autonomous_databases.0.autonomous_maintenance_schedule_type", "REGULAR"),
1259+
resource.TestCheckResourceAttrSet(datasourceName, "autonomous_databases.0.availability_domain"),
12581260
resource.TestCheckResourceAttr(datasourceName, "autonomous_databases.0.backup_config.#", "1"),
12591261
resource.TestCheckResourceAttr(datasourceName, "autonomous_databases.0.compartment_id", compartmentId),
12601262
resource.TestCheckResourceAttr(datasourceName, "autonomous_databases.0.connection_strings.#", "1"),
@@ -1340,6 +1342,7 @@ func TestDatabaseAutonomousDatabaseResource_basic(t *testing.T) {
13401342
Check: acctest.ComposeAggregateTestCheckFuncWrapper(
13411343
resource.TestCheckResourceAttrSet(singularDatasourceName, "autonomous_database_id"),
13421344
resource.TestCheckResourceAttr(singularDatasourceName, "autonomous_maintenance_schedule_type", "REGULAR"),
1345+
resource.TestCheckResourceAttrSet(singularDatasourceName, "availability_domain"),
13431346
resource.TestCheckResourceAttr(singularDatasourceName, "backup_config.#", "1"),
13441347
resource.TestCheckResourceAttr(singularDatasourceName, "compartment_id", compartmentId),
13451348
resource.TestCheckResourceAttr(singularDatasourceName, "connection_strings.#", "1"),

internal/service/database/database_autonomous_database_data_source.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ func (s *DatabaseAutonomousDatabaseDataSourceCrud) SetData() error {
9999

100100
s.D.Set("autonomous_maintenance_schedule_type", s.Res.AutonomousMaintenanceScheduleType)
101101

102+
if s.Res.AvailabilityDomain != nil {
103+
s.D.Set("availability_domain", *s.Res.AvailabilityDomain)
104+
}
105+
102106
s.D.Set("available_upgrade_versions", s.Res.AvailableUpgradeVersions)
103107

104108
if s.Res.BackupConfig != nil {

internal/service/database/database_autonomous_database_resource.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,10 @@ func DatabaseAutonomousDatabaseResource() *schema.Resource {
598598
},
599599
},
600600
},
601+
"availability_domain": {
602+
Type: schema.TypeString,
603+
Computed: true,
604+
},
601605
"available_upgrade_versions": {
602606
Type: schema.TypeList,
603607
Computed: true,
@@ -864,6 +868,10 @@ func DatabaseAutonomousDatabaseResource() *schema.Resource {
864868
// Optional
865869

866870
// Computed
871+
"availability_domain": {
872+
Type: schema.TypeString,
873+
Computed: true,
874+
},
867875
"lag_time_in_seconds": {
868876
Type: schema.TypeInt,
869877
Computed: true,
@@ -1068,6 +1076,10 @@ func DatabaseAutonomousDatabaseResource() *schema.Resource {
10681076
// Optional
10691077

10701078
// Computed
1079+
"availability_domain": {
1080+
Type: schema.TypeString,
1081+
Computed: true,
1082+
},
10711083
"lag_time_in_seconds": {
10721084
Type: schema.TypeInt,
10731085
Computed: true,
@@ -2021,6 +2033,10 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) SetData() error {
20212033

20222034
s.D.Set("autonomous_maintenance_schedule_type", s.Res.AutonomousMaintenanceScheduleType)
20232035

2036+
if s.Res.AvailabilityDomain != nil {
2037+
s.D.Set("availability_domain", *s.Res.AvailabilityDomain)
2038+
}
2039+
20242040
s.D.Set("available_upgrade_versions", s.Res.AvailableUpgradeVersions)
20252041

20262042
if s.Res.BackupConfig != nil {
@@ -2570,6 +2586,10 @@ func AutonomousDatabaseKeyHistoryEntryToMap(obj oci_database.AutonomousDatabaseK
25702586
func AutonomousDatabaseStandbySummaryToMap(obj *oci_database.AutonomousDatabaseStandbySummary) map[string]interface{} {
25712587
result := map[string]interface{}{}
25722588

2589+
if obj.AvailabilityDomain != nil {
2590+
result["availability_domain"] = string(*obj.AvailabilityDomain)
2591+
}
2592+
25732593
if obj.LagTimeInSeconds != nil {
25742594
result["lag_time_in_seconds"] = int(*obj.LagTimeInSeconds)
25752595
}

internal/service/database/database_autonomous_databases_clones_data_source.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ func DatabaseAutonomousDatabasesClonesDataSource() *schema.Resource {
9898
Type: schema.TypeString,
9999
Computed: true,
100100
},
101+
"availability_domain": {
102+
Type: schema.TypeString,
103+
Computed: true,
104+
},
101105
"available_upgrade_versions": {
102106
Type: schema.TypeList,
103107
Computed: true,
@@ -533,6 +537,10 @@ func DatabaseAutonomousDatabasesClonesDataSource() *schema.Resource {
533537
// Optional
534538

535539
// Computed
540+
"availability_domain": {
541+
Type: schema.TypeString,
542+
Computed: true,
543+
},
536544
"lag_time_in_seconds": {
537545
Type: schema.TypeInt,
538546
Computed: true,
@@ -817,6 +825,10 @@ func DatabaseAutonomousDatabasesClonesDataSource() *schema.Resource {
817825
// Optional
818826

819827
// Computed
828+
"availability_domain": {
829+
Type: schema.TypeString,
830+
Computed: true,
831+
},
820832
"lag_time_in_seconds": {
821833
Type: schema.TypeInt,
822834
Computed: true,
@@ -1077,6 +1089,10 @@ func (s *DatabaseAutonomousDatabasesClonesDataSourceCrud) SetData() error {
10771089

10781090
autonomousDatabasesClone["autonomous_maintenance_schedule_type"] = r.AutonomousMaintenanceScheduleType
10791091

1092+
if r.AvailabilityDomain != nil {
1093+
autonomousDatabasesClone["availability_domain"] = *r.AvailabilityDomain
1094+
}
1095+
10801096
autonomousDatabasesClone["available_upgrade_versions"] = r.AvailableUpgradeVersions
10811097

10821098
if r.BackupConfig != nil {

internal/service/database/database_autonomous_databases_data_source.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ func (s *DatabaseAutonomousDatabasesDataSourceCrud) SetData() error {
222222

223223
autonomousDatabase["autonomous_maintenance_schedule_type"] = r.AutonomousMaintenanceScheduleType
224224

225+
if r.AvailabilityDomain != nil {
226+
autonomousDatabase["availability_domain"] = *r.AvailabilityDomain
227+
}
228+
225229
autonomousDatabase["available_upgrade_versions"] = r.AvailableUpgradeVersions
226230

227231
if r.BackupConfig != nil {

website/docs/d/database_autonomous_database.html.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ The following attributes are exported:
4545
* `auto_refresh_point_lag_in_seconds` - The time, in seconds, the data of the refreshable clone lags the primary database at the point of refresh. The minimum is 0 minutes (0 mins means refresh to the latest available timestamp). The maximum is 7 days. The lag time increases after refreshing until the next data refresh happens.
4646
* `autonomous_container_database_id` - The Autonomous Container Database [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm).
4747
* `autonomous_maintenance_schedule_type` - The maintenance schedule type of the Autonomous Database Serverless. An EARLY maintenance schedule follows a schedule applying patches prior to the REGULAR schedule. A REGULAR maintenance schedule follows the normal cycle
48+
* `availability_domain` - The availability domain where the Autonomous Database Serverless instance is located.
4849
* `available_upgrade_versions` - List of Oracle Database versions available for a database upgrade. If there are no version upgrades available, this list is empty.
4950
* `backup_config` - Autonomous Database configuration details for storing [manual backups](https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/backup-restore.html#GUID-9035DFB8-4702-4CEB-8281-C2A303820809) in the [Object Storage](https://docs.cloud.oracle.com/iaas/Content/Object/Concepts/objectstorageoverview.htm) service.
5051
* `manual_backup_bucket_name` - Name of [Object Storage](https://docs.cloud.oracle.com/iaas/Content/Object/Concepts/objectstorageoverview.htm) bucket to use for storing manual backups.
@@ -160,6 +161,7 @@ The following attributes are exported:
160161
* `local_adg_auto_failover_max_data_loss_limit` - Parameter that allows users to select an acceptable maximum data loss limit in seconds, up to which Automatic Failover will be triggered when necessary for a Local Autonomous Data Guard
161162
* `local_disaster_recovery_type` - Indicates the local disaster recovery (DR) type of the Autonomous Database Serverless instance. Autonomous Data Guard (ADG) DR type provides business critical DR with a faster recovery time objective (RTO) during failover or switchover. Backup-based DR type provides lower cost DR with a slower RTO during failover or switchover.
162163
* `local_standby_db` - Autonomous Data Guard standby database details.
164+
* `availability_domain` - The availability domain of a local Autonomous Data Guard standby database of an Autonomous Database Serverless instance.
163165
* `lag_time_in_seconds` - The amount of time, in seconds, that the data of the standby database lags the data of the primary database. Can be used to determine the potential data loss in the event of a failover.
164166
* `lifecycle_details` - Additional information about the current lifecycle state.
165167
* `state` - The current state of the Autonomous Database.
@@ -233,6 +235,7 @@ The following attributes are exported:
233235
* `service_console_url` - The URL of the Service Console for the Autonomous Database.
234236
* `source_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the source Autonomous Database that was cloned to create the current Autonomous Database.
235237
* `standby_db` - **Deprecated** Autonomous Data Guard standby database details.
238+
* `availability_domain` - The availability domain of a local Autonomous Data Guard standby database of an Autonomous Database Serverless instance.
236239
* `lag_time_in_seconds` - The amount of time, in seconds, that the data of the standby database lags the data of the primary database. Can be used to determine the potential data loss in the event of a failover.
237240
* `lifecycle_details` - Additional information about the current lifecycle state.
238241
* `state` - The current state of the Autonomous Database.

website/docs/d/database_autonomous_databases.html.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ The following attributes are exported:
7777
* `auto_refresh_point_lag_in_seconds` - The time, in seconds, the data of the refreshable clone lags the primary database at the point of refresh. The minimum is 0 minutes (0 mins means refresh to the latest available timestamp). The maximum is 7 days. The lag time increases after refreshing until the next data refresh happens.
7878
* `autonomous_container_database_id` - The Autonomous Container Database [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm).
7979
* `autonomous_maintenance_schedule_type` - The maintenance schedule type of the Autonomous Database Serverless. An EARLY maintenance schedule follows a schedule applying patches prior to the REGULAR schedule. A REGULAR maintenance schedule follows the normal cycle
80+
* `availability_domain` - The availability domain where the Autonomous Database Serverless instance is located.
8081
* `available_upgrade_versions` - List of Oracle Database versions available for a database upgrade. If there are no version upgrades available, this list is empty.
8182
* `backup_config` - Autonomous Database configuration details for storing [manual backups](https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/backup-restore.html#GUID-9035DFB8-4702-4CEB-8281-C2A303820809) in the [Object Storage](https://docs.cloud.oracle.com/iaas/Content/Object/Concepts/objectstorageoverview.htm) service.
8283
* `manual_backup_bucket_name` - Name of [Object Storage](https://docs.cloud.oracle.com/iaas/Content/Object/Concepts/objectstorageoverview.htm) bucket to use for storing manual backups.
@@ -193,6 +194,7 @@ The following attributes are exported:
193194
* `local_adg_auto_failover_max_data_loss_limit` - Parameter that allows users to select an acceptable maximum data loss limit in seconds, up to which Automatic Failover will be triggered when necessary for a Local Autonomous Data Guard
194195
* `local_disaster_recovery_type` - Indicates the local disaster recovery (DR) type of the Autonomous Database Serverless instance. Autonomous Data Guard (ADG) DR type provides business critical DR with a faster recovery time objective (RTO) during failover or switchover. Backup-based DR type provides lower cost DR with a slower RTO during failover or switchover.
195196
* `local_standby_db` - Autonomous Data Guard standby database details.
197+
* `availability_domain` - The availability domain of a local Autonomous Data Guard standby database of an Autonomous Database Serverless instance.
196198
* `lag_time_in_seconds` - The amount of time, in seconds, that the data of the standby database lags the data of the primary database. Can be used to determine the potential data loss in the event of a failover.
197199
* `lifecycle_details` - Additional information about the current lifecycle state.
198200
* `state` - The current state of the Autonomous Database.
@@ -262,6 +264,7 @@ The following attributes are exported:
262264
* `service_console_url` - The URL of the Service Console for the Autonomous Database.
263265
* `source_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the source Autonomous Database that was cloned to create the current Autonomous Database.
264266
* `standby_db` - **Deprecated** Autonomous Data Guard standby database details.
267+
* `availability_domain` - The availability domain of a local Autonomous Data Guard standby database of an Autonomous Database Serverless instance.
265268
* `lag_time_in_seconds` - The amount of time, in seconds, that the data of the standby database lags the data of the primary database. Can be used to determine the potential data loss in the event of a failover.
266269
* `lifecycle_details` - Additional information about the current lifecycle state.
267270
* `state` - The current state of the Autonomous Database.

website/docs/d/database_autonomous_databases_clones.html.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ The following attributes are exported:
6161
* `auto_refresh_point_lag_in_seconds` - The time, in seconds, the data of the refreshable clone lags the primary database at the point of refresh. The minimum is 0 minutes (0 mins means refresh to the latest available timestamp). The maximum is 7 days. The lag time increases after refreshing until the next data refresh happens.
6262
* `autonomous_container_database_id` - The Autonomous Container Database [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm).
6363
* `autonomous_maintenance_schedule_type` - The maintenance schedule type of the Autonomous Database Serverless. An EARLY maintenance schedule follows a schedule applying patches prior to the REGULAR schedule. A REGULAR maintenance schedule follows the normal cycle
64+
* `availability_domain` - The availability domain where the Autonomous Database Serverless instance is located.
6465
* `available_upgrade_versions` - List of Oracle Database versions available for a database upgrade. If there are no version upgrades available, this list is empty.
6566
* `backup_config` - Autonomous Database configuration details for storing [manual backups](https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/backup-restore.html#GUID-9035DFB8-4702-4CEB-8281-C2A303820809) in the [Object Storage](https://docs.cloud.oracle.com/iaas/Content/Object/Concepts/objectstorageoverview.htm) service.
6667
* `manual_backup_bucket_name` - Name of [Object Storage](https://docs.cloud.oracle.com/iaas/Content/Object/Concepts/objectstorageoverview.htm) bucket to use for storing manual backups.
@@ -177,6 +178,7 @@ The following attributes are exported:
177178
* `local_adg_auto_failover_max_data_loss_limit` - Parameter that allows users to select an acceptable maximum data loss limit in seconds, up to which Automatic Failover will be triggered when necessary for a Local Autonomous Data Guard
178179
* `local_disaster_recovery_type` - Indicates the local disaster recovery (DR) type of the Autonomous Database Serverless instance. Autonomous Data Guard (ADG) DR type provides business critical DR with a faster recovery time objective (RTO) during failover or switchover. Backup-based DR type provides lower cost DR with a slower RTO during failover or switchover.
179180
* `local_standby_db` - Autonomous Data Guard standby database details.
181+
* `availability_domain` - The availability domain of a local Autonomous Data Guard standby database of an Autonomous Database Serverless instance.
180182
* `lag_time_in_seconds` - The amount of time, in seconds, that the data of the standby database lags the data of the primary database. Can be used to determine the potential data loss in the event of a failover.
181183
* `lifecycle_details` - Additional information about the current lifecycle state.
182184
* `state` - The current state of the Autonomous Database.
@@ -249,6 +251,7 @@ The following attributes are exported:
249251
* `service_console_url` - The URL of the Service Console for the Autonomous Database.
250252
* `source_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the source Autonomous Database that was cloned to create the current Autonomous Database.
251253
* `standby_db` - **Deprecated** Autonomous Data Guard standby database details.
254+
* `availability_domain` - The availability domain of a local Autonomous Data Guard standby database of an Autonomous Database Serverless instance.
252255
* `lag_time_in_seconds` - The amount of time, in seconds, that the data of the standby database lags the data of the primary database. Can be used to determine the potential data loss in the event of a failover.
253256
* `lifecycle_details` - Additional information about the current lifecycle state.
254257
* `state` - The current state of the Autonomous Database.

0 commit comments

Comments
 (0)