github.com/opentofu/opentofu@v1.7.1/internal/addrs/for_each_attr.go (about)

     1  // Copyright (c) The OpenTofu Authors
     2  // SPDX-License-Identifier: MPL-2.0
     3  // Copyright (c) 2023 HashiCorp, Inc.
     4  // SPDX-License-Identifier: MPL-2.0
     5  
     6  package addrs
     7  
     8  // ForEachAttr is the address of an attribute referencing the current "for_each" object in
     9  // the interpolation scope, addressed using the "each" keyword, ex. "each.key" and "each.value"
    10  type ForEachAttr struct {
    11  	referenceable
    12  	Name string
    13  }
    14  
    15  func (f ForEachAttr) String() string {
    16  	return "each." + f.Name
    17  }
    18  
    19  func (f ForEachAttr) UniqueKey() UniqueKey {
    20  	return f // A ForEachAttr is its own UniqueKey
    21  }
    22  
    23  func (f ForEachAttr) uniqueKeySigil() {}