Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit b006097

Browse files
committed
Apply tagging convention
Signed-off-by: Sergen Yalçın <yalcinsergen97@gmail.com>
1 parent 32ca8a3 commit b006097

11 files changed

Lines changed: 91 additions & 3 deletions

File tree

apis/compute/v1alpha2/zz_instance_terraformed.go

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/monitoring/v1alpha2/zz_notificationchannel_terraformed.go

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/storage/v1alpha2/zz_bucket_terraformed.go

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/common/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ const (
2222

2323
// VersionV1alpha2 is the version to be used for manually configured types.
2424
VersionV1alpha2 = "v1alpha2"
25+
26+
// ExternalTagsFieldName is used as field name to set external resource tags.
27+
ExternalTagsFieldName = "Labels"
2528
)
2629

2730
var (

config/overrides.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import (
44
"regexp"
55
"strings"
66

7+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
8+
9+
"github.com/crossplane-contrib/provider-jet-gcp/config/common"
10+
711
tjconfig "github.com/crossplane/terrajet/pkg/config"
812
"github.com/crossplane/terrajet/pkg/types/name"
913
"github.com/pkg/errors"
@@ -112,3 +116,13 @@ func ReplaceGroupWords(group string, count int) GroupKindCalculator {
112116
return group, name.NewFromSnake(snakeKind).Camel
113117
}
114118
}
119+
120+
func addExternalTagsField() tjconfig.ResourceOption {
121+
return func(r *tjconfig.Resource) {
122+
if s, ok := r.TerraformResource.Schema["labels"]; ok {
123+
if s.Type == schema.TypeMap {
124+
r.ExternalTagsFieldName = common.ExternalTagsFieldName
125+
}
126+
}
127+
}
128+
}

config/provider.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ func GetProvider() *tjconfig.Provider {
7272
tjconfig.WithDefaultResourceFn(DefaultResource(
7373
groupOverrides(),
7474
externalNameConfig(),
75+
addExternalTagsField(),
7576
)),
7677
tjconfig.WithRootGroup("gcp.jet.crossplane.io"),
7778
tjconfig.WithShortName("gcpjet"),

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ require (
1717
sigs.k8s.io/controller-runtime v0.9.6
1818
sigs.k8s.io/controller-tools v0.6.2
1919
)
20+
21+
replace github.com/crossplane/terrajet => github.com/sergenyalcin/terrajet v0.1.1-0.20220114063241-a54e16583f23

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,6 @@ github.com/crossplane/crossplane-runtime v0.15.1-0.20211004150827-579c1833b513 h
199199
github.com/crossplane/crossplane-runtime v0.15.1-0.20211004150827-579c1833b513/go.mod h1:gKix9Gq5kRzVe/4XOpwlFgG7OurzrYayviJxWZakhw0=
200200
github.com/crossplane/crossplane-tools v0.0.0-20210916125540-071de511ae8e h1:7UM4E9gNEzJ22JgRZqY2KBlkdMCAiHmKS96rcLANdME=
201201
github.com/crossplane/crossplane-tools v0.0.0-20210916125540-071de511ae8e/go.mod h1:3GzY5sP0PVePArghBh5K4fGzS/3kM0R/NAZn5s7LXqw=
202-
github.com/crossplane/terrajet v0.3.1 h1:mFfiocxOIVWTN+ujjOCV0sd0/r7bQY5LG292HTlCAvM=
203-
github.com/crossplane/terrajet v0.3.1/go.mod h1:fFjGal+3iF/D3XaxuTHw0xNHO+UslVhxNkNZITDXz44=
204202
github.com/daixiang0/gci v0.2.8/go.mod h1:+4dZ7TISfSmqfAGv59ePaHfNzgGtIkHAhhdKggP1JAc=
205203
github.com/dave/jennifer v1.4.1 h1:XyqG6cn5RQsTj3qlWQTKlRGAyrTcsk1kUmWdZBzRjDw=
206204
github.com/dave/jennifer v1.4.1/go.mod h1:7jEdnm+qBcxl8PC0zyp7vxcpSRnzXSt9r39tpTVGlwA=
@@ -834,6 +832,8 @@ github.com/sanposhiho/wastedassign v1.0.0/go.mod h1:LGpq5Hsv74QaqM47WtIsRSF/ik9k
834832
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
835833
github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4=
836834
github.com/securego/gosec/v2 v2.7.0/go.mod h1:xNbGArrGUspJLuz3LS5XCY1EBW/0vABAl/LWfSklmiM=
835+
github.com/sergenyalcin/terrajet v0.1.1-0.20220114063241-a54e16583f23 h1:kW1FvzeWKkdFgeeIVJp3b6ZGckB9AL/28D8fpZ6Kr/U=
836+
github.com/sergenyalcin/terrajet v0.1.1-0.20220114063241-a54e16583f23/go.mod h1:fFjGal+3iF/D3XaxuTHw0xNHO+UslVhxNkNZITDXz44=
837837
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
838838
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
839839
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=

internal/controller/compute/instance/zz_controller.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/controller/monitoring/notificationchannel/zz_controller.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)