Skip to content

Commit 00f727f

Browse files
krinapatravinitp
authored andcommitted
Added - Support for autonomous database-dedicated
1 parent f7128fc commit 00f727f

File tree

5 files changed

+91
-9
lines changed

5 files changed

+91
-9
lines changed

internal/service/disaster_recovery/disaster_recovery_dr_plan_resource.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -671,10 +671,11 @@ func (s *DisasterRecoveryDrPlanResourceCrud) mapToUpdateDrPlanGroupDetails(field
671671
result.Id = &tmp
672672
}
673673

674-
/*if isPauseEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_pause_enabled")); ok {
675-
tmp := isPauseEnabled.(bool)
676-
result.IsPauseEnabled = &tmp
677-
}*/
674+
/*
675+
if isPauseEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_pause_enabled")); ok {
676+
tmp := isPauseEnabled.(bool)
677+
result.IsPauseEnabled = &tmp
678+
}*/
678679

679680
if steps, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "steps")); ok {
680681
interfaces := steps.([]interface{})

internal/service/disaster_recovery/disaster_recovery_dr_protection_group_resource.go

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ func DisasterRecoveryDrProtectionGroupResource() *schema.Resource {
132132
Required: true,
133133
DiffSuppressFunc: tfresource.EqualIgnoreCaseSuppressDiff,
134134
ValidateFunc: validation.StringInSlice([]string{
135+
"AUTONOMOUS_CONTAINER_DATABASE",
135136
"AUTONOMOUS_DATABASE",
136137
"COMPUTE_INSTANCE",
137138
"COMPUTE_INSTANCE_MOVABLE",
@@ -146,6 +147,11 @@ func DisasterRecoveryDrProtectionGroupResource() *schema.Resource {
146147
},
147148

148149
// Optional
150+
"autonomous_database_standby_type_for_dr_drills": {
151+
Type: schema.TypeString,
152+
Optional: true,
153+
Computed: true,
154+
},
149155
"backend_set_mappings": {
150156
Type: schema.TypeList,
151157
Optional: true,
@@ -236,6 +242,11 @@ func DisasterRecoveryDrProtectionGroupResource() *schema.Resource {
236242
},
237243
},
238244
},
245+
"connection_string_type": {
246+
Type: schema.TypeString,
247+
Optional: true,
248+
Computed: true,
249+
},
239250
"bucket": {
240251
Type: schema.TypeString,
241252
Optional: true,
@@ -1427,8 +1438,26 @@ func (s *DisasterRecoveryDrProtectionGroupResourceCrud) mapToCreateDrProtectionG
14271438
memberType = "" // default value
14281439
}
14291440
switch strings.ToLower(memberType) {
1441+
case strings.ToLower("AUTONOMOUS_CONTAINER_DATABASE"):
1442+
details := oci_disaster_recovery.UpdateDrProtectionGroupMemberAutonomousContainerDatabaseDetails{}
1443+
if connectionStringType, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "connection_string_type")); ok {
1444+
details.ConnectionStringType = oci_disaster_recovery.AutonomousContainerDatabaseSnapshotStandbyConnectionStringTypeEnum(connectionStringType.(string))
1445+
}
1446+
if memberId, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "member_id")); ok {
1447+
tmp := memberId.(string)
1448+
details.MemberId = &tmp
1449+
}
1450+
baseObject = details
14301451
case strings.ToLower("AUTONOMOUS_DATABASE"):
1431-
details := oci_disaster_recovery.CreateDrProtectionGroupMemberAutonomousDatabaseDetails{}
1452+
details := oci_disaster_recovery.UpdateDrProtectionGroupMemberAutonomousDatabaseDetails{}
1453+
if autonomousDatabaseStandbyTypeForDrDrills, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "autonomous_database_standby_type_for_dr_drills")); ok {
1454+
details.AutonomousDatabaseStandbyTypeForDrDrills = oci_disaster_recovery.AutonomousDatabaseStandbyTypeForDrDrillsEnum(autonomousDatabaseStandbyTypeForDrDrills.(string))
1455+
}
1456+
if passwordVaultSecretId, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "password_vault_secret_id")); ok {
1457+
tmp := passwordVaultSecretId.(string)
1458+
details.PasswordVaultSecretId = &tmp
1459+
}
1460+
details = oci_disaster_recovery.UpdateDrProtectionGroupMemberAutonomousDatabaseDetails{}
14321461
if memberId, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "member_id")); ok {
14331462
tmp := memberId.(string)
14341463
details.MemberId = &tmp
@@ -1698,8 +1727,35 @@ func (s *DisasterRecoveryDrProtectionGroupResourceCrud) mapToUpdateDrProtectionG
16981727
memberType = "" // default value
16991728
}
17001729
switch strings.ToLower(memberType) {
1730+
case strings.ToLower("AUTONOMOUS_CONTAINER_DATABASE"):
1731+
details := oci_disaster_recovery.UpdateDrProtectionGroupMemberAutonomousContainerDatabaseDetails{}
1732+
if connectionStringType, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "connection_string_type")); ok {
1733+
tmp := connectionStringType.(string)
1734+
if tmp != "" {
1735+
details.ConnectionStringType = oci_disaster_recovery.AutonomousContainerDatabaseSnapshotStandbyConnectionStringTypeEnum(tmp)
1736+
}
1737+
}
1738+
if memberId, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "member_id")); ok {
1739+
tmp := memberId.(string)
1740+
if tmp != "" {
1741+
details.MemberId = &tmp
1742+
}
1743+
}
1744+
baseObject = details
17011745
case strings.ToLower("AUTONOMOUS_DATABASE"):
17021746
details := oci_disaster_recovery.UpdateDrProtectionGroupMemberAutonomousDatabaseDetails{}
1747+
if autonomousDatabaseStandbyTypeForDrDrills, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "autonomous_database_standby_type_for_dr_drills")); ok {
1748+
tmp := autonomousDatabaseStandbyTypeForDrDrills.(string)
1749+
if tmp != "" {
1750+
details.AutonomousDatabaseStandbyTypeForDrDrills = oci_disaster_recovery.AutonomousDatabaseStandbyTypeForDrDrillsEnum(tmp)
1751+
}
1752+
}
1753+
if passwordVaultSecretId, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "password_vault_secret_id")); ok {
1754+
tmp := passwordVaultSecretId.(string)
1755+
if tmp != "" {
1756+
details.PasswordVaultSecretId = &tmp
1757+
}
1758+
}
17031759
if memberId, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "member_id")); ok {
17041760
tmp := memberId.(string)
17051761
if tmp != "" {
@@ -2003,9 +2059,24 @@ func (s *DisasterRecoveryDrProtectionGroupResourceCrud) mapToUpdateDrProtectionG
20032059
func DrProtectionGroupMemberToMap(obj oci_disaster_recovery.DrProtectionGroupMember) map[string]interface{} {
20042060
result := map[string]interface{}{}
20052061
switch v := (obj).(type) {
2062+
case oci_disaster_recovery.UpdateDrProtectionGroupMemberAutonomousContainerDatabaseDetails:
2063+
result["member_type"] = "AUTONOMOUS_CONTAINER_DATABASE"
2064+
2065+
result["connection_string_type"] = string(v.ConnectionStringType)
2066+
2067+
if v.MemberId != nil {
2068+
result["member_id"] = string(*v.MemberId)
2069+
}
2070+
case oci_disaster_recovery.UpdateDrProtectionGroupMemberAutonomousDatabaseDetails:
20062071
case oci_disaster_recovery.DrProtectionGroupMemberAutonomousDatabase:
20072072
result["member_type"] = "AUTONOMOUS_DATABASE"
20082073

2074+
result["autonomous_database_standby_type_for_dr_drills"] = string(v.AutonomousDatabaseStandbyTypeForDrDrills)
2075+
2076+
if v.PasswordVaultSecretId != nil {
2077+
result["password_vault_secret_id"] = string(*v.PasswordVaultSecretId)
2078+
}
2079+
20092080
if v.MemberId != nil {
20102081
result["member_id"] = string(*v.MemberId)
20112082
}

website/docs/d/disaster_recovery_dr_protection_group.html.markdown

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ The following attributes are exported:
4444
* `namespace` - The namespace in object storage (Note - this is usually the tenancy name). Example: `myocitenancy`
4545
* `object` - The object name inside the object storage bucket. Example: `switchover_plan_executions`
4646
* `members` - A list of DR protection group members.
47+
* `autonomous_database_standby_type_for_dr_drills` - This specifies the mechanism used to create a temporary Autonomous Database instance for DR Drills. See https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/autonomous-clone-about.html for information about these clone types. See https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/autonomous-data-guard-snapshot-standby.html for information about snapshot standby.
4748
* `backend_set_mappings` - A list of backend set mappings that are used to transfer or update backends during DR.
4849
* `destination_backend_set_name` - The name of the destination backend set. Example: `My_Destination_Backend_Set`
4950
* `is_backend_set_for_non_movable` - This flag specifies if this backend set is used for traffic for non-movable compute instances. Backend sets that point to non-movable instances are only enabled or disabled during DR. For non-movable instances this flag should be set to 'true'. Backend sets that point to movable instances are emptied and their contents are transferred to the destination region network load balancer. For movable instances this flag should be set to 'false'. Example: `true`
@@ -55,6 +56,7 @@ The following attributes are exported:
5556
* `mount_details` - The details for mounting or unmounting the file system on a block volume.
5657
* `mount_point` - The physical mount point used for mounting and unmounting the file system on a block volume. Example: `/mnt/yourmountpoint`
5758
* `bucket` - The bucket name inside the object storage namespace. Example: `bucket_name`
59+
* `connection_string_type` - The type of connection strings used to connect to an Autonomous Container Database snapshot standby created during a DR Drill operation. See https://docs.oracle.com/en/cloud/paas/autonomous-database/dedicated/adbcl/index.html for information about these service types.
5860
* `destination_availability_domain` - The availability domain of the destination mount target. Example: `BBTh:region-AD`
5961
* `destination_capacity_reservation_id` - The OCID of a capacity reservation in the destination region which will be used to launch the compute instance. Example: `ocid1.capacityreservation.oc1..uniqueID`
6062
* `destination_compartment_id` - The OCID of a compartment in the destination region in which the compute instance should be launched. Example: `ocid1.compartment.oc1..uniqueID`
@@ -78,7 +80,7 @@ The following attributes are exported:
7880
* `member_id` - The OCID of the member. Example: `ocid1.instance.oc1..uniqueID`
7981
* `member_type` - The type of the member.
8082
* `namespace` - The namespace in object storage (Note - this is usually the tenancy name). Example: `myocitenancy`
81-
* `password_vault_secret_id` - The OCID of the vault secret where the database SYSDBA password is stored. This password is used for performing database DR operations. Example: `ocid1.vaultsecret.oc1..uniqueID`
83+
* `password_vault_secret_id` - The OCID of the vault secret where the database SYSDBA password is stored. This password is required and used for performing database DR Drill operations when using full clone. Example: `ocid1.vaultsecret.oc1..uniqueID`
8284
* `vnic_mapping` - A list of compute instance VNIC mappings.
8385
* `destination_nsg_id_list` - A list of OCIDs of network security groups (NSG) in the destination region which should be assigned to the source VNIC. Example: `[ ocid1.networksecuritygroup.oc1..uniqueID1, ocid1.networksecuritygroup.oc1..uniqueID2 ]`
8486
* `destination_subnet_id` - The OCID of the destination subnet to which the source VNIC should connect. Example: `ocid1.subnet.oc1..uniqueID`

website/docs/d/disaster_recovery_dr_protection_groups.html.markdown

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ The following attributes are exported:
6262
* `namespace` - The namespace in object storage (Note - this is usually the tenancy name). Example: `myocitenancy`
6363
* `object` - The object name inside the object storage bucket. Example: `switchover_plan_executions`
6464
* `members` - A list of DR protection group members.
65+
* `autonomous_database_standby_type_for_dr_drills` - This specifies the mechanism used to create a temporary Autonomous Database instance for DR Drills. See https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/autonomous-clone-about.html for information about these clone types. See https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/autonomous-data-guard-snapshot-standby.html for information about snapshot standby.
6566
* `backend_set_mappings` - A list of backend set mappings that are used to transfer or update backends during DR.
6667
* `destination_backend_set_name` - The name of the destination backend set. Example: `My_Destination_Backend_Set`
6768
* `is_backend_set_for_non_movable` - This flag specifies if this backend set is used for traffic for non-movable compute instances. Backend sets that point to non-movable instances are only enabled or disabled during DR. For non-movable instances this flag should be set to 'true'. Backend sets that point to movable instances are emptied and their contents are transferred to the destination region network load balancer. For movable instances this flag should be set to 'false'. Example: `true`
@@ -72,6 +73,7 @@ The following attributes are exported:
7273
* `block_volume_id` - The OCID of the block volume. Example: `ocid1.volume.oc1..uniqueID`
7374
* `mount_details` - The details for mounting or unmounting the file system on a block volume.
7475
* `mount_point` - The physical mount point used for mounting and unmounting the file system on a block volume. Example: `/mnt/yourmountpoint`
76+
* `connection_string_type` - The type of connection strings used to connect to an Autonomous Container Database snapshot standby created during a DR Drill operation. See https://docs.oracle.com/en/cloud/paas/autonomous-database/dedicated/adbcl/index.html for information about these service types.
7577
* `bucket` - The bucket name inside the object storage namespace. Example: `bucket_name`
7678
* `destination_availability_domain` - The availability domain of the destination mount target. Example: `BBTh:region-AD`
7779
* `destination_capacity_reservation_id` - The OCID of a capacity reservation in the destination region which will be used to launch the compute instance. Example: `ocid1.capacityreservation.oc1..uniqueID`
@@ -96,7 +98,7 @@ The following attributes are exported:
9698
* `member_id` - The OCID of the member. Example: `ocid1.instance.oc1..uniqueID`
9799
* `member_type` - The type of the member.
98100
* `namespace` - The namespace in object storage (Note - this is usually the tenancy name). Example: `myocitenancy`
99-
* `password_vault_secret_id` - The OCID of the vault secret where the database SYSDBA password is stored. This password is used for performing database DR operations. Example: `ocid1.vaultsecret.oc1..uniqueID`
101+
* `password_vault_secret_id` - The OCID of the vault secret where the database SYSDBA password is stored. This password is required and used for performing database DR Drill operations when using full clone. Example: `ocid1.vaultsecret.oc1..uniqueID`
100102
* `vnic_mapping` - A list of compute instance VNIC mappings.
101103
* `destination_nsg_id_list` - A list of OCIDs of network security groups (NSG) in the destination region which should be assigned to the source VNIC. Example: `[ ocid1.networksecuritygroup.oc1..uniqueID1, ocid1.networksecuritygroup.oc1..uniqueID2 ]`
102104
* `destination_subnet_id` - The OCID of the destination subnet to which the source VNIC should connect. Example: `ocid1.subnet.oc1..uniqueID`

0 commit comments

Comments
 (0)