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

azurerm_redis_cache: fix error messasges and make cfg block optional #3397

Merged
merged 2 commits into from
May 7, 2019
Merged
Show file tree
Hide file tree
Changes from all 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: 8 additions & 8 deletions azurerm/resource_arm_redis_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func resourceArmRedisCache() *schema.Resource {
Type: schema.TypeString,
Required: true,
ValidateFunc: validateRedisFamily,
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
DiffSuppressFunc: suppress.CaseDifference,
},

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

"minimum_tls_version": {
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/redis_cache.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down