@@ -181,7 +181,8 @@ func DatabaseAutonomousDatabaseResource() *schema.Resource {
181181 Computed : true ,
182182 },
183183 "db_tools_details" : {
184- Type : schema .TypeList ,
184+ Type : schema .TypeSet ,
185+ Set : dbToolsForSets ,
185186 Optional : true ,
186187 Computed : true ,
187188 Elem : & schema.Resource {
@@ -1874,10 +1875,11 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) Update() error {
18741875 }
18751876
18761877 if dbToolsDetails , ok := s .D .GetOkExists ("db_tools_details" ); ok && s .D .HasChange ("db_tools_details" ) {
1877- interfaces := dbToolsDetails .([]interface {})
1878+ set := dbToolsDetails .(* schema.Set )
1879+ interfaces := set .List ()
18781880 tmp := make ([]oci_database.DatabaseTool , len (interfaces ))
18791881 for i := range interfaces {
1880- stateDataIndex := i
1882+ stateDataIndex := dbToolsForSets ( interfaces [ i ])
18811883 fieldKeyFormat := fmt .Sprintf ("%s.%d.%%s" , "db_tools_details" , stateDataIndex )
18821884 converted , err := s .mapToDatabaseTool (fieldKeyFormat )
18831885 if err != nil {
@@ -2113,7 +2115,7 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) SetData() error {
21132115 for _ , item := range s .Res .DbToolsDetails {
21142116 dbToolsDetails = append (dbToolsDetails , DatabaseToolToMap (item ))
21152117 }
2116- s .D .Set ("db_tools_details" , dbToolsDetails )
2118+ s .D .Set ("db_tools_details" , schema . NewSet ( dbToolsForSets , dbToolsDetails ) )
21172119
21182120 if s .Res .DbVersion != nil {
21192121 s .D .Set ("db_version" , * s .Res .DbVersion )
@@ -2946,10 +2948,11 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) populateTopLevelPolymorphicCrea
29462948 details .DbName = & tmp
29472949 }
29482950 if dbToolsDetails , ok := s .D .GetOkExists ("db_tools_details" ); ok {
2949- interfaces := dbToolsDetails .([]interface {})
2951+ set := dbToolsDetails .(* schema.Set )
2952+ interfaces := set .List ()
29502953 tmp := make ([]oci_database.DatabaseTool , len (interfaces ))
29512954 for i := range interfaces {
2952- stateDataIndex := i
2955+ stateDataIndex := dbToolsForSets ( interfaces [ i ])
29532956 fieldKeyFormat := fmt .Sprintf ("%s.%d.%%s" , "db_tools_details" , stateDataIndex )
29542957 converted , err := s .mapToDatabaseTool (fieldKeyFormat )
29552958 if err != nil {
@@ -3233,10 +3236,11 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) populateTopLevelPolymorphicCrea
32333236 details .DbName = & tmp
32343237 }
32353238 if dbToolsDetails , ok := s .D .GetOkExists ("db_tools_details" ); ok {
3236- interfaces := dbToolsDetails .([]interface {})
3239+ set := dbToolsDetails .(* schema.Set )
3240+ interfaces := set .List ()
32373241 tmp := make ([]oci_database.DatabaseTool , len (interfaces ))
32383242 for i := range interfaces {
3239- stateDataIndex := i
3243+ stateDataIndex := dbToolsForSets ( interfaces [ i ])
32403244 fieldKeyFormat := fmt .Sprintf ("%s.%d.%%s" , "db_tools_details" , stateDataIndex )
32413245 converted , err := s .mapToDatabaseTool (fieldKeyFormat )
32423246 if err != nil {
@@ -3515,10 +3519,11 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) populateTopLevelPolymorphicCrea
35153519 details .DbName = & tmp
35163520 }
35173521 if dbToolsDetails , ok := s .D .GetOkExists ("db_tools_details" ); ok {
3518- interfaces := dbToolsDetails .([]interface {})
3522+ set := dbToolsDetails .(* schema.Set )
3523+ interfaces := set .List ()
35193524 tmp := make ([]oci_database.DatabaseTool , len (interfaces ))
35203525 for i := range interfaces {
3521- stateDataIndex := i
3526+ stateDataIndex := dbToolsForSets ( interfaces [ i ])
35223527 fieldKeyFormat := fmt .Sprintf ("%s.%d.%%s" , "db_tools_details" , stateDataIndex )
35233528 converted , err := s .mapToDatabaseTool (fieldKeyFormat )
35243529 if err != nil {
@@ -3789,10 +3794,11 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) populateTopLevelPolymorphicCrea
37893794 details .DbName = & tmp
37903795 }
37913796 if dbToolsDetails , ok := s .D .GetOkExists ("db_tools_details" ); ok {
3792- interfaces := dbToolsDetails .([]interface {})
3797+ set := dbToolsDetails .(* schema.Set )
3798+ interfaces := set .List ()
37933799 tmp := make ([]oci_database.DatabaseTool , len (interfaces ))
37943800 for i := range interfaces {
3795- stateDataIndex := i
3801+ stateDataIndex := dbToolsForSets ( interfaces [ i ])
37963802 fieldKeyFormat := fmt .Sprintf ("%s.%d.%%s" , "db_tools_details" , stateDataIndex )
37973803 converted , err := s .mapToDatabaseTool (fieldKeyFormat )
37983804 if err != nil {
@@ -4051,10 +4057,11 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) populateTopLevelPolymorphicCrea
40514057 details .DbName = & tmp
40524058 }
40534059 if dbToolsDetails , ok := s .D .GetOkExists ("db_tools_details" ); ok {
4054- interfaces := dbToolsDetails .([]interface {})
4060+ set := dbToolsDetails .(* schema.Set )
4061+ interfaces := set .List ()
40554062 tmp := make ([]oci_database.DatabaseTool , len (interfaces ))
40564063 for i := range interfaces {
4057- stateDataIndex := i
4064+ stateDataIndex := dbToolsForSets ( interfaces [ i ])
40584065 fieldKeyFormat := fmt .Sprintf ("%s.%d.%%s" , "db_tools_details" , stateDataIndex )
40594066 converted , err := s .mapToDatabaseTool (fieldKeyFormat )
40604067 if err != nil {
@@ -4562,10 +4569,11 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) populateTopLevelPolymorphicCrea
45624569 details .DbName = & tmp
45634570 }
45644571 if dbToolsDetails , ok := s .D .GetOkExists ("db_tools_details" ); ok {
4565- interfaces := dbToolsDetails .([]interface {})
4572+ set := dbToolsDetails .(* schema.Set )
4573+ interfaces := set .List ()
45664574 tmp := make ([]oci_database.DatabaseTool , len (interfaces ))
45674575 for i := range interfaces {
4568- stateDataIndex := i
4576+ stateDataIndex := dbToolsForSets ( interfaces [ i ])
45694577 fieldKeyFormat := fmt .Sprintf ("%s.%d.%%s" , "db_tools_details" , stateDataIndex )
45704578 converted , err := s .mapToDatabaseTool (fieldKeyFormat )
45714579 if err != nil {
@@ -4831,10 +4839,11 @@ func (s *DatabaseAutonomousDatabaseResourceCrud) populateTopLevelPolymorphicCrea
48314839 details .DbName = & tmp
48324840 }
48334841 if dbToolsDetails , ok := s .D .GetOkExists ("db_tools_details" ); ok {
4834- interfaces := dbToolsDetails .([]interface {})
4842+ set := dbToolsDetails .(* schema.Set )
4843+ interfaces := set .List ()
48354844 tmp := make ([]oci_database.DatabaseTool , len (interfaces ))
48364845 for i := range interfaces {
4837- stateDataIndex := i
4846+ stateDataIndex := dbToolsForSets ( interfaces [ i ])
48384847 fieldKeyFormat := fmt .Sprintf ("%s.%d.%%s" , "db_tools_details" , stateDataIndex )
48394848 converted , err := s .mapToDatabaseTool (fieldKeyFormat )
48404849 if err != nil {
@@ -5579,3 +5588,21 @@ func scheduledOperationsForSets(v interface{}) int {
55795588 }
55805589 return utils .GetStringHashcode (buf .String ())
55815590}
5591+
5592+ func dbToolsForSets (v interface {}) int {
5593+ var buf bytes.Buffer
5594+ m := v .(map [string ]interface {})
5595+ if name , ok := m ["name" ]; ok && name != "" {
5596+ buf .WriteString (fmt .Sprintf ("%v-" , name ))
5597+ }
5598+ if computeCount , ok := m ["compute_count" ]; ok && computeCount != "" {
5599+ buf .WriteString (fmt .Sprintf ("%v-" , computeCount ))
5600+ }
5601+ if isEnabled , ok := m ["is_enabled" ]; ok && isEnabled != "" {
5602+ buf .WriteString (fmt .Sprintf ("%v-" , isEnabled ))
5603+ }
5604+ if maxIdleTimeInMinutes , ok := m ["max_idle_time_in_minutes" ]; ok && maxIdleTimeInMinutes != "" {
5605+ buf .WriteString (fmt .Sprintf ("%v-" , maxIdleTimeInMinutes ))
5606+ }
5607+ return utils .GetStringHashcode (buf .String ())
5608+ }
0 commit comments