Skip to content

Commit

Permalink
azurerm_redis_cache: support new maxmemory policies `allkeys-lfu' & '…
Browse files Browse the repository at this point in the history
…volatile-lfu` (#7031)

Fixes #7030
  • Loading branch information
StupidScience committed May 20, 2020
1 parent 8950850 commit d57dab7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion azurerm/internal/services/redis/resource_arm_redis_cache.go
Expand Up @@ -900,10 +900,12 @@ func validateRedisMaxMemoryPolicy(v interface{}, _ string) (warnings []string, e
"allkeys-random": true,
"volatile-random": true,
"volatile-ttl": true,
"allkeys-lfu": true,
"volatile-lfu": true,
}

if !families[value] {
errors = append(errors, fmt.Errorf("Redis Max Memory Policy can only be 'noeviction' / 'allkeys-lru' / 'volatile-lru' / 'allkeys-random' / 'volatile-random' / 'volatile-ttl'"))
errors = append(errors, fmt.Errorf("Redis Max Memory Policy can only be 'noeviction' / 'allkeys-lru' / 'volatile-lru' / 'allkeys-random' / 'volatile-random' / 'volatile-ttl' / 'allkeys-lfu' / 'volatile-lfu'"))
}

return warnings, errors
Expand Down
2 changes: 2 additions & 0 deletions azurerm/internal/services/redis/validation_test.go
Expand Up @@ -57,6 +57,8 @@ func TestAccAzureRMRedisCacheMaxMemoryPolicy_validation(t *testing.T) {
{Value: "allkeys-random", ErrCount: 0},
{Value: "volatile-random", ErrCount: 0},
{Value: "volatile-ttl", ErrCount: 0},
{Value: "allkeys-lfu", ErrCount: 0},
{Value: "volatile-lfu", ErrCount: 0},
{Value: "something-else", ErrCount: 1},
}

Expand Down

0 comments on commit d57dab7

Please sign in to comment.