Skip to content

Commit

Permalink
Merge pull request #5054 from ptv-logistics/fix-product-api-not-reass…
Browse files Browse the repository at this point in the history
…igned

Fix product api not reassigned on manual delete
  • Loading branch information
tombuildsstuff authored Dec 16, 2019
2 parents 9741a18 + 5e3bf1c commit 6be581b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions azurerm/resource_arm_api_management_product_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ func resourceArmApiManagementProductApiRead(d *schema.ResourceData, meta interfa
return fmt.Errorf("Error retrieving API %q / Product %q (API Management Service %q / Resource Group %q): %+v", apiName, productId, serviceName, resourceGroup, err)
}

// This can be removed once updated to apimanagement API to 2019-01-01
// https://github.com/Azure/azure-sdk-for-go/blob/master/services/apimanagement/mgmt/2019-01-01/apimanagement/productapi.go#L134
if utils.ResponseWasNotFound(resp) {
log.Printf("[DEBUG] API %q was not found in Product %q (API Management Service %q / Resource Group %q) was not found - removing from state!", apiName, productId, serviceName, resourceGroup)
d.SetId("")
return nil
}

d.Set("api_name", apiName)
d.Set("product_id", productId)
d.Set("resource_group_name", resourceGroup)
Expand Down

0 comments on commit 6be581b

Please sign in to comment.