2024-02-08 03:48:59 -06:00
|
|
|
// Copyright (c) The OpenTofu Authors
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
2023-05-02 10:33:06 -05:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2019-06-12 10:07:32 -05:00
|
|
|
package addrs
|
|
|
|
|
|
|
|
// ForEachAttr is the address of an attribute referencing the current "for_each" object in
|
|
|
|
// the interpolation scope, addressed using the "each" keyword, ex. "each.key" and "each.value"
|
|
|
|
type ForEachAttr struct {
|
|
|
|
referenceable
|
|
|
|
Name string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f ForEachAttr) String() string {
|
|
|
|
return "each." + f.Name
|
|
|
|
}
|
2021-07-10 17:18:19 -05:00
|
|
|
|
|
|
|
func (f ForEachAttr) UniqueKey() UniqueKey {
|
|
|
|
return f // A ForEachAttr is its own UniqueKey
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f ForEachAttr) uniqueKeySigil() {}
|