Skip to content

Commit 09d4d45

Browse files
committed
chore: remove debug logs
1 parent 6614d90 commit 09d4d45

File tree

2 files changed

+2
-100
lines changed

2 files changed

+2
-100
lines changed

provider/resource_rediscloud_active_active_database.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,6 @@ func resourceRedisCloudActiveActiveDatabaseRead(ctx context.Context, d *schema.R
584584

585585
// Iterate through STATE override_region blocks (not API regions) to preserve Set ordering/hashing
586586
stateOverrideRegions := d.Get("override_region").(*schema.Set).List()
587-
tflog.Debug(ctx, "Read: Starting to process regions from STATE", map[string]interface{}{
588-
"regionCount": len(stateOverrideRegions),
589-
})
590587

591588
for _, stateRegion := range stateOverrideRegions {
592589
stateRegionMap := stateRegion.(map[string]interface{})
@@ -605,10 +602,6 @@ func resourceRedisCloudActiveActiveDatabaseRead(ctx context.Context, d *schema.R
605602
regionDbConfigs = append(regionDbConfigs, regionDbConfig)
606603
}
607604

608-
tflog.Debug(ctx, "Read: Completed processing all regions", map[string]interface{}{
609-
"totalRegionsProcessed": len(regionDbConfigs),
610-
})
611-
612605
// Only set override_region if it is defined in the config
613606
if len(d.Get("override_region").(*schema.Set).List()) > 0 {
614607
if err := d.Set("override_region", regionDbConfigs); err != nil {
@@ -639,14 +632,9 @@ func resourceRedisCloudActiveActiveDatabaseRead(ctx context.Context, d *schema.R
639632
// Read global_enable_default_user from API response
640633
if db.GlobalEnableDefaultUser != nil {
641634
globalValue := redis.BoolValue(db.GlobalEnableDefaultUser)
642-
tflog.Debug(ctx, "Read: Setting global_enable_default_user from API", map[string]interface{}{
643-
"value": globalValue,
644-
})
645635
if err := d.Set("global_enable_default_user", globalValue); err != nil {
646636
return diag.FromErr(err)
647637
}
648-
} else {
649-
tflog.Debug(ctx, "Read: global_enable_default_user is nil in API response", map[string]interface{}{})
650638
}
651639

652640
tlsAuthEnabled := *db.CrdbDatabases[0].Security.TLSClientAuthentication
@@ -827,19 +815,9 @@ func resourceRedisCloudActiveActiveDatabaseUpdate(ctx context.Context, d *schema
827815

828816
regionProps.RemoteBackup = pro.BuildBackupPlan(dbRegion["remote_backup"], nil)
829817

830-
tflog.Debug(ctx, "Update: Completed building region properties", map[string]interface{}{
831-
"region": regionName,
832-
"hasEnableDefaultUser": regionProps.EnableDefaultUser != nil,
833-
"enableDefaultUserValue": regionProps.EnableDefaultUser,
834-
})
835-
836818
regions = append(regions, regionProps)
837819
}
838820

839-
tflog.Debug(ctx, "Update: Completed building all region configurations", map[string]interface{}{
840-
"totalRegions": len(regions),
841-
})
842-
843821
// Populate the database update request with the required fields
844822
update := databases.UpdateActiveActiveDatabase{
845823
GlobalAlerts: &updateAlerts,

provider/resource_rediscloud_active_active_database_helpers.go

Lines changed: 2 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -224,28 +224,14 @@ func filterDefaultSourceIPs(apiSourceIPs []*string) []string {
224224
func addSourceIPsIfOverridden(ctx context.Context, regionDbConfig map[string]interface{}, d *schema.ResourceData, regionDb *databases.CrdbDatabase, region string) {
225225
sourceIPs := filterDefaultSourceIPs(regionDb.Security.SourceIPs)
226226

227-
tflog.Debug(ctx, "Read: addSourceIPsIfOverridden", map[string]interface{}{
228-
"region": region,
229-
"apiSourceIPsCount": len(regionDb.Security.SourceIPs),
230-
"filteredIPsCount": len(sourceIPs),
231-
"filteredIPs": sourceIPs,
232-
})
233-
234227
if len(sourceIPs) == 0 {
235-
tflog.Debug(ctx, "Read: Skipping source IPs (filtered to empty)", map[string]interface{}{"region": region})
236228
return
237229
}
238230

239231
globalSourceIPsPtrs := utils.SetToStringSlice(d.Get("global_source_ips").(*schema.Set))
240232
globalSourceIPs := redis.StringSliceValue(globalSourceIPsPtrs...)
241233

242234
shouldAdd := !stringSlicesEqual(sourceIPs, globalSourceIPs)
243-
tflog.Debug(ctx, "Read: Source IPs comparison", map[string]interface{}{
244-
"region": region,
245-
"regionIPs": sourceIPs,
246-
"globalIPs": globalSourceIPs,
247-
"shouldAdd": shouldAdd,
248-
})
249235

250236
if shouldAdd {
251237
regionDbConfig["override_global_source_ips"] = sourceIPs
@@ -263,24 +249,10 @@ func addDataPersistenceIfOverridden(
263249
if regionDb.DataPersistence != nil && db.GlobalDataPersistence != nil {
264250
regionValue := redis.StringValue(regionDb.DataPersistence)
265251
globalValue := redis.StringValue(db.GlobalDataPersistence)
266-
shouldAdd := regionValue != globalValue
267252

268-
tflog.Debug(ctx, "Read: Data persistence comparison", map[string]interface{}{
269-
"region": region,
270-
"regionValue": regionValue,
271-
"globalValue": globalValue,
272-
"shouldAdd": shouldAdd,
273-
})
274-
275-
if shouldAdd {
253+
if regionValue != globalValue {
276254
regionDbConfig["override_global_data_persistence"] = regionDb.DataPersistence
277255
}
278-
} else {
279-
tflog.Debug(ctx, "Read: Skipping data persistence (nil values)", map[string]interface{}{
280-
"region": region,
281-
"regionIsNil": regionDb.DataPersistence == nil,
282-
"globalIsNil": db.GlobalDataPersistence == nil,
283-
})
284256
}
285257
}
286258

@@ -295,25 +267,10 @@ func addPasswordIfOverridden(
295267
if regionDb.Security.Password != nil && db.GlobalPassword != nil {
296268
regionValue := *regionDb.Security.Password
297269
globalValue := redis.StringValue(db.GlobalPassword)
298-
shouldAdd := regionValue != globalValue
299270

300-
tflog.Debug(ctx, "Read: Password comparison", map[string]interface{}{
301-
"region": region,
302-
"regionValue": "[REDACTED]",
303-
"globalValue": "[REDACTED]",
304-
"valuesDiffer": shouldAdd,
305-
"shouldAdd": shouldAdd,
306-
})
307-
308-
if shouldAdd {
271+
if regionValue != globalValue {
309272
regionDbConfig["override_global_password"] = regionValue
310273
}
311-
} else {
312-
tflog.Debug(ctx, "Read: Skipping password (nil values)", map[string]interface{}{
313-
"region": region,
314-
"regionIsNil": regionDb.Security.Password == nil,
315-
"globalIsNil": db.GlobalPassword == nil,
316-
})
317274
}
318275
}
319276

@@ -424,31 +381,18 @@ func addRemoteBackupIfConfigured(
424381
stateOverrideRegion map[string]interface{},
425382
region string,
426383
) {
427-
tflog.Debug(ctx, "Read: Checking remote backup", map[string]interface{}{
428-
"region": region,
429-
"apiHasBackup": regionDb.Backup != nil,
430-
})
431-
432384
if regionDb.Backup == nil {
433-
tflog.Debug(ctx, "Read: Skipping remote backup (nil in API)", map[string]interface{}{"region": region})
434385
return
435386
}
436387

437388
stateRemoteBackup := stateOverrideRegion["remote_backup"]
438389
if stateRemoteBackup == nil {
439-
tflog.Debug(ctx, "Read: Skipping remote backup (nil in state)", map[string]interface{}{"region": region})
440390
return
441391
}
442392

443393
stateRemoteBackupList := stateRemoteBackup.([]interface{})
444-
tflog.Debug(ctx, "Read: Remote backup state list", map[string]interface{}{
445-
"region": region,
446-
"listCount": len(stateRemoteBackupList),
447-
})
448-
449394
if len(stateRemoteBackupList) > 0 {
450395
regionDbConfig["remote_backup"] = pro.FlattenBackupPlan(regionDb.Backup, stateRemoteBackupList, "")
451-
tflog.Debug(ctx, "Read: Added remote_backup to region config", map[string]interface{}{"region": region})
452396
}
453397
}
454398

@@ -484,27 +428,9 @@ func addEnableDefaultUserIfNeeded(
484428
})
485429
}
486430

487-
// logRegionConfigBuilt logs the final region config for debugging.
488-
func logRegionConfigBuilt(ctx context.Context, region string, regionDbConfig map[string]interface{}) {
489-
tflog.Debug(ctx, "Read: Completed region config", map[string]interface{}{
490-
"region": region,
491-
"hasEnableDefaultUser": regionDbConfig["enable_default_user"] != nil,
492-
"enableDefaultUserValue": regionDbConfig["enable_default_user"],
493-
"hasOverrideGlobalSourceIps": regionDbConfig["override_global_source_ips"] != nil,
494-
"hasOverrideGlobalDataPersistence": regionDbConfig["override_global_data_persistence"] != nil,
495-
"hasOverrideGlobalPassword": regionDbConfig["override_global_password"] != nil,
496-
"hasOverrideGlobalAlert": regionDbConfig["override_global_alert"] != nil,
497-
"hasRemoteBackup": regionDbConfig["remote_backup"] != nil,
498-
})
499-
}
500-
501431
// buildRegionConfigFromAPIAndState orchestrates building region config from API and state.
502432
// Each override field is handled by a dedicated helper function for clarity and maintainability.
503433
func buildRegionConfigFromAPIAndState(ctx context.Context, d *schema.ResourceData, db *databases.ActiveActiveDatabase, region string, regionDb *databases.CrdbDatabase, stateOverrideRegion map[string]interface{}) map[string]interface{} {
504-
tflog.Debug(ctx, "Read: Starting buildRegionConfigFromAPIAndState", map[string]interface{}{
505-
"region": region,
506-
})
507-
508434
regionDbConfig := map[string]interface{}{
509435
"name": region,
510436
}
@@ -517,8 +443,6 @@ func buildRegionConfigFromAPIAndState(ctx context.Context, d *schema.ResourceDat
517443
addRemoteBackupIfConfigured(ctx, regionDbConfig, regionDb, stateOverrideRegion, region)
518444
addEnableDefaultUserIfNeeded(ctx, regionDbConfig, d, db, region, regionDb)
519445

520-
logRegionConfigBuilt(ctx, region, regionDbConfig)
521-
522446
return regionDbConfig
523447
}
524448

0 commit comments

Comments
 (0)