PaloAltoNetworks / terraform-provider-scm

The Terraform provider for Strata Cloud Manager
Apache License 2.0
7 stars 2 forks source link

error when performing a refresh after a `scm_address_object` is deleted #22

Open zbuchheit opened 2 months ago

zbuchheit commented 2 months ago

Describe the bug

When attempting to refresh after an scm_address_object has been deleted, I receive an error.

│ 
│ [HTTP 400] API_I00013 Your configuration is not valid. Please review the error message for more details. - map[errorType:Object Not Present message:Failed to find obj-uuid for command
│ get]
╵

Expected behavior

I expect the refresh to detect that the scm_address_object is no longer present and remove it from state.

Current behavior

The refresh returns an error and fails.

Possible solution

I believe this is actually a bug with the API response. It should be responding with a 404 not found but is responding back with a 400 bad request which leads the read to handle the error different that what would be expected as you can see here.

Steps to reproduce

  1. Run terraform apply
provider "scm" {
  logging = "detailed"
  host = "api.sase.paloaltonetworks.com"
}

terraform {
  required_providers {
    scm = {
      source = "paloaltonetworks/scm"
      version = "0.9.2"
    }
  }
}

resource scm_address_object "example" {
  name = "1-terraform.com"
  folder = "Shared"
  fqdn = "1-terraform.com"
}
  1. Delete scm_address_object outside of TF
  2. Run terraform refresh

Screenshots

Context

This appears to also be the case with most other resources as well.

Your Environment