Merge pull request #12 from turkenh/bump-to-latest-terrajet

Bump terrajet and fix import paths
This commit is contained in:
Hasan Turken 2022-01-18 16:31:43 +03:00 committed by GitHub
commit d656e1e9be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 46 additions and 25 deletions

View File

@ -23,10 +23,10 @@ Help us for prioritization of the resource support by giving more details about
why you need it.
-->
### Would you be willing to contribute it using [Terrajet](https://github.com/crossplane-contrib/terrajet)?
### Would you be willing to contribute it using [Terrajet](https://github.com/crossplane/terrajet)?
<!--
Please take a look at code generator instructions to see whether you'd like to
contribute the missing parts where Terrajet cannot automate. See
https://github.com/crossplane-contrib/terrajet#readme
https://github.com/crossplane/terrajet#readme
-->

View File

@ -1,7 +1,7 @@
# Terrajet Template Provider
`provider-jet-template` is a [Crossplane](https://crossplane.io/) provider that
is built using [Terrajet](https://github.com/crossplane-contrib/terrajet) code
is built using [Terrajet](https://github.com/crossplane/terrajet) code
generation tools and exposes XRM-conformant managed resources for the
Template API.

View File

@ -188,6 +188,11 @@ func (in *OrderList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *OrderObservation) DeepCopyInto(out *OrderObservation) {
*out = *in
if in.ID != nil {
in, out := &in.ID, &out.ID
*out = new(string)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OrderObservation.
@ -248,7 +253,7 @@ func (in *OrderSpec) DeepCopy() *OrderSpec {
func (in *OrderStatus) DeepCopyInto(out *OrderStatus) {
*out = *in
in.ResourceStatus.DeepCopyInto(&out.ResourceStatus)
out.AtProvider = in.AtProvider
in.AtProvider.DeepCopyInto(&out.AtProvider)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OrderStatus.

View File

@ -21,8 +21,8 @@ package v1alpha1
import (
"github.com/pkg/errors"
"github.com/crossplane-contrib/terrajet/pkg/resource"
"github.com/crossplane-contrib/terrajet/pkg/resource/json"
"github.com/crossplane/terrajet/pkg/resource"
"github.com/crossplane/terrajet/pkg/resource/json"
)
// GetTerraformResourceType returns Terraform resource type for this Order
@ -54,6 +54,14 @@ func (tr *Order) SetObservation(obs map[string]interface{}) error {
return json.TFParser.Unmarshal(p, &tr.Status.AtProvider)
}
// GetID returns ID of underlying Terraform resource of this Order
func (tr *Order) GetID() string {
if tr.Status.AtProvider.ID == nil {
return ""
}
return *tr.Status.AtProvider.ID
}
// GetParameters of this Order
func (tr *Order) GetParameters() (map[string]interface{}, error) {
p, err := json.TFParser.Marshal(tr.Spec.ForProvider)

View File

@ -56,6 +56,7 @@ type ItemsParameters struct {
}
type OrderObservation struct {
ID *string `json:"id,omitempty" tf:"id,omitempty"`
}
type OrderParameters struct {

View File

@ -25,10 +25,10 @@ import (
tf "github.com/hashicorp/terraform-provider-hashicups/hashicups"
"github.com/crossplane-contrib/terrajet/pkg/pipeline"
// Comment out the line below instead of the above, if your Terraform
// provider uses an old version (<v2) of github.com/hashicorp/terraform-plugin-sdk.
// "github.com/crossplane-contrib/terrajet/pkg/types/conversion"
"github.com/crossplane/terrajet/pkg/pipeline"
// Comment out the line below, if your Terraform provider uses an old
// version (<v2) of github.com/hashicorp/terraform-plugin-sdk.
// "github.com/crossplane/terrajet/pkg/types/conversion"
"github.com/crossplane-contrib/provider-jet-template/config"
)

View File

@ -20,9 +20,9 @@ import (
"os"
"path/filepath"
"github.com/crossplane-contrib/terrajet/pkg/terraform"
"github.com/crossplane/crossplane-runtime/pkg/logging"
"github.com/crossplane/crossplane-runtime/pkg/ratelimiter"
"github.com/crossplane/terrajet/pkg/terraform"
tf "github.com/hashicorp/terraform-provider-hashicups/hashicups"
"gopkg.in/alecthomas/kingpin.v2"
ctrl "sigs.k8s.io/controller-runtime"
@ -71,6 +71,10 @@ func main() {
rl := ratelimiter.NewGlobal(ratelimiter.DefaultGlobalRPS)
kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add Template APIs to scheme")
kingpin.FatalIfError(controller.Setup(mgr, log, rl, setup, ws, pconfig.GetProvider(tf.Provider().ResourcesMap), 1), "Cannot setup Template controllers")
resourceMap := tf.Provider().ResourcesMap
// Comment out the line below instead of the above, if your Terraform
// provider uses an old version (<v2) of github.com/hashicorp/terraform-plugin-sdk.
// resourceMap := conversion.GetV2ResourceMap(tf.Provider())
kingpin.FatalIfError(controller.Setup(mgr, log, rl, setup, ws, pconfig.GetProvider(resourceMap), 1), "Cannot setup Template controllers")
kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager")
}

View File

@ -17,7 +17,7 @@ limitations under the License.
package config
import (
tjconfig "github.com/crossplane-contrib/terrajet/pkg/config"
tjconfig "github.com/crossplane/terrajet/pkg/config"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

2
go.mod
View File

@ -3,9 +3,9 @@ module github.com/crossplane-contrib/provider-jet-template
go 1.16
require (
github.com/crossplane-contrib/terrajet v0.2.1
github.com/crossplane/crossplane-runtime v0.15.1-0.20211004150827-579c1833b513
github.com/crossplane/crossplane-tools v0.0.0-20210916125540-071de511ae8e
github.com/crossplane/terrajet v0.3.2
github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.0
github.com/hashicorp/terraform-provider-hashicups v0.3.1
github.com/pkg/errors v0.9.1

4
go.sum
View File

@ -143,12 +143,12 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/crossplane-contrib/terrajet v0.2.1 h1:oTdBSYyHlKfWiwGBM9hClYU/BdWhMz490xwfQBDv11Q=
github.com/crossplane-contrib/terrajet v0.2.1/go.mod h1:RUsskXE63KZE7EcvZ7WK4UzBQjc1+7IhelK+/gIa/Go=
github.com/crossplane/crossplane-runtime v0.15.1-0.20211004150827-579c1833b513 h1:Sk3QurYYpy8x3c0DvTh9iGYFSv8WgdhnjCalNqNqlRI=
github.com/crossplane/crossplane-runtime v0.15.1-0.20211004150827-579c1833b513/go.mod h1:gKix9Gq5kRzVe/4XOpwlFgG7OurzrYayviJxWZakhw0=
github.com/crossplane/crossplane-tools v0.0.0-20210916125540-071de511ae8e h1:7UM4E9gNEzJ22JgRZqY2KBlkdMCAiHmKS96rcLANdME=
github.com/crossplane/crossplane-tools v0.0.0-20210916125540-071de511ae8e/go.mod h1:3GzY5sP0PVePArghBh5K4fGzS/3kM0R/NAZn5s7LXqw=
github.com/crossplane/terrajet v0.3.2 h1:q7+nfB772KGO0CPeJ7IpyoLgMB+btLYxkrNTNsoEz44=
github.com/crossplane/terrajet v0.3.2/go.mod h1:fFjGal+3iF/D3XaxuTHw0xNHO+UslVhxNkNZITDXz44=
github.com/dave/jennifer v1.4.1 h1:XyqG6cn5RQsTj3qlWQTKlRGAyrTcsk1kUmWdZBzRjDw=
github.com/dave/jennifer v1.4.1/go.mod h1:7jEdnm+qBcxl8PC0zyp7vxcpSRnzXSt9r39tpTVGlwA=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

View File

@ -15,7 +15,7 @@
# limitations under the License.
# Please set ProviderNameLower & ProviderNameUpper environment variables before running this script.
# See: https://github.com/crossplane-contrib/terrajet/blob/main/docs/generating-a-provider.md
# See: https://github.com/crossplane/terrajet/blob/main/docs/generating-a-provider.md
set -euo pipefail
REPLACE_FILES='./* ./.github :!build/** :!go.sum :!hack/prepare.sh'

View File

@ -21,8 +21,8 @@ import (
"encoding/json"
"fmt"
"github.com/crossplane-contrib/terrajet/pkg/terraform"
"github.com/crossplane/crossplane-runtime/pkg/resource"
"github.com/crossplane/terrajet/pkg/terraform"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"

View File

@ -30,9 +30,9 @@ import (
xpresource "github.com/crossplane/crossplane-runtime/pkg/resource"
"sigs.k8s.io/controller-runtime/pkg/controller"
tjconfig "github.com/crossplane-contrib/terrajet/pkg/config"
tjcontroller "github.com/crossplane-contrib/terrajet/pkg/controller"
"github.com/crossplane-contrib/terrajet/pkg/terraform"
tjconfig "github.com/crossplane/terrajet/pkg/config"
tjcontroller "github.com/crossplane/terrajet/pkg/controller"
"github.com/crossplane/terrajet/pkg/terraform"
v1alpha1 "github.com/crossplane-contrib/provider-jet-template/apis/hashicups/v1alpha1"
)

View File

@ -17,8 +17,8 @@ limitations under the License.
package providerconfig
import (
"github.com/crossplane-contrib/terrajet/pkg/config"
"github.com/crossplane-contrib/terrajet/pkg/terraform"
"github.com/crossplane/terrajet/pkg/config"
"github.com/crossplane/terrajet/pkg/terraform"
"k8s.io/client-go/util/workqueue"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/controller"

View File

@ -22,8 +22,8 @@ import (
"github.com/crossplane/crossplane-runtime/pkg/logging"
tjconfig "github.com/crossplane-contrib/terrajet/pkg/config"
"github.com/crossplane-contrib/terrajet/pkg/terraform"
tjconfig "github.com/crossplane/terrajet/pkg/config"
"github.com/crossplane/terrajet/pkg/terraform"
order "github.com/crossplane-contrib/provider-jet-template/internal/controller/hashicups/order"
providerconfig "github.com/crossplane-contrib/provider-jet-template/internal/controller/providerconfig"

View File

@ -136,6 +136,9 @@ spec:
description: OrderStatus defines the observed state of Order.
properties:
atProvider:
properties:
id:
type: string
type: object
conditions:
description: Conditions of the resource.