File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package converters
1818
1919import (
2020 "sort"
21+ "strings"
2122
2223 "github.com/aws/aws-sdk-go/aws"
2324 "github.com/aws/aws-sdk-go/service/autoscaling"
@@ -31,6 +32,11 @@ import (
3132 infrav1 "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
3233)
3334
35+ const (
36+ // AwsInternalTagPrefix is the prefix for AWS internal tags, which are reserved for internal AWS use.
37+ AwsInternalTagPrefix = "aws:"
38+ )
39+
3440// TagsToMap converts a []*ec2.Tag into a infrav1.Tags.
3541func TagsToMap (src []* ec2.Tag ) infrav1.Tags {
3642 tags := make (infrav1.Tags , len (src ))
@@ -58,12 +64,14 @@ func MapToTags(src infrav1.Tags) []*ec2.Tag {
5864 tags := make ([]* ec2.Tag , 0 , len (src ))
5965
6066 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+ }
6572
66- tags = append (tags , tag )
73+ tags = append (tags , tag )
74+ }
6775 }
6876
6977 // Sort so that unit tests can expect a stable order
You can’t perform that action at this time.
0 commit comments