github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/alicloud/data_source_alicloud_common.go (about)

     1  package alicloud
     2  
     3  import (
     4  	"bytes"
     5  	"fmt"
     6  	"github.com/hashicorp/terraform/helper/hashcode"
     7  )
     8  
     9  // Generates a hash for the set hash function used by the ID
    10  func dataResourceIdHash(ids []string) string {
    11  	var buf bytes.Buffer
    12  
    13  	for _, id := range ids {
    14  		buf.WriteString(fmt.Sprintf("%s-", id))
    15  	}
    16  
    17  	return fmt.Sprintf("%d", hashcode.String(buf.String()))
    18  }