-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from ivanilves/final-node
fix: solve path choice issue
- Loading branch information
Showing
7 changed files
with
96 additions
and
31 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
fixtures/directory/terragrunt/dev/region-1/rds/terragrunt.hcl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
terraform { | ||
source = "my-terraform-module" | ||
} | ||
|
||
include "root" { | ||
path = find_in_parent_folders() | ||
} | ||
|
||
inputs = { | ||
foo = "bar" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package node | ||
|
||
// Node is an element Tree gets composed from (a path with hierarchical and connection metadata) | ||
type Node struct { | ||
name string | ||
path string | ||
parent string | ||
children []string | ||
levelID int | ||
terminal bool | ||
} | ||
|
||
// NewNode creates a new Node instance | ||
func NewNode(name, path, parent string, children []string, levelID int, terminal bool) Node { | ||
return Node{ | ||
name: name, | ||
path: path, | ||
parent: parent, | ||
children: children, | ||
levelID: levelID, | ||
terminal: terminal, | ||
} | ||
} | ||
|
||
// IsAChildOf tells us if current node is a child of another node | ||
func (n Node) IsAChildOf(pn Node) bool { | ||
return n.parent == pn.path | ||
} | ||
|
||
// HasChildren tells us if that node has child nodes (i.e. if node is a parent itself) | ||
func (n Node) HasChildren() bool { | ||
return len(n.children) > 0 | ||
} | ||
|
||
// IsTerminal tells us if that node has can be a Tree exit point | ||
func (n Node) IsTerminal() bool { | ||
return n.terminal | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters