@@ -56,12 +56,13 @@ var (
5656 "availability_domain" : acctest.Representation {RepType : acctest .Required , Create : `${data.oci_identity_availability_domains.test_availability_domains.availability_domains.0.name}` },
5757 "compartment_id" : acctest.Representation {RepType : acctest .Required , Create : `${var.compartment_id}` },
5858 "configuration_id" : acctest.Representation {RepType : acctest .Optional , Create : `${var.MysqlConfigurationOCID[var.region]}` },
59- "shape_name" : acctest.Representation {RepType : acctest .Required , Create : `VM.Standard.E2.2 ` },
59+ "shape_name" : acctest.Representation {RepType : acctest .Required , Create : `MySQL. VM.Standard.E3.1.8GB ` },
6060 "subnet_id" : acctest.Representation {RepType : acctest .Required , Create : `${oci_core_subnet.test_subnet.id}` },
6161 "backup_policy" : acctest.RepresentationGroup {RepType : acctest .Optional , Group : mysqlDbSystemBackupPolicyRepresentation },
6262 "crash_recovery" : acctest.Representation {RepType : acctest .Optional , Create : `ENABLED` },
6363 "data_storage_size_in_gb" : acctest.Representation {RepType : acctest .Required , Create : `50` },
6464 "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")}` },
65+ "deletion_policy" : acctest.RepresentationGroup {RepType : acctest .Optional , Group : mysqlDbSystemDeletionPolicyRepresentation },
6566 "description" : acctest.Representation {RepType : acctest .Optional , Create : `MySQL Database Service` , Update : `description2` },
6667 "display_name" : acctest.Representation {RepType : acctest .Optional , Create : `DBSystem001` , Update : `displayName2` },
6768 "fault_domain" : acctest.Representation {RepType : acctest .Optional , Create : `FAULT-DOMAIN-1` },
9596 "window_start_time" : acctest.Representation {RepType : acctest .Optional , Create : `01:00-00:00` },
9697 }
9798
99+ mysqlDbSystemDeletionPolicyRepresentation = map [string ]interface {}{
100+ // Don't update these as setting the deletion policy to true or backup retention to retain will leave resources
101+ // that can't be removed.
102+ "automatic_backup_retention" : acctest.Representation {RepType : acctest .Optional , Create : `DELETE` , Update : `RETAIN` },
103+ "final_backup" : acctest.Representation {RepType : acctest .Optional , Create : `SKIP_FINAL_BACKUP` , Update : `REQUIRE_FINAL_BACKUP` },
104+ //"is_delete_protected": acctest.Representation{RepType: acctest.Optional, Create: `false`, Update: `true`},
105+ "is_delete_protected" : acctest.Representation {RepType : acctest .Optional , Create : `false` },
106+ }
107+
98108 mysqlDbSystemMaintenanceRepresentation = map [string ]interface {}{
99109 "window_start_time" : acctest.Representation {RepType : acctest .Required , Create : `sun 01:00` },
100110 }
@@ -169,6 +179,10 @@ func TestMysqlMysqlDbSystemResource_basic(t *testing.T) {
169179 resource .TestCheckResourceAttrSet (resourceName , "configuration_id" ),
170180 resource .TestCheckResourceAttr (resourceName , "crash_recovery" , "ENABLED" ),
171181 resource .TestCheckResourceAttr (resourceName , "data_storage_size_in_gb" , "50" ),
182+ resource .TestCheckResourceAttr (resourceName , "deletion_policy.#" , "1" ),
183+ resource .TestCheckResourceAttr (resourceName , "deletion_policy.0.automatic_backup_retention" , "DELETE" ),
184+ resource .TestCheckResourceAttr (resourceName , "deletion_policy.0.final_backup" , "SKIP_FINAL_BACKUP" ),
185+ resource .TestCheckResourceAttr (resourceName , "deletion_policy.0.is_delete_protected" , "false" ),
172186 resource .TestCheckResourceAttr (resourceName , "description" , "MySQL Database Service" ),
173187 resource .TestCheckResourceAttr (resourceName , "display_name" , "DBSystem001" ),
174188 resource .TestCheckResourceAttr (resourceName , "fault_domain" , "FAULT-DOMAIN-1" ),
@@ -219,6 +233,10 @@ func TestMysqlMysqlDbSystemResource_basic(t *testing.T) {
219233 resource .TestCheckResourceAttrSet (resourceName , "configuration_id" ),
220234 resource .TestCheckResourceAttr (resourceName , "crash_recovery" , "ENABLED" ),
221235 resource .TestCheckResourceAttr (resourceName , "data_storage_size_in_gb" , "50" ),
236+ resource .TestCheckResourceAttr (resourceName , "deletion_policy.#" , "1" ),
237+ resource .TestCheckResourceAttr (resourceName , "deletion_policy.0.automatic_backup_retention" , "RETAIN" ),
238+ resource .TestCheckResourceAttr (resourceName , "deletion_policy.0.final_backup" , "REQUIRE_FINAL_BACKUP" ),
239+ resource .TestCheckResourceAttr (resourceName , "deletion_policy.0.is_delete_protected" , "false" ),
222240 resource .TestCheckResourceAttr (resourceName , "description" , "description2" ),
223241 resource .TestCheckResourceAttr (resourceName , "display_name" , "displayName2" ),
224242 resource .TestCheckResourceAttr (resourceName , "freeform_tags.%" , "1" ),
@@ -271,6 +289,10 @@ func TestMysqlMysqlDbSystemResource_basic(t *testing.T) {
271289 resource .TestCheckResourceAttr (datasourceName , "db_systems.0.compartment_id" , compartmentId ),
272290 resource .TestCheckResourceAttr (datasourceName , "db_systems.0.crash_recovery" , "ENABLED" ),
273291 resource .TestCheckResourceAttr (datasourceName , "db_systems.0.current_placement.#" , "1" ),
292+ resource .TestCheckResourceAttr (datasourceName , "db_systems.0.deletion_policy.#" , "1" ),
293+ resource .TestCheckResourceAttr (datasourceName , "db_systems.0.deletion_policy.0.automatic_backup_retention" , "RETAIN" ),
294+ resource .TestCheckResourceAttr (datasourceName , "db_systems.0.deletion_policy.0.final_backup" , "REQUIRE_FINAL_BACKUP" ),
295+ resource .TestCheckResourceAttr (datasourceName , "db_systems.0.deletion_policy.0.is_delete_protected" , "false" ),
274296 resource .TestCheckResourceAttr (datasourceName , "db_systems.0.description" , "description2" ),
275297 resource .TestCheckResourceAttr (datasourceName , "db_systems.0.display_name" , "displayName2" ),
276298 resource .TestCheckResourceAttr (datasourceName , "db_systems.0.endpoints.#" , "1" ),
@@ -308,6 +330,10 @@ func TestMysqlMysqlDbSystemResource_basic(t *testing.T) {
308330 resource .TestCheckResourceAttr (singularDatasourceName , "crash_recovery" , "ENABLED" ),
309331 resource .TestCheckResourceAttr (singularDatasourceName , "current_placement.#" , "1" ),
310332 resource .TestCheckResourceAttr (singularDatasourceName , "data_storage_size_in_gb" , "50" ),
333+ resource .TestCheckResourceAttr (singularDatasourceName , "deletion_policy.#" , "1" ),
334+ resource .TestCheckResourceAttr (singularDatasourceName , "deletion_policy.0.automatic_backup_retention" , "RETAIN" ),
335+ resource .TestCheckResourceAttr (singularDatasourceName , "deletion_policy.0.final_backup" , "REQUIRE_FINAL_BACKUP" ),
336+ resource .TestCheckResourceAttr (singularDatasourceName , "deletion_policy.0.is_delete_protected" , "false" ),
311337 resource .TestCheckResourceAttr (singularDatasourceName , "description" , "description2" ),
312338 resource .TestCheckResourceAttr (singularDatasourceName , "display_name" , "displayName2" ),
313339 resource .TestCheckResourceAttr (singularDatasourceName , "endpoints.#" , "1" ),
0 commit comments