@@ -661,7 +661,7 @@ func (s *DatabaseDbHomeResourceCrud) mapToUpdateDatabaseDetails(fieldKeyFormat s
661661 if dbBackupConfig , ok := s .D .GetOkExists (fmt .Sprintf (fieldKeyFormat , "db_backup_config" )); ok {
662662 if tmpList := dbBackupConfig .([]interface {}); len (tmpList ) > 0 {
663663 fieldKeyFormatNextLevel := fmt .Sprintf ("%s.%d.%%s" , fmt .Sprintf (fieldKeyFormat , "db_backup_config" ), 0 )
664- tmp , err := s .mapToDbBackupConfig (fieldKeyFormatNextLevel )
664+ tmp , err := s .mapToUpdateDbBackupConfig (fieldKeyFormatNextLevel )
665665 if err != nil {
666666 return result , err
667667 }
@@ -706,7 +706,8 @@ func (s *DatabaseDbHomeResourceCrud) CreateDatabaseFromBackupDetailsToMap(obj *o
706706 return result
707707}
708708
709- func (s * DatabaseDbHomeResourceCrud ) mapToDbBackupConfig (fieldKeyFormat string ) (oci_database.DbBackupConfig , error ) {
709+ // We cannot use the same function we use in create because the HasChanged check needed for the update to succeed interferes with the Create functionality
710+ func (s * DatabaseDbHomeResourceCrud ) mapToUpdateDbBackupConfig (fieldKeyFormat string ) (oci_database.DbBackupConfig , error ) {
710711 result := oci_database.DbBackupConfig {}
711712
712713 // Service does not allow to update auto_backup_enabled and recovery_window_in_days at the same time so we must have the HasChanged check
@@ -723,6 +724,22 @@ func (s *DatabaseDbHomeResourceCrud) mapToDbBackupConfig(fieldKeyFormat string)
723724 return result , nil
724725}
725726
727+ func (s * DatabaseDbHomeResourceCrud ) mapToDbBackupConfig (fieldKeyFormat string ) (oci_database.DbBackupConfig , error ) {
728+ result := oci_database.DbBackupConfig {}
729+
730+ if autoBackupEnabled , ok := s .D .GetOkExists (fmt .Sprintf (fieldKeyFormat , "auto_backup_enabled" )); ok {
731+ tmp := autoBackupEnabled .(bool )
732+ result .AutoBackupEnabled = & tmp
733+ }
734+
735+ if recoveryWindowInDays , ok := s .D .GetOkExists (fmt .Sprintf (fieldKeyFormat , "recovery_window_in_days" )); ok {
736+ tmp := recoveryWindowInDays .(int )
737+ result .RecoveryWindowInDays = & tmp
738+ }
739+
740+ return result , nil
741+ }
742+
726743func (s * DatabaseDbHomeResourceCrud ) DbBackupConfigToMap (obj * oci_database.DbBackupConfig ) map [string ]interface {} {
727744 result := map [string ]interface {}{}
728745
0 commit comments