|
|
|
|
@ -18,6 +18,10 @@ import (
|
|
|
|
|
type InstanceKey interface {
|
|
|
|
|
instanceKeySigil()
|
|
|
|
|
String() string
|
|
|
|
|
|
|
|
|
|
// Value returns the cty.Value of the appropriate type for the InstanceKey
|
|
|
|
|
// value.
|
|
|
|
|
Value() cty.Value
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ParseInstanceKey returns the instance key corresponding to the given value,
|
|
|
|
|
@ -56,6 +60,10 @@ func (k IntKey) String() string {
|
|
|
|
|
return fmt.Sprintf("[%d]", int(k))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (k IntKey) Value() cty.Value {
|
|
|
|
|
return cty.NumberIntVal(int64(k))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// StringKey is the InstanceKey representation representing string indices, as
|
|
|
|
|
// used when the "for_each" argument is specified with a map or object type.
|
|
|
|
|
type StringKey string
|
|
|
|
|
@ -69,6 +77,10 @@ func (k StringKey) String() string {
|
|
|
|
|
return fmt.Sprintf("[%q]", string(k))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (k StringKey) Value() cty.Value {
|
|
|
|
|
return cty.StringVal(string(k))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// InstanceKeyLess returns true if the first given instance key i should sort
|
|
|
|
|
// before the second key j, and false otherwise.
|
|
|
|
|
func InstanceKeyLess(i, j InstanceKey) bool {
|
|
|
|
|
|