crossplane-contrib / provider-jet-datadog

@crossplane provider to drive @datadog configuration control plane way
Apache License 2.0
6 stars 8 forks source link

Synthetics Test #4

Closed knowshan closed 2 years ago

knowshan commented 2 years ago

What resource do you need?

Synthetics Test

What is your use case?

Create Synthetics Test in Datadog for ingress resources.

Would you be willing to contribute it using Terrajet?

Yes

I've tried adding new resource by adding a new resource under config and then updating provider.go. I'm getting following error during make run:

go build: -i flag is deprecated
github.com/crossplane-contrib/provider-jet-datadog/apis/synthetics_test/v1alpha1
github.com/crossplane-contrib/provider-jet-datadog/apis/monitor/v1alpha1
# github.com/crossplane-contrib/provider-jet-datadog/apis/synthetics_test/v1alpha1
apis/synthetics_test/v1alpha1/zz_syntheticstest_types.go:811:25: cannot use &SyntheticsTest{} (type *SyntheticsTest) as type runtime.Object in argument to SchemeBuilder.Register:
    *SyntheticsTest does not implement runtime.Object (missing DeepCopyObject method)
apis/synthetics_test/v1alpha1/zz_syntheticstest_types.go:811:44: cannot use &SyntheticsTestList{} (type *SyntheticsTestList) as type runtime.Object in argument to SchemeBuilder.Register:
    *SyntheticsTestList does not implement runtime.Object (missing DeepCopyObject method)
22:14:10 [FAIL]
make: *** [go.build] Error 1

Here are system details:

$ go version
go version go1.17.10 darwin/amd64

$  kubectl version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.6", GitCommit:"ad3338546da947756e8a88aa6822e9c11e7eac22", GitTreeState:"clean", BuildDate:"2022-04-14T08:49:13Z", GoVersion:"go1.17.9", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.1", GitCommit:"5e58841cce77d4bc13713ad2b91fa0d961e69192", GitTreeState:"clean", BuildDate:"2021-05-21T23:01:33Z", GoVersion:"go1.16.4", Compiler:"gc", Platform:"linux/amd64"}
WARNING: version difference between client (1.23) and server (1.21) exceeds the supported minor version skew of +/-1

$ kubectl crossplane -v
v1.7.1

Can I get some help on adding new resource(s)?

Thanks, Shantanu

ytsarev commented 2 years ago

Hi Shantanu, thanks a lot for the attempt to add a new resource! Can you please open PR with the code you are trying out and we can continue here? It is hard to analyze the issue without observing the actual code change.

Thanks!

knowshan commented 2 years ago

Hi @ytsarev , Thank you for providing next steps.

I've linked PR with code changes to this issue. I followed https://github.com/crossplane/terrajet/blob/main/docs/generating-a-provider.md guide to add new Terraform provider resource and then ran go run cmd/generator/main.go "$PWD" to generate code.

I'm getting following error after make run

$ go run cmd/generator/main.go "$PWD"

Generated 4 resources!

$ make run
17:29:48 [ .. ] go build darwin_amd64
go build: -i flag is deprecated
github.com/crossplane-contrib/provider-jet-datadog/apis/syntheticstest/v1alpha1
# github.com/crossplane-contrib/provider-jet-datadog/apis/syntheticstest/v1alpha1
apis/syntheticstest/v1alpha1/zz_syntheticstest_types.go:964:25: cannot use &SyntheticsTest{} (type *SyntheticsTest) as type runtime.Object in argument to SchemeBuilder.Register:
    *SyntheticsTest does not implement runtime.Object (missing DeepCopyObject method)
apis/syntheticstest/v1alpha1/zz_syntheticstest_types.go:964:44: cannot use &SyntheticsTestList{} (type *SyntheticsTestList) as type runtime.Object in argument to SchemeBuilder.Register:
    *SyntheticsTestList does not implement runtime.Object (missing DeepCopyObject method)
17:29:49 [FAIL]
make: *** [go.build] Error 1

I would appreciate help on adding new resources and contributing code. Thanks!

knowshan commented 2 years ago

I was able to figure out this issue. I had ~/.terraformrc pointing to specific Datadog provider on file-system which was few months old.

I'll update PR with new code for review. Thanks!