code: func ParseInstanceKey(key cty.Value) (InstanceKey, error) {
  	switch key.Type() {
  	case cty.String:
  		return StringKey(key.AsString()), nil
  	case cty.Number:
  		var idx int
  		err := gocty.FromCtyValue(key, &idx)
  		return IntKey(idx), err
  	default:
  		return NoKey, fmt.Errorf("either a string or an integer is required")
  	}
  }
docs: // ParseInstanceKey returns the instance key corresponding to the given value,
  // which must be known and non-null.
  //
  // If an unknown or null value is provided then this function will panic. This
  // function is intended to deal with the values that would naturally be found
  // in a hcl.TraverseIndex, which (when parsed from source, at least) can never
  // contain unknown or null values.