Skip to content

Commit

Permalink
azurerm_redis_cache: fix error messasges and make cfg block optional (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
katbyte authored May 7, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 8c87601 commit adcf488
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions azurerm/resource_arm_redis_cache.go
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ func resourceArmRedisCache() *schema.Resource {
Type: schema.TypeString,
Required: true,
ValidateFunc: validateRedisFamily,
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
DiffSuppressFunc: suppress.CaseDifference,
},

"sku_name": {
@@ -69,7 +69,7 @@ func resourceArmRedisCache() *schema.Resource {
string(redis.Standard),
string(redis.Premium),
}, true),
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
DiffSuppressFunc: suppress.CaseDifference,
},

"minimum_tls_version": {
@@ -109,7 +109,8 @@ func resourceArmRedisCache() *schema.Resource {

"redis_configuration": {
Type: schema.TypeList,
Required: true,
Optional: true,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
@@ -322,16 +323,16 @@ func resourceArmRedisCacheCreate(d *schema.ResourceData, meta interface{}) error

future, err := client.Create(ctx, resGroup, name, parameters)
if err != nil {
return fmt.Errorf("Error issuing create request for read Redis Cache %s (resource group %s) ID", name, resGroup)
return fmt.Errorf("Error issuing create request for Redis Cache %s (resource group %s): %v", name, resGroup, err)
}

if err = future.WaitForCompletionRef(ctx, client.Client); err != nil {
return fmt.Errorf("Error waiting for Redis Cache %s (resource group %s)", name, resGroup)
return fmt.Errorf("Error waiting for the create of Redis Cache %s (resource group %s): %v", name, resGroup, err)
}

read, err := client.Get(ctx, resGroup, name)
if err != nil {
return fmt.Errorf("Error retrieving Redis Cache %s (resource group %s) ID", name, resGroup)
return fmt.Errorf("Error reading Redis Cache %s (resource group %s): %v", name, resGroup, err)
}
if read.ID == nil {
return fmt.Errorf("Cannot read Redis Cache %s (resource group %s) ID", name, resGroup)
@@ -400,8 +401,7 @@ func resourceArmRedisCacheUpdate(d *schema.ResourceData, meta interface{}) error
}

if d.HasChange("redis_configuration") {
redisConfiguration := expandRedisConfiguration(d)
parameters.RedisConfiguration = redisConfiguration
parameters.RedisConfiguration = expandRedisConfiguration(d)
}

if _, err := client.Update(ctx, resGroup, name, parameters); err != nil {
2 changes: 1 addition & 1 deletion website/docs/r/redis_cache.html.markdown
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ The following arguments are supported:

* `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.

* `redis_configuration` - (Required) A `redis_configuration` as defined below - with some limitations by SKU - defaults/details are shown below.
* `redis_configuration` - (Optional) A `redis_configuration` as defined below - with some limitations by SKU - defaults/details are shown below.

* `shard_count` - (Optional) *Only available when using the Premium SKU* The number of Shards to create on the Redis Cluster.

0 comments on commit adcf488

Please sign in to comment.