github.com/terraform-linters/tflint-plugin-sdk@v0.22.0/terraform/addrs/module_call.go (about)

     1  package addrs
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  // ModuleCall is the address of a call from the current module to a child
     8  // module.
     9  type ModuleCall struct {
    10  	referenceable
    11  	Name string
    12  }
    13  
    14  func (c ModuleCall) String() string {
    15  	return "module." + c.Name
    16  }
    17  
    18  // ModuleCallInstance is the address of one instance of a module created from
    19  // a module call, which might create multiple instances using "count" or
    20  // "for_each" arguments.
    21  type ModuleCallInstance struct {
    22  	referenceable
    23  	Call ModuleCall
    24  	Key  InstanceKey
    25  }
    26  
    27  func (c ModuleCallInstance) String() string {
    28  	if c.Key == NoKey {
    29  		return c.Call.String()
    30  	}
    31  	return fmt.Sprintf("module.%s%s", c.Call.Name, c.Key)
    32  }
    33  
    34  // ModuleCallInstanceOutput is the address of a particular named output produced by
    35  // an instance of a module call.
    36  type ModuleCallInstanceOutput struct {
    37  	referenceable
    38  	Call ModuleCallInstance
    39  	Name string
    40  }
    41  
    42  func (co ModuleCallInstanceOutput) String() string {
    43  	return fmt.Sprintf("%s.%s", co.Call.String(), co.Name)
    44  }