File tree 1 file changed +13
-5
lines changed
1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package converters
18
18
19
19
import (
20
20
"sort"
21
+ "strings"
21
22
22
23
"github.com/aws/aws-sdk-go/aws"
23
24
"github.com/aws/aws-sdk-go/service/autoscaling"
@@ -31,6 +32,11 @@ import (
31
32
infrav1 "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
32
33
)
33
34
35
+ const (
36
+ // AwsInternalTagPrefix is the prefix for AWS internal tags, which are reserved for internal AWS use.
37
+ AwsInternalTagPrefix = "aws:"
38
+ )
39
+
34
40
// TagsToMap converts a []*ec2.Tag into a infrav1.Tags.
35
41
func TagsToMap (src []* ec2.Tag ) infrav1.Tags {
36
42
tags := make (infrav1.Tags , len (src ))
@@ -58,12 +64,14 @@ func MapToTags(src infrav1.Tags) []*ec2.Tag {
58
64
tags := make ([]* ec2.Tag , 0 , len (src ))
59
65
60
66
for k , v := range src {
61
- tag := & ec2.Tag {
62
- Key : aws .String (k ),
63
- Value : aws .String (v ),
64
- }
67
+ if ! strings .HasPrefix (k , AwsInternalTagPrefix ) {
68
+ tag := & ec2.Tag {
69
+ Key : aws .String (k ),
70
+ Value : aws .String (v ),
71
+ }
65
72
66
- tags = append (tags , tag )
73
+ tags = append (tags , tag )
74
+ }
67
75
}
68
76
69
77
// Sort so that unit tests can expect a stable order
You can’t perform that action at this time.
0 commit comments