github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/builtin/providers/azurerm/validators.go (about)

     1  package azurerm
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/satori/uuid"
     7  )
     8  
     9  func validateJsonString(v interface{}, k string) (ws []string, errors []error) {
    10  	if _, err := normalizeJsonString(v); err != nil {
    11  		errors = append(errors, fmt.Errorf("%q contains an invalid JSON: %s", k, err))
    12  	}
    13  	return
    14  }
    15  
    16  func validateUUID(v interface{}, k string) (ws []string, errors []error) {
    17  	if _, err := uuid.FromString(v.(string)); err != nil {
    18  		errors = append(errors, fmt.Errorf("%q is an invalid UUUID: %s", k, err))
    19  	}
    20  	return
    21  }