github.com/mohanarpit/terraform@v0.6.16-0.20160909104007-291f29853544/builtin/providers/azure/utils_test.go (about)

     1  package azure
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/Azure/azure-sdk-for-go/management"
     7  )
     8  
     9  // testAccResourceDestroyedErrorFilter tests whether the given error is an azure ResourceNotFound
    10  // error and properly annotates it if otherwise:
    11  func testAccResourceDestroyedErrorFilter(resource string, err error) error {
    12  	switch {
    13  	case err == nil:
    14  		return fmt.Errorf("Azure %s still exists.", resource)
    15  	case err != nil && management.IsResourceNotFoundError(err):
    16  		return nil
    17  	default:
    18  		return err
    19  	}
    20  }