Skip to content

Commit

Permalink
cmd *: make tag comma separated options allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
dschofie committed Jul 3, 2024
1 parent 7738c2b commit f4fbbf2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var (
func init() {
rootCmd.AddCommand(deployCmd)
deployCmd.Flags().StringVar(&stacks, "stacks", "", "Filter stacks to deploy")
deployCmd.Flags().StringVar(&tag, "tag", "", "Filter accounts and organization units to deploy")
deployCmd.Flags().StringVar(&tag, "tag", "", "Filter accounts and organization units to deploy with a comma separated list")
deployCmd.Flags().StringVar(&targets, "targets", "", "Filter resource types to deploy. Options: organization, scp, stacks")
deployCmd.Flags().StringVar(&orgFile, "org", "organization.yml", "Path to the organization.yml file")
deployCmd.Flags().BoolVar(&useTUI, "tui", false, "use the TUI for deploy")
Expand Down
2 changes: 1 addition & 1 deletion cmd/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func init() {
rootCmd.AddCommand(diffCmd)
diffCmd.Flags().StringVar(&stacks, "stacks", "", "Filter stacks to deploy")
diffCmd.Flags().StringVar(&tag, "tag", "", "Filter accounts and organization units to deploy.")
diffCmd.Flags().StringVar(&tag, "tag", "", "Filter accounts and organization units to deploy with a comma separated list")
diffCmd.Flags().StringVar(&targets, "targets", "", "Filter resource types to deploy. Options: organization, scp, stacks")
diffCmd.Flags().StringVar(&orgFile, "org", "organization.yml", "Path to the organization.yml file")
diffCmd.Flags().BoolVar(&useTUI, "tui", false, "use the TUI for diff")
Expand Down
7 changes: 5 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,13 @@ func ProcessOrgEndToEnd(consoleUI runner.ConsoleUI, cmd int, targets []string) e
}

if len(targets) == 0 || deployStacks {
totalTags := strings.Split(tag, ",")
var accountsToApply []resource.Account
for _, acct := range rootAWSOU.AllDescendentAccounts() {
if contains(tag, acct.AllTags()) || tag == "" {
accountsToApply = append(accountsToApply, *acct)
for _, tag := range totalTags {
if contains(tag, acct.AllTags()) || tag == "" {
accountsToApply = append(accountsToApply, *acct)
}
}
}

Expand Down

0 comments on commit f4fbbf2

Please sign in to comment.