Skip to content

Commit 9dfdd42

Browse files
committed
fix: setting enable_global_user to a default of true in state to avoid confused user states when migrating
1 parent 927a62b commit 9dfdd42

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)
77
# 2.7.2 (29th October 2025)
88

99
## Fixed
10-
- rediscloud_active_active_subscription_database: Fixed issue where changes to `global_enable_default_user` were not detected by Terraform. The field was not being read from the API response and set in state, preventing Terraform from triggering updates when users changed this attribute.
10+
- rediscloud_active_active_subscription_database: Fixed issue where changes to `global_enable_default_user` were not detected by Terraform. The API does not return this field in responses, so the provider now preserves the configured value in state to enable proper change detection. This fixes a state drift issue where users upgrading from older provider versions would have empty state for this field, causing Terraform to ignore configuration changes.
1111

1212
# 2.7.1 (27th October 2025)
1313

provider/resource_rediscloud_active_active_database.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -657,9 +657,16 @@ func resourceRedisCloudActiveActiveDatabaseRead(ctx context.Context, d *schema.R
657657
return diag.FromErr(err)
658658
}
659659

660-
// Only set global_enable_default_user if Security field exists and EnableDefaultUser is not nil
661-
if db.Security != nil && db.Security.EnableDefaultUser != nil {
662-
if err := d.Set("global_enable_default_user", redis.BoolValue(db.Security.EnableDefaultUser)); err != nil {
660+
// API doesn't return global_enable_default_user, so we echo back the config value to maintain state
661+
// This allows Terraform to detect future changes properly
662+
if v, ok := d.GetOk("global_enable_default_user"); ok {
663+
// User has explicitly set it in config, preserve that value in state
664+
if err := d.Set("global_enable_default_user", v.(bool)); err != nil {
665+
return diag.FromErr(err)
666+
}
667+
} else {
668+
// Not set in config, assume API default of true
669+
if err := d.Set("global_enable_default_user", true); err != nil {
663670
return diag.FromErr(err)
664671
}
665672
}

0 commit comments

Comments
 (0)