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

[Redis] Add min tls redis #3111

Merged
merged 7 commits into from
Mar 27, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion azurerm/resource_arm_redis_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ func resourceArmRedisCache() *schema.Resource {
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
},

"minimum_tls_version": {
Type: schema.TypeString,
Optional: true,
Default: redis.OneFullStopZero,
ValidateFunc: validation.StringInSlice([]string{
string(redis.OneFullStopZero),
string(redis.OneFullStopOne),
string(redis.OneFullStopTwo),
}, false),
},

"shard_count": {
Type: schema.TypeInt,
Optional: true,
Expand Down Expand Up @@ -255,6 +266,7 @@ func resourceArmRedisCacheCreate(d *schema.ResourceData, meta interface{}) error
Family: family,
Name: sku,
},
MinimumTLSVersion: redis.TLSVersion(d.Get("minimum_tls_version").(string)),
RedisConfiguration: expandRedisConfiguration(d),
},
Tags: expandedTags,
Expand Down Expand Up @@ -348,7 +360,8 @@ func resourceArmRedisCacheUpdate(d *schema.ResourceData, meta interface{}) error

parameters := redis.UpdateParameters{
UpdateProperties: &redis.UpdateProperties{
EnableNonSslPort: utils.Bool(enableNonSSLPort),
MinimumTLSVersion: redis.TLSVersion(d.Get("minimum_tls_version").(string)),
EnableNonSslPort: utils.Bool(enableNonSSLPort),
Sku: &redis.Sku{
Capacity: utils.Int32(capacity),
Family: family,
Expand Down Expand Up @@ -473,6 +486,7 @@ func resourceArmRedisCacheRead(d *schema.ResourceData, meta interface{}) error {
if props := resp.Properties; props != nil {
d.Set("ssl_port", props.SslPort)
d.Set("hostname", props.HostName)
d.Set("minimum_tls_version", props.MinimumTLSVersion)
Lucretius marked this conversation as resolved.
Show resolved Hide resolved
d.Set("port", props.Port)
d.Set("enable_non_ssl_port", props.EnableNonSslPort)
if props.ShardCount != nil {
Expand Down
3 changes: 2 additions & 1 deletion azurerm/resource_arm_redis_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,8 @@ resource "azurerm_redis_cache" "test" {
capacity = 1
family = "C"
sku_name = "Basic"
enable_non_ssl_port = false
enable_non_ssl_port = false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we fix the alignment here?

minimum_tls_version = "1.2"

redis_configuration {}
}
Expand Down
3 changes: 3 additions & 0 deletions website/docs/r/redis_cache.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ resource "azurerm_redis_cache" "test" {
family = "C"
sku_name = "Standard"
enable_non_ssl_port = false
minimum_tls_version = "1.2"
}
```

Expand Down Expand Up @@ -135,6 +136,8 @@ The pricing group for the Redis Family - either "C" or "P" at present.

* `enable_non_ssl_port` - (Optional) Enable the non-SSL port (6789) - disabled by default.

* `minimum_tls_version` - (Optional) The minimum TLS version. Defaults to `1.0`.

* `patch_schedule` - (Optional) A list of `patch_schedule` blocks as defined below - only available for Premium SKU's.

* `private_static_ip_address` - (Optional) The Static IP Address to assign to the Redis Cache when hosted inside the Virtual Network. Changing this forces a new resource to be created.
Expand Down