Merge pull request #13899 from hashicorp/azurerm-redis-bug

provider/azurerm: fixing a bug refreshing the `azurerm_redis_cache`
This commit is contained in:
Tom Harvey 2017-04-24 16:17:00 +01:00 committed by GitHub
commit a7401ad354
1 changed files with 6 additions and 3 deletions

View File

@ -281,14 +281,17 @@ func resourceArmRedisCacheRead(d *schema.ResourceData, meta interface{}) error {
name := id.Path["Redis"]
resp, err := client.Get(resGroup, name)
if err != nil {
return fmt.Errorf("Error making Read request on Azure Redis Cache %s: %s", name, err)
}
// covers if the resource has been deleted outside of TF, but is still in the state
if resp.StatusCode == http.StatusNotFound {
d.SetId("")
return nil
}
if err != nil {
return fmt.Errorf("Error making Read request on Azure Redis Cache %s: %s", name, err)
}
keysResp, err := client.ListKeys(resGroup, name)
if err != nil {
return fmt.Errorf("Error making ListKeys request on Azure Redis Cache %s: %s", name, err)