nagaboinaramgopal opened a new pull request, #347:
URL: https://github.com/apache/cloudstack-terraform-provider/pull/347
### Description
When a resource is deleted out of band, its Read still returned the "No
match found" error from GetByID, which fails the whole plan instead of letting
Terraform recreate the resource. GetByID reports count 0 for a genuinely
missing resource and count -1 for a transport error, so Read now clears the id
and returns nil only when count is 0, and still returns the error otherwise.
Applied to the resources whose Read did not already handle this: attach_volume,
cluster, loadbalancer, physical_network, pod, secondary_storage, storage_pool,
vlan_ip_range, and zone.
### Testing
Added a unit test `TestZoneReadRemovesDeletedFromState` covering the zone
resource as a representative case, using a stub server that returns an empty
list so GetZoneByID reports count 0. It needs no live CloudStack:
go test ./cloudstack/ -run TestZoneReadRemovesDeletedFromState
Before the fix Read returns the "No match found" error; after it, Read
clears the id and returns nil.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]