Skip to content

Commit df6dde8

Browse files
dyajamanravinitp
authored andcommitted
Added - Support for adding custom pre check step in DR Plans
1 parent 9034610 commit df6dde8

15 files changed

+1177
-272
lines changed

internal/integrationtest/disaster_recovery_dr_plan_execution_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ var (
5050
DisasterRecoveryDrPlanExecutionRepresentation = map[string]interface{}{
5151
"execution_options": acctest.RepresentationGroup{RepType: acctest.Required, Group: DisasterRecoveryDrPlanExecutionExecutionOptionsRepresentation},
5252
"plan_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_disaster_recovery_dr_plan.test_dr_plan.id}`},
53-
"defined_tags": acctest.Representation{RepType: acctest.Optional, Create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, Update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
54-
"display_name": acctest.Representation{RepType: acctest.Optional, Create: `Precheck Switchover from PHX to IAD`, Update: `displayName2`},
55-
"freeform_tags": acctest.Representation{RepType: acctest.Optional, Create: map[string]string{"Department": "Finance"}, Update: map[string]string{"Department": "Accounting"}},
56-
"lifecycle": acctest.RepresentationGroup{RepType: acctest.Optional, Group: DefinedTagsIgnoreRepresentation},
53+
//"defined_tags": acctest.Representation{RepType: acctest.Optional, Create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, Update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
54+
"display_name": acctest.Representation{RepType: acctest.Optional, Create: `Precheck Switchover from PHX to IAD`, Update: `displayName2`},
55+
"freeform_tags": acctest.Representation{RepType: acctest.Optional, Create: map[string]string{"Department": "Finance"}, Update: map[string]string{"Department": "Accounting"}},
56+
"lifecycle": acctest.RepresentationGroup{RepType: acctest.Optional, Group: DefinedTagsIgnoreRepresentation},
5757
}
5858
DisasterRecoveryDrPlanExecutionExecutionOptionsRepresentation = map[string]interface{}{
5959
"plan_execution_type": acctest.Representation{RepType: acctest.Required, Create: `SWITCHOVER_PRECHECK`},
@@ -62,11 +62,10 @@ var (
6262
}
6363

6464
DisasterRecoveryDrPlanExecutionResourceDependencies = acctest.GenerateResourceFromRepresentationMap("oci_disaster_recovery_dr_protection_group", "test_peer", acctest.Optional, acctest.Create, DisasterRecoveryPeerDrProtectionGroupRepresentation) +
65-
OKEClusterDependencyConfig +
6665
ObjectStorageBucketDependencyConfig +
6766
VolumeGroupDependencyConfig +
68-
AvailabilityDomainConfig +
69-
DefinedTagsDependencies
67+
AvailabilityDomainConfig
68+
//DefinedTagsDependencies
7069

7170
DrProtectionGroupConfig = acctest.GenerateResourceFromRepresentationMap("oci_disaster_recovery_dr_protection_group", "test_dr_protection_group", acctest.Optional, acctest.Create, DisasterRecoveryDrProtectionGroupRepresentation)
7271

internal/integrationtest/disaster_recovery_dr_plan_test.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ var (
5858
"display_name": acctest.Representation{RepType: acctest.Required, Create: `Switchover from PHX to IAD`, Update: `displayName2`},
5959
"dr_protection_group_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_disaster_recovery_dr_protection_group.test_peer.id}`},
6060
"type": acctest.Representation{RepType: acctest.Required, Create: `SWITCHOVER`},
61-
"defined_tags": acctest.Representation{RepType: acctest.Optional, Create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, Update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
62-
"freeform_tags": acctest.Representation{RepType: acctest.Optional, Create: map[string]string{"Department": "Finance"}, Update: map[string]string{"Department": "Accounting"}},
61+
//"defined_tags": acctest.Representation{RepType: acctest.Optional, Create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, Update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
62+
"freeform_tags": acctest.Representation{RepType: acctest.Optional, Create: map[string]string{"Department": "Finance"}, Update: map[string]string{"Department": "Accounting"}},
6363
//"source_plan_id": acctest.Representation{RepType: acctest.Optional, Create: `${oci_disaster_recovery_source_plan.test_source_plan.id}`},
6464
"refresh_trigger": acctest.Representation{RepType: acctest.Optional, Create: `0`, Update: `1`},
6565
"verify_trigger": acctest.Representation{RepType: acctest.Optional, Create: `0`, Update: `1`},
@@ -70,8 +70,8 @@ var (
7070
"display_name": acctest.Representation{RepType: acctest.Required, Create: `Switchover from PHX to IAD`, Update: `displayName2`},
7171
"dr_protection_group_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_disaster_recovery_dr_protection_group.test_peer.id}`},
7272
"type": acctest.Representation{RepType: acctest.Required, Create: `SWITCHOVER`},
73-
"defined_tags": acctest.Representation{RepType: acctest.Optional, Create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, Update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
74-
"freeform_tags": acctest.Representation{RepType: acctest.Optional, Create: map[string]string{"Department": "Finance"}, Update: map[string]string{"Department": "Accounting"}},
73+
//"defined_tags": acctest.Representation{RepType: acctest.Optional, Create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, Update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
74+
"freeform_tags": acctest.Representation{RepType: acctest.Optional, Create: map[string]string{"Department": "Finance"}, Update: map[string]string{"Department": "Accounting"}},
7575
//"source_plan_id": acctest.Representation{RepType: acctest.Optional, Create: `${oci_disaster_recovery_source_plan.test_source_plan.id}`},
7676
"lifecycle": acctest.RepresentationGroup{RepType: acctest.Optional, Group: DefinedTagsIgnoreRepresentation},
7777
}
@@ -97,11 +97,10 @@ var (
9797
`
9898

9999
DisasterRecoveryDrPlanResourceDependencies = acctest.GenerateResourceFromRepresentationMap("oci_disaster_recovery_dr_protection_group", "test_peer", acctest.Optional, acctest.Create, DisasterRecoveryPeerDrProtectionGroupRepresentation) +
100-
OKEClusterDependencyConfig +
101100
ObjectStorageBucketDependencyConfig +
102101
VolumeGroupDependencyConfig +
103-
AvailabilityDomainConfig +
104-
DefinedTagsDependencies
102+
AvailabilityDomainConfig
103+
//DefinedTagsDependencies
105104
)
106105

107106
// issue-routing-tag: disaster_recovery/default
@@ -239,7 +238,7 @@ func TestDisasterRecoveryDrPlanResource_basic(t *testing.T) {
239238
resource.TestCheckResourceAttrSet(resourceName, "peer_dr_protection_group_id"),
240239
resource.TestCheckResourceAttrSet(resourceName, "peer_region"),
241240
//resource.TestCheckResourceAttrSet(resourceName, "source_plan_id"),
242-
resource.TestCheckResourceAttr(resourceName, "plan_groups.#", "4"),
241+
resource.TestCheckResourceAttr(resourceName, "plan_groups.#", "3"),
243242
resource.TestCheckResourceAttrSet(resourceName, "state"),
244243
resource.TestCheckResourceAttrSet(resourceName, "time_created"),
245244
resource.TestCheckResourceAttrSet(resourceName, "time_updated"),
@@ -272,7 +271,7 @@ func TestDisasterRecoveryDrPlanResource_basic(t *testing.T) {
272271
resource.TestCheckResourceAttrSet(resourceName, "peer_dr_protection_group_id"),
273272
resource.TestCheckResourceAttrSet(resourceName, "peer_region"),
274273
//resource.TestCheckResourceAttrSet(resourceName, "source_plan_id"),
275-
resource.TestCheckResourceAttr(resourceName, "plan_groups.#", "4"),
274+
resource.TestCheckResourceAttr(resourceName, "plan_groups.#", "3"),
276275
resource.TestCheckResourceAttrSet(resourceName, "state"),
277276
resource.TestCheckResourceAttrSet(resourceName, "time_created"),
278277
resource.TestCheckResourceAttrSet(resourceName, "time_updated"),
@@ -339,7 +338,7 @@ func TestDisasterRecoveryDrPlanResource_basic(t *testing.T) {
339338
},
340339
// Disassociate DrProtectionGroup
341340
{
342-
Config: config + compartmentIdVariableStr + DisasterRecoveryDrPlanResourceDependencies +
341+
Config: config + compartmentIdVariableStr + DisasterRecoveryDrPlanExecutionResourceDependencies +
343342
DrProtectionGroupWithDisassociateTriggerConfig,
344343
Check: acctest.ComposeAggregateTestCheckFuncWrapper(
345344
func(s *terraform.State) (err error) {

0 commit comments

Comments
 (0)