Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#24317: Support preferred_data_persistence_auth_method for azurerm_redis_cache resource #24370

Merged
merged 5 commits into from Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions internal/services/redis/redis_cache_resource.go
Expand Up @@ -179,6 +179,16 @@ func resourceRedisCache() *pluginsdk.Resource {
Computed: true,
},

"preferred_data_persistence_auth_method": {
harshavmb marked this conversation as resolved.
Show resolved Hide resolved
Type: pluginsdk.TypeString,
Optional: true,
Default: "SAS",
ValidateFunc: validation.StringInSlice([]string{
"SAS",
"ManagedIdentity",
}, false),
},

"rdb_backup_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Expand Down Expand Up @@ -830,6 +840,10 @@ func expandRedisConfiguration(d *pluginsdk.ResourceData) (*redis.RedisCommonProp
output.MaxmemoryPolicy = utils.String(v)
}

if v := raw["preferred_data_persistence_auth_method"].(string); v != "" {
output.PreferredDataPersistenceAuthMethod = utils.String(v)
}

// AAD/Entra support
// nolint : staticcheck
v, valExists := d.GetOkExists("redis_configuration.0.active_directory_authentication_enabled")
Expand Down Expand Up @@ -1000,6 +1014,10 @@ func flattenRedisConfiguration(input *redis.RedisCommonPropertiesRedisConfigurat
outputs["maxmemory_policy"] = *input.MaxmemoryPolicy
}

if input.PreferredDataPersistenceAuthMethod != nil {
outputs["preferred_data_persistence_auth_method"] = *input.PreferredDataPersistenceAuthMethod
}

if input.MaxfragmentationmemoryReserved != nil {
i, err := strconv.Atoi(*input.MaxfragmentationmemoryReserved)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions internal/services/redis/redis_cache_resource_test.go
Expand Up @@ -30,6 +30,7 @@ func TestAccRedisCache_basic(t *testing.T) {
check.That(data.ResourceName).Key("minimum_tls_version").Exists(),
check.That(data.ResourceName).Key("primary_connection_string").Exists(),
check.That(data.ResourceName).Key("secondary_connection_string").Exists(),
check.That(data.ResourceName).Key("redis_configuration.0.preferred_data_persistence_auth_method").HasValue("SAS"),
),
},
data.ImportStep(),
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/redis_cache.html.markdown
Expand Up @@ -146,6 +146,8 @@ redis_configuration {
* `maxmemory_delta` - (Optional) The max-memory delta for this Redis instance. Defaults are shown below.
* `maxmemory_policy` - (Optional) How Redis will select what to remove when `maxmemory` is reached. Defaults to `volatile-lru`.

* `preferred_data_persistence_auth_method` - (Optional) Preferred auth method to communicate to storage account used for data persistence. Possible values are `SAS` and `ManagedIdentity`. Defaults to `SAS`.

* `maxfragmentationmemory_reserved` - (Optional) Value in megabytes reserved to accommodate for memory fragmentation. Defaults are shown below.

* `rdb_backup_enabled` - (Optional) Is Backup Enabled? Only supported on Premium SKUs. Defaults to `false`.
Expand Down