Skip to content

Commit

Permalink
hashicorp#24317: Support preferred_data_persistence_auth_method for a…
Browse files Browse the repository at this point in the history
…zurerm_redis_cache resource
  • Loading branch information
harshavmb committed Jan 2, 2024
1 parent 852552f commit b47569d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions internal/services/redis/redis_cache_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ func resourceRedisCache() *pluginsdk.Resource {
Computed: true,
},

"preferred_data_persistence_auth_method": {
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
2 changes: 2 additions & 0 deletions website/docs/r/redis_cache.html.markdown
Original file line number Diff line number Diff line change
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

0 comments on commit b47569d

Please sign in to comment.