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

     1  package addrs
     2  
     3  import "strings"
     4  
     5  // Module represents the structure of the module tree.
     6  type Module []string
     7  
     8  // IsRoot returns true if the receiver is the address of the root module,
     9  // or false otherwise.
    10  func (m Module) IsRoot() bool {
    11  	return len(m) == 0
    12  }
    13  
    14  // String returns a string representation.
    15  func (m Module) String() string {
    16  	if len(m) == 0 {
    17  		return ""
    18  	}
    19  	var steps []string
    20  	for _, s := range m {
    21  		steps = append(steps, "module", s)
    22  	}
    23  	return strings.Join(steps, ".")
    24  }