Skip to content

Commit

Permalink
Rename config.NewProviderWithSchema as NewProvider
Browse files Browse the repository at this point in the history
Signed-off-by: Alper Rifat Ulucinar <[email protected]>
  • Loading branch information
ulucinar committed Jun 6, 2022
1 parent 38bec5a commit 7a587ee
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 23 deletions.
12 changes: 3 additions & 9 deletions pkg/config/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ func WithDefaultResourceFn(f DefaultResourceFn) ProviderOption {
}
}

// NewProviderWithSchema builds and returns a new Provider from provider
// NewProvider builds and returns a new Provider from provider
// tfjson schema, that is generated using Terraform CLI with:
// `terraform providers schema --json`
func NewProviderWithSchema(schema []byte, prefix string, modulePath string, metadataPath string, opts ...ProviderOption) *Provider {
func NewProvider(schema []byte, prefix string, modulePath string, metadataPath string, opts ...ProviderOption) *Provider {
ps := tfjson.ProviderSchemas{}
if err := ps.UnmarshalJSON(schema); err != nil {
panic(err)
Expand All @@ -170,13 +170,8 @@ func NewProviderWithSchema(schema []byte, prefix string, modulePath string, meta
rs = v.ResourceSchemas
break
}
return NewProvider(conversiontfjson.GetV2ResourceMap(rs), prefix, modulePath, metadataPath, opts...)
}

// NewProvider builds and returns a new Provider.
// Deprecated: This function will be removed soon, please use
// NewProviderWithSchema instead.
func NewProvider(resourceMap map[string]*schema.Resource, prefix string, modulePath string, metadataPath string, opts ...ProviderOption) *Provider {
resourceMap := conversiontfjson.GetV2ResourceMap(rs)
p := &Provider{
ModulePath: modulePath,
TerraformResourcePrefix: fmt.Sprintf("%s_", prefix),
Expand Down Expand Up @@ -213,7 +208,6 @@ func NewProvider(resourceMap map[string]*schema.Resource, prefix string, moduleP

p.Resources[name] = p.DefaultResourceFn(name, terraformResource)
}

return p
}

Expand Down
14 changes: 1 addition & 13 deletions pkg/pipeline/example.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
/*
Copyright 2021 The Crossplane Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Copyright 2022 Upbound Inc.
*/

package pipeline
Expand Down
2 changes: 1 addition & 1 deletion pkg/types/reference_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func TestBuilder_generateReferenceFields(t *testing.T) {
g := &Builder{
comments: twtypes.Comments{},
}
gotFields, gotTags, _ := g.generateReferenceFields(tc.args.t, tc.args.f, tc.args.r)
gotFields, gotTags := g.generateReferenceFields(tc.args.t, tc.args.f, &Field{Reference: &tc.args.r})
if diff := cmp.Diff(tc.want.outFields, gotFields, cmp.Comparer(func(a, b *types.Var) bool {
return a.String() == b.String()
})); diff != "" {
Expand Down

0 comments on commit 7a587ee

Please sign in to comment.