Skip to content

Commit 95b8dd8

Browse files
committed
resource account: include AccountName as tag by default
1 parent 7885313 commit 95b8dd8

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

resource/account.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (a Account) IsProvisioned() bool {
6565
}
6666

6767
func (a Account) AllTags() []string {
68-
var tags []string
68+
tags := []string{"AccountName=" + a.AccountName}
6969
tags = append(tags, a.Tags...)
7070
if a.Parent != nil {
7171
tags = append(tags, a.Parent.AllTags()...)

resourceoperation/organization_unit.go

+15-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"context"
66
"fmt"
77
"log"
8+
"strings"
89
"text/template"
910

1011
"github.com/fatih/color"
@@ -473,6 +474,10 @@ func diffTags(taggable Taggable) (added, removed []string) {
473474

474475
for _, tag := range taggable.AllTags() {
475476
if _, ok := oldMap[tag]; !ok {
477+
if ignorableTag(tag) {
478+
continue
479+
}
480+
476481
if contains(added, tag) {
477482
// There can be duplicates when tags are inherited from an OU
478483
continue
@@ -514,9 +519,18 @@ func ignorableTag(tag string) bool {
514519
ignorableTags := map[string]struct{}{
515520
"TelophaseManaged=true": {},
516521
}
522+
ignorableKeys := map[string]struct{}{
523+
"AccountName": {},
524+
}
517525

518526
_, ok := ignorableTags[tag]
519-
return ok
527+
if ok {
528+
return true
529+
}
530+
if _, ok := ignorableKeys[strings.Split(tag, "=")[0]]; ok {
531+
return true
532+
}
533+
return false
520534
}
521535

522536
func oneOf(check string, slc []string) bool {

0 commit comments

Comments
 (0)