Skip to content

Commit da16191

Browse files
authored
Merge pull request #294 from ulucinar/no-fork
Add NoFork External Connectors & Clients
2 parents c4a76d2 + 911e290 commit da16191

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+3079
-320
lines changed

.golangci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ linters-settings:
4444
sections:
4545
- standard
4646
- default
47-
- prefix(github.com/crossplane/crossplane-runtime)
48-
- prefix(github.com/crossplane/crossplane)
47+
- prefix(github.com/crossplane/upjet)
4948
- blank
5049
- dot
5150

cmd/scraper/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import (
88
"os"
99
"path/filepath"
1010

11-
"github.com/crossplane/upjet/pkg/registry"
1211
"gopkg.in/alecthomas/kingpin.v2"
12+
13+
"github.com/crossplane/upjet/pkg/registry"
1314
)
1415

1516
func main() {

go.mod

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ require (
1414
github.com/fatih/camelcase v1.0.0
1515
github.com/golang/mock v1.6.0
1616
github.com/google/go-cmp v0.6.0
17+
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
1718
github.com/hashicorp/hcl/v2 v2.14.1
1819
github.com/hashicorp/terraform-json v0.14.0
1920
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0
@@ -27,6 +28,7 @@ require (
2728
github.com/tmccombs/hcl2json v0.3.3
2829
github.com/yuin/goldmark v1.4.13
2930
github.com/zclconf/go-cty v1.11.0
31+
github.com/zclconf/go-cty-yaml v1.0.3
3032
golang.org/x/net v0.15.0
3133
gopkg.in/alecthomas/kingpin.v2 v2.2.6
3234
gopkg.in/yaml.v2 v2.4.0
@@ -57,6 +59,7 @@ require (
5759
github.com/fsnotify/fsnotify v1.6.0 // indirect
5860
github.com/go-errors/errors v1.4.2 // indirect
5961
github.com/go-logr/logr v1.2.4 // indirect
62+
github.com/go-logr/zapr v1.2.4 // indirect
6063
github.com/go-openapi/jsonpointer v0.19.6 // indirect
6164
github.com/go-openapi/jsonreference v0.20.2 // indirect
6265
github.com/go-openapi/swag v0.22.3 // indirect
@@ -70,7 +73,6 @@ require (
7073
github.com/google/uuid v1.3.0 // indirect
7174
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
7275
github.com/hashicorp/errwrap v1.1.0 // indirect
73-
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
7476
github.com/hashicorp/go-hclog v1.2.1 // indirect
7577
github.com/hashicorp/go-multierror v1.1.1 // indirect
7678
github.com/hashicorp/go-uuid v1.0.3 // indirect
@@ -103,6 +105,8 @@ require (
103105
github.com/vmihailenco/tagparser v0.1.1 // indirect
104106
github.com/xlab/treeprint v1.2.0 // indirect
105107
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
108+
go.uber.org/multierr v1.11.0 // indirect
109+
go.uber.org/zap v1.26.0 // indirect
106110
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
107111
golang.org/x/mod v0.12.0 // indirect
108112
golang.org/x/oauth2 v0.10.0 // indirect

go.sum

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/
5959
github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec=
6060
github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
6161
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
62+
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
6263
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
6364
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
6465
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
@@ -108,6 +109,7 @@ github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV
108109
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
109110
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
110111
github.com/go-logr/zapr v1.2.4 h1:QHVo+6stLbfJmYGkQ7uGHUCu5hnAFAj6mDe6Ea0SeOo=
112+
github.com/go-logr/zapr v1.2.4/go.mod h1:FyHWQIzQORZ0QVE1BtVHv3cKtNLuXsbNLtpuhNapBOA=
111113
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
112114
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
113115
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
@@ -362,6 +364,8 @@ github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uU
362364
github.com/zclconf/go-cty v1.11.0 h1:726SxLdi2SDnjY+BStqB9J1hNp4+2WlzyXLuimibIe0=
363365
github.com/zclconf/go-cty v1.11.0/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA=
364366
github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8=
367+
github.com/zclconf/go-cty-yaml v1.0.3 h1:og/eOQ7lvA/WWhHGFETVWNduJM7Rjsv2RRpx1sdFMLc=
368+
github.com/zclconf/go-cty-yaml v1.0.3/go.mod h1:9YLUH4g7lOhVWqUbctnVlZ5KLpg7JAprQNgxSZ1Gyxs=
365369
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
366370
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
367371
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
@@ -370,9 +374,15 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
370374
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
371375
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca h1:VdD38733bfYv5tUZwEIskMM93VanwNIi5bIKnDrJdEY=
372376
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds=
377+
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
378+
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
373379
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
380+
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
374381
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
382+
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
383+
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
375384
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
385+
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
376386
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
377387
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
378388
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
@@ -597,6 +607,7 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f
597607
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
598608
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
599609
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
610+
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
600611
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
601612
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
602613
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

pkg/config/common.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ package config
77
import (
88
"strings"
99

10+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
11+
1012
"github.com/crossplane/upjet/pkg/registry"
1113
tjname "github.com/crossplane/upjet/pkg/types/name"
12-
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1314
)
1415

1516
const (
@@ -76,16 +77,17 @@ func DefaultResource(name string, terraformSchema *schema.Resource, terraformReg
7677
}
7778

7879
r := &Resource{
79-
Name: name,
80-
TerraformResource: terraformSchema,
81-
MetaResource: terraformRegistry,
82-
ShortGroup: group,
83-
Kind: kind,
84-
Version: "v1alpha1",
85-
ExternalName: NameAsIdentifier,
86-
References: map[string]Reference{},
87-
Sensitive: NopSensitive,
88-
UseAsync: true,
80+
Name: name,
81+
TerraformResource: terraformSchema,
82+
MetaResource: terraformRegistry,
83+
ShortGroup: group,
84+
Kind: kind,
85+
Version: "v1alpha1",
86+
ExternalName: NameAsIdentifier,
87+
References: map[string]Reference{},
88+
Sensitive: NopSensitive,
89+
UseAsync: true,
90+
SchemaElementOptions: make(map[string]*SchemaElementOption),
8991
}
9092
for _, f := range opts {
9193
f(r)

pkg/config/common_test.go

Lines changed: 48 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ package config
77
import (
88
"testing"
99

10-
"github.com/crossplane/upjet/pkg/registry"
1110
"github.com/google/go-cmp/cmp"
1211
"github.com/google/go-cmp/cmp/cmpopts"
1312
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
13+
14+
"github.com/crossplane/upjet/pkg/registry"
1415
)
1516

1617
func TestDefaultResource(t *testing.T) {
@@ -32,14 +33,15 @@ func TestDefaultResource(t *testing.T) {
3233
name: "aws_ec2_instance",
3334
},
3435
want: &Resource{
35-
Name: "aws_ec2_instance",
36-
ShortGroup: "ec2",
37-
Kind: "Instance",
38-
Version: "v1alpha1",
39-
ExternalName: NameAsIdentifier,
40-
References: map[string]Reference{},
41-
Sensitive: NopSensitive,
42-
UseAsync: true,
36+
Name: "aws_ec2_instance",
37+
ShortGroup: "ec2",
38+
Kind: "Instance",
39+
Version: "v1alpha1",
40+
ExternalName: NameAsIdentifier,
41+
References: map[string]Reference{},
42+
Sensitive: NopSensitive,
43+
UseAsync: true,
44+
SchemaElementOptions: SchemaElementOptions{},
4345
},
4446
},
4547
"TwoSectionsName": {
@@ -48,14 +50,15 @@ func TestDefaultResource(t *testing.T) {
4850
name: "aws_instance",
4951
},
5052
want: &Resource{
51-
Name: "aws_instance",
52-
ShortGroup: "aws",
53-
Kind: "Instance",
54-
Version: "v1alpha1",
55-
ExternalName: NameAsIdentifier,
56-
References: map[string]Reference{},
57-
Sensitive: NopSensitive,
58-
UseAsync: true,
53+
Name: "aws_instance",
54+
ShortGroup: "aws",
55+
Kind: "Instance",
56+
Version: "v1alpha1",
57+
ExternalName: NameAsIdentifier,
58+
References: map[string]Reference{},
59+
Sensitive: NopSensitive,
60+
UseAsync: true,
61+
SchemaElementOptions: SchemaElementOptions{},
5962
},
6063
},
6164
"NameWithPrefixAcronym": {
@@ -64,14 +67,15 @@ func TestDefaultResource(t *testing.T) {
6467
name: "aws_db_sql_server",
6568
},
6669
want: &Resource{
67-
Name: "aws_db_sql_server",
68-
ShortGroup: "db",
69-
Kind: "SQLServer",
70-
Version: "v1alpha1",
71-
ExternalName: NameAsIdentifier,
72-
References: map[string]Reference{},
73-
Sensitive: NopSensitive,
74-
UseAsync: true,
70+
Name: "aws_db_sql_server",
71+
ShortGroup: "db",
72+
Kind: "SQLServer",
73+
Version: "v1alpha1",
74+
ExternalName: NameAsIdentifier,
75+
References: map[string]Reference{},
76+
Sensitive: NopSensitive,
77+
UseAsync: true,
78+
SchemaElementOptions: SchemaElementOptions{},
7579
},
7680
},
7781
"NameWithSuffixAcronym": {
@@ -80,14 +84,15 @@ func TestDefaultResource(t *testing.T) {
8084
name: "aws_db_server_id",
8185
},
8286
want: &Resource{
83-
Name: "aws_db_server_id",
84-
ShortGroup: "db",
85-
Kind: "ServerID",
86-
Version: "v1alpha1",
87-
ExternalName: NameAsIdentifier,
88-
References: map[string]Reference{},
89-
Sensitive: NopSensitive,
90-
UseAsync: true,
87+
Name: "aws_db_server_id",
88+
ShortGroup: "db",
89+
Kind: "ServerID",
90+
Version: "v1alpha1",
91+
ExternalName: NameAsIdentifier,
92+
References: map[string]Reference{},
93+
Sensitive: NopSensitive,
94+
UseAsync: true,
95+
SchemaElementOptions: SchemaElementOptions{},
9196
},
9297
},
9398
"NameWithMultipleAcronyms": {
@@ -96,14 +101,15 @@ func TestDefaultResource(t *testing.T) {
96101
name: "aws_db_sql_server_id",
97102
},
98103
want: &Resource{
99-
Name: "aws_db_sql_server_id",
100-
ShortGroup: "db",
101-
Kind: "SQLServerID",
102-
Version: "v1alpha1",
103-
ExternalName: NameAsIdentifier,
104-
References: map[string]Reference{},
105-
Sensitive: NopSensitive,
106-
UseAsync: true,
104+
Name: "aws_db_sql_server_id",
105+
ShortGroup: "db",
106+
Kind: "SQLServerID",
107+
Version: "v1alpha1",
108+
ExternalName: NameAsIdentifier,
109+
References: map[string]Reference{},
110+
Sensitive: NopSensitive,
111+
UseAsync: true,
112+
SchemaElementOptions: SchemaElementOptions{},
107113
},
108114
},
109115
}
@@ -113,6 +119,7 @@ func TestDefaultResource(t *testing.T) {
113119
cmpopts.IgnoreFields(Sensitive{}, "fieldPaths", "AdditionalConnectionDetailsFn"),
114120
cmpopts.IgnoreFields(LateInitializer{}, "ignoredCanonicalFieldPaths"),
115121
cmpopts.IgnoreFields(ExternalName{}, "SetIdentifierArgumentFn", "GetExternalNameFn", "GetIDFn"),
122+
cmpopts.IgnoreFields(Resource{}, "useNoForkClient"),
116123
}
117124

118125
for name, tc := range cases {

pkg/config/externalname_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ import (
88
"context"
99
"testing"
1010

11-
"github.com/google/go-cmp/cmp"
12-
1311
"github.com/crossplane/crossplane-runtime/pkg/errors"
1412
"github.com/crossplane/crossplane-runtime/pkg/test"
13+
"github.com/google/go-cmp/cmp"
1514
)
1615

1716
func TestGetExternalNameFromTemplated(t *testing.T) {

0 commit comments

Comments
 (0)