mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-29 10:01:07 -05:00
addrs: Be explicit about checkable object address kinds
Previously we were attempting to infer the checkable object address kind of a given address by whether it included "output" in the position where a resource type name would otherwise go. That was already potentially risky because we've historically not prevented a resource type named "output", and it's also a forward-compatibility hazard in case we introduce additional object kinds with entirely-new addressing schemes in future. Given that, we'll instead always be explicit about what kind of address we're storing in a wire or file format, so that we can make sure to always use the intended parser when reading an address back into memory, or return an error if we encounter a kind we're not familiar with.
This commit is contained in:
33
internal/addrs/checkablekind_string.go
Normal file
33
internal/addrs/checkablekind_string.go
Normal file
@@ -0,0 +1,33 @@
|
||||
// Code generated by "stringer -type=CheckableKind check.go"; DO NOT EDIT.
|
||||
|
||||
package addrs
|
||||
|
||||
import "strconv"
|
||||
|
||||
func _() {
|
||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||
// Re-run the stringer command to generate them again.
|
||||
var x [1]struct{}
|
||||
_ = x[CheckableKindInvalid-0]
|
||||
_ = x[CheckableResource-82]
|
||||
_ = x[CheckableOutputValue-79]
|
||||
}
|
||||
|
||||
const (
|
||||
_CheckableKind_name_0 = "CheckableKindInvalid"
|
||||
_CheckableKind_name_1 = "CheckableOutputValue"
|
||||
_CheckableKind_name_2 = "CheckableResource"
|
||||
)
|
||||
|
||||
func (i CheckableKind) String() string {
|
||||
switch {
|
||||
case i == 0:
|
||||
return _CheckableKind_name_0
|
||||
case i == 79:
|
||||
return _CheckableKind_name_1
|
||||
case i == 82:
|
||||
return _CheckableKind_name_2
|
||||
default:
|
||||
return "CheckableKind(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user