crossplane-contrib / provider-upjet-aws

Official AWS Provider for Crossplane by Upbound.
https://marketplace.upbound.io/providers/upbound/provider-aws
Apache License 2.0
137 stars 112 forks source link

CodeGuru Profiler Profiling Group #1316

Closed chlunde closed 4 weeks ago

chlunde commented 1 month ago

Description of your changes

Fixes #959

I have:

How has this code been tested

A successful uptest run: https://github.com/crossplane-contrib/provider-upjet-aws/actions/runs/9398769793

Upbound-CLA commented 1 month ago

CLA assistant check
All committers have signed the CLA.

turkenf commented 1 month ago

Hey @chlunde,

Thank you for opening this PR, I took a quick look at your PR:

chlunde commented 1 month ago

@turkenf thanks for looking at the draft, I just pushed it to sync between two computers and didn't have time to test it yet :)

But with IdentifierFromProvider and the following example:

apiVersion: codeguruprofiler.aws.upbound.io/v1beta1
kind: ProfilingGroup
metadata:
  annotations:
    meta.upbound.io/example-id: codeguruprofiler/v1beta1/profilinggroup
  labels:
    testing.upbound.io/example-name: example
  name: example
spec:
  forProvider:
    agentOrchestrationConfig:
    - profilingEnabled: true
    computePlatform: Default
    name: example2
    region: us-west-2

I get "read resource request failed: setting Amazon CodeGuru Profiler Profiling Group: operation error CodeGuruProfiler: DescribeProfilingGroup, serialization failed: serialization failed: input member profilingGroupName must not be empty:

2024-05-22T21:20:05+02:00   DEBUG   provider-aws    Cannot observe external resource    {"controller": "managed/codeguruprofiler.aws.upbound.io/v1beta1, kind=profilinggroup", "request": {"name":"example"}, "uid": "41a1b8cd-fbf3-45be-849d-a861017a718b", "version": "11744", "external-name": "", "error": "read resource request failed: setting Amazon CodeGuru Profiler Profiling Group: operation error CodeGuruProfiler: DescribeProfilingGroup, serialization failed: serialization failed: input member profilingGroupName must not be empty: operation error CodeGuruProfiler: DescribeProfilingGroup, serialization failed: serialization failed: input member profilingGroupName must not be empty", "errorVerbose": "setting Amazon CodeGuru Profiler Profiling Group: operation error CodeGuruProfiler: DescribeProfilingGroup, serialization failed: serialization failed: input member profilingGroupName must not be empty: operation error CodeGuruProfiler: DescribeProfilingGroup, serialization failed: serialization failed: input member profilingGroupName must not be empty\ngithub.com/crossplane/upjet/pkg/controller.getFatalDiagnostics\n\tgithub.com/crossplane/upjet@v1.3.0/pkg/controller/external_tfpluginfw.go:676\ngithub.com/crossplane/upjet/pkg/controller.(*terraformPluginFrameworkExternalClient).Observe\n\tgithub.com/crossplane/upjet@v1.3.0/pkg/controller/external_tfpluginfw.go:309\ngithub.com/crossplane/upjet/pkg/controller.(*terraformPluginFrameworkAsyncExternalClient).Observe\n\tgithub.com/crossplane/upjet@v1.3.0/pkg/controller/external_async_tfpluginfw.go:122\ngithub.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*Reconciler).Reconcile\n\tgithub.com/crossplane/crossplane-runtime@v1.16.0-rc.1.0.20240424114634-8641eb2ba384/pkg/reconciler/managed/reconciler.go:914\ngithub.com/crossplane/crossplane-runtime/pkg/ratelimiter.(*Reconciler).Reconcile\n\tgithub.com/crossplane/crossplane-runtime@v1.16.0-rc.1.0.20240424114634-8641eb2ba384/pkg/ratelimiter/reconciler.go:54\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:119\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:316\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:266\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:227\nruntime.goexit\n\truntime/asm_arm64.s:1197\nread resource request failed\ngithub.com/crossplane/upjet/pkg/controller.(*terraformPluginFrameworkExternalClient).Observe\n\tgithub.com/crossplane/upjet@v1.3.0/pkg/controller/external_tfpluginfw.go:310\ngithub.com/crossplane/upjet/pkg/controller.(*terraformPluginFrameworkAsyncExternalClient).Observe\n\tgithub.com/crossplane/upjet@v1.3.0/pkg/controller/external_async_tfpluginfw.go:122\ngithub.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*Reconciler).Reconcile\n\tgithub.com/crossplane/crossplane-runtime@v1.16.0-rc.1.0.20240424114634-8641eb2ba384/pkg/reconciler/managed/reconciler.go:914\ngithub.com/crossplane/crossplane-runtime/pkg/ratelimiter.(*Reconciler).Reconcile\n\tgithub.com/crossplane/crossplane-runtime@v1.16.0-rc.1.0.20240424114634-8641eb2ba384/pkg/ratelimiter/reconciler.go:54\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:119\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:316\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:266\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:227\nruntime.goexit\n\truntime/asm_arm64.s:1197"}

If I use the code as the PR is now, it works fine:

image
AWS_REGION=us-west-2 aws codeguruprofiler list-profiling-groups
{
    "profilingGroupNames": [
        "example"
    ]
}
2024-05-22T21:29:54+02:00   INFO    provider-aws    Beta feature enabled    {"flag": "EnableBetaManagementPolicies"}
2024-05-22T21:29:54+02:00   DEBUG   provider-aws    Calling the inner handler for Create event. {"gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup", "name": "example", "queueLength": 0}
2024-05-22T21:29:54+02:00   DEBUG   provider-aws    Reconciling {"controller": "managed/codeguruprofiler.aws.upbound.io/v1beta1, kind=profilinggroup", "request": {"name":"example"}}
2024-05-22T21:29:54+02:00   DEBUG   provider-aws    Calling the inner handler for Update event. {"gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup", "name": "example", "queueLength": 0}
2024-05-22T21:29:54+02:00   DEBUG   provider-aws    Calling the inner handler for Update event. {"gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup", "name": "example", "queueLength": 0}
2024-05-22T21:29:54+02:00   DEBUG   provider-aws    Connecting to the service provider  {"uid": "b20dcec5-679c-43f8-989b-c5fc54928225", "name": "example", "gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup"}
2024-05-22T21:29:55+02:00   DEBUG   provider-aws    Reconciling {"controller": "providerconfig/providerconfig.aws.upbound.io", "request": {"name":"default"}}
2024-05-22T21:29:56+02:00   DEBUG   provider-aws    Instance state not found in cache, reconstructing...    {"uid": "b20dcec5-679c-43f8-989b-c5fc54928225", "name": "example", "gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup"}
2024-05-22T21:29:56+02:00   DEBUG   provider-aws    Observing the external resource {"uid": "b20dcec5-679c-43f8-989b-c5fc54928225", "name": "example", "gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup"}
2024-05-22T21:29:57+02:00   DEBUG   provider-aws    Async create starting...    {"trackerUID": "b20dcec5-679c-43f8-989b-c5fc54928225", "resourceName": "example", "gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup"}
2024-05-22T21:29:57+02:00   DEBUG   provider-aws    Creating the external resource  {"uid": "b20dcec5-679c-43f8-989b-c5fc54928225", "name": "example", "gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup"}
2024-05-22T21:29:57+02:00   DEBUG   provider-aws    Successfully requested creation of external resource    {"controller": "managed/codeguruprofiler.aws.upbound.io/v1beta1, kind=profilinggroup", "request": {"name":"example"}, "uid": "b20dcec5-679c-43f8-989b-c5fc54928225", "version": "12914", "external-name": "", "external-name": "example"}
2024-05-22T21:29:57+02:00   DEBUG   provider-aws    Calling the inner handler for Update event. {"gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup", "name": "example", "queueLength": 0}
2024-05-22T21:29:57+02:00   DEBUG   provider-aws    Reconciling {"controller": "managed/codeguruprofiler.aws.upbound.io/v1beta1, kind=profilinggroup", "request": {"name":"example"}}
2024-05-22T21:29:57+02:00   DEBUG   provider-aws    Connecting to the service provider  {"uid": "b20dcec5-679c-43f8-989b-c5fc54928225", "name": "example", "gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup"}
2024-05-22T21:29:57+02:00   DEBUG   provider-aws    Instance state not found in cache, reconstructing...    {"uid": "b20dcec5-679c-43f8-989b-c5fc54928225", "name": "example", "gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup"}
2024-05-22T21:29:57+02:00   DEBUG   provider-aws    ongoing async operation {"uid": "b20dcec5-679c-43f8-989b-c5fc54928225", "name": "example", "gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup", "opType": "create"}
2024-05-22T21:29:57+02:00   DEBUG   provider-aws    External resource is up to date {"controller": "managed/codeguruprofiler.aws.upbound.io/v1beta1, kind=profilinggroup", "request": {"name":"example"}, "uid": "b20dcec5-679c-43f8-989b-c5fc54928225", "version": "12932", "external-name": "example", "requeue-after": "2024-05-22T21:40:15+02:00"}
2024-05-22T21:29:57+02:00   DEBUG   provider-aws    Async create ended. {"trackerUID": "b20dcec5-679c-43f8-989b-c5fc54928225", "resourceName": "example", "gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup", "error": null}
2024-05-22T21:29:57+02:00   DEBUG   provider-aws    Reconcile request has been requeued.    {"gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup", "name": "example", "rateLimiterName": "", "when": "0s"}
2024-05-22T21:29:57+02:00   DEBUG   provider-aws    Reconciling {"controller": "managed/codeguruprofiler.aws.upbound.io/v1beta1, kind=profilinggroup", "request": {"name":"example"}}
2024-05-22T21:29:57+02:00   DEBUG   provider-aws    Connecting to the service provider  {"uid": "b20dcec5-679c-43f8-989b-c5fc54928225", "name": "example", "gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup"}
2024-05-22T21:29:57+02:00   DEBUG   provider-aws    Observing the external resource {"uid": "b20dcec5-679c-43f8-989b-c5fc54928225", "name": "example", "gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup"}
2024-05-22T21:29:58+02:00   DEBUG   provider-aws    External resource is up to date {"controller": "managed/codeguruprofiler.aws.upbound.io/v1beta1, kind=profilinggroup", "request": {"name":"example"}, "uid": "b20dcec5-679c-43f8-989b-c5fc54928225", "version": "12933", "external-name": "example", "requeue-after": "2024-05-22T21:40:01+02:00"}
2024-05-22T21:29:58+02:00   DEBUG   provider-aws    Reconciling {"controller": "managed/codeguruprofiler.aws.upbound.io/v1beta1, kind=profilinggroup", "request": {"name":"example"}}
2024-05-22T21:29:58+02:00   DEBUG   provider-aws    Connecting to the service provider  {"uid": "b20dcec5-679c-43f8-989b-c5fc54928225", "name": "example", "gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup"}
chlunde commented 1 month ago

@turkenf should we do something about the array here?

    agentOrchestrationConfig:
    - profilingEnabled: true
chlunde commented 1 month ago

@turkenf I rebased the PR due to conflict. If I try

diff --git a/config/externalname.go b/config/externalname.go
index b51b69f2e..16b93fdb5 100644
--- a/config/externalname.go
+++ b/config/externalname.go
@@ -70,7 +70,7 @@ var TerraformPluginFrameworkExternalNameConfigs = map[string]config.ExternalName

        // CodeGuru Profiler
        // Profiling Group can be imported using the profiling group name
-       "aws_codeguruprofiler_profiling_group": config.NameAsIdentifier,
+       "aws_codeguruprofiler_profiling_group": config.IdentifierFromProvider,
 }

 // TerraformPluginSDKExternalNameConfigs contains all external name configurations

And the following managed resource (with added spec.forProvider.name), it fails:

apiVersion: codeguruprofiler.aws.upbound.io/v1beta1
kind: ProfilingGroup
metadata:
  annotations:
    meta.upbound.io/example-id: codeguruprofiler/v1beta1/profilinggroup
  labels:
    testing.upbound.io/example-name: example
  name: example
spec:
  forProvider:
    name: example3
    agentOrchestrationConfig:
    - profilingEnabled: true
    computePlatform: Default
    region: us-west-2

The code as it is in this PR seems to work fine, as you can see in the screenshot. Am I missing something here?

2024-05-27T08:04:45+02:00   DEBUG   provider-aws    Starting    {"sync-interval": "1h0m0s", "poll-interval": "10m0s", "poll-jitter": "30s", "max-reconcile-rate": 100}
2024-05-27T08:04:47+02:00   INFO    provider-aws    Beta feature enabled    {"flag": "EnableBetaManagementPolicies"}
2024-05-27T08:04:48+02:00   DEBUG   provider-aws    Reconciling {"controller": "providerconfig/providerconfig.aws.upbound.io", "request": {"name":"default"}}
2024-05-27T08:11:48+02:00   DEBUG   provider-aws    Calling the inner handler for Create event. {"gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup", "name": "example", "queueLength": 0}
2024-05-27T08:11:48+02:00   DEBUG   provider-aws    Reconciling {"controller": "managed/codeguruprofiler.aws.upbound.io/v1beta1, kind=profilinggroup", "request": {"name":"example"}}
2024-05-27T08:11:48+02:00   DEBUG   provider-aws    Connecting to the service provider  {"uid": "baccf863-b384-46e6-a060-43bde0665a20", "name": "example", "gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup"}
2024-05-27T08:11:48+02:00   DEBUG   provider-aws    Calling the inner handler for Update event. {"gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup", "name": "example", "queueLength": 0}
2024-05-27T08:11:48+02:00   DEBUG   provider-aws    Reconciling {"controller": "providerconfig/providerconfig.aws.upbound.io", "request": {"name":"default"}}
2024-05-27T08:11:48+02:00   DEBUG   provider-aws    Reconciling {"controller": "providerconfig/providerconfig.aws.upbound.io", "request": {"name":"default"}}
2024-05-27T08:11:48+02:00   DEBUG   provider-aws    Instance state not found in cache, reconstructing...    {"uid": "baccf863-b384-46e6-a060-43bde0665a20", "name": "example", "gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup"}
2024-05-27T08:11:48+02:00   DEBUG   provider-aws    Observing the external resource {"uid": "baccf863-b384-46e6-a060-43bde0665a20", "name": "example", "gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup"}
2024-05-27T08:11:49+02:00   DEBUG   provider-aws    Cannot observe external resource    {"controller": "managed/codeguruprofiler.aws.upbound.io/v1beta1, kind=profilinggroup", "request": {"name":"example"}, "uid": "baccf863-b384-46e6-a060-43bde0665a20", "version": "89516", "external-name": "", "error": "read resource request failed: setting Amazon CodeGuru Profiler Profiling Group: operation error CodeGuruProfiler: DescribeProfilingGroup, serialization failed: serialization failed: input member profilingGroupName must not be empty: operation error CodeGuruProfiler: DescribeProfilingGroup, serialization failed: serialization failed: input member profilingGroupName must not be empty", "errorVerbose": "setting Amazon CodeGuru Profiler Profiling Group: operation error CodeGuruProfiler: DescribeProfilingGroup, serialization failed: serialization failed: input member profilingGroupName must not be empty: operation error CodeGuruProfiler: DescribeProfilingGroup, serialization failed: serialization failed: input member profilingGroupName must not be empty\ngithub.com/crossplane/upjet/pkg/controller.getFatalDiagnostics\n\tgithub.com/crossplane/upjet@v1.4.0/pkg/controller/external_tfpluginfw.go:676\ngithub.com/crossplane/upjet/pkg/controller.(*terraformPluginFrameworkExternalClient).Observe\n\tgithub.com/crossplane/upjet@v1.4.0/pkg/controller/external_tfpluginfw.go:309\ngithub.com/crossplane/upjet/pkg/controller.(*terraformPluginFrameworkAsyncExternalClient).Observe\n\tgithub.com/crossplane/upjet@v1.4.0/pkg/controller/external_async_tfpluginfw.go:122\ngithub.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*Reconciler).Reconcile\n\tgithub.com/crossplane/crossplane-runtime@v1.16.0-rc.2.0.20240510094504-3f697876fa57/pkg/reconciler/managed/reconciler.go:914\ngithub.com/crossplane/crossplane-runtime/pkg/ratelimiter.(*Reconciler).Reconcile\n\tgithub.com/crossplane/crossplane-runtime@v1.16.0-rc.2.0.20240510094504-3f697876fa57/pkg/ratelimiter/reconciler.go:54\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:119\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:316\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:266\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:227\nruntime.goexit\n\truntime/asm_arm64.s:1222\nread resource request failed\ngithub.com/crossplane/upjet/pkg/controller.(*terraformPluginFrameworkExternalClient).Observe\n\tgithub.com/crossplane/upjet@v1.4.0/pkg/controller/external_tfpluginfw.go:310\ngithub.com/crossplane/upjet/pkg/controller.(*terraformPluginFrameworkAsyncExternalClient).Observe\n\tgithub.com/crossplane/upjet@v1.4.0/pkg/controller/external_async_tfpluginfw.go:122\ngithub.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*Reconciler).Reconcile\n\tgithub.com/crossplane/crossplane-runtime@v1.16.0-rc.2.0.20240510094504-3f697876fa57/pkg/reconciler/managed/reconciler.go:914\ngithub.com/crossplane/crossplane-runtime/pkg/ratelimiter.(*Reconciler).Reconcile\n\tgithub.com/crossplane/crossplane-runtime@v1.16.0-rc.2.0.20240510094504-3f697876fa57/pkg/ratelimiter/reconciler.go:54\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:119\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:316\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:266\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:227\nruntime.goexit\n\truntime/asm_arm64.s:1222"}
2024-05-27T08:11:49+02:00   DEBUG   provider-aws    Reconciling {"controller": "managed/codeguruprofiler.aws.upbound.io/v1beta1, kind=profilinggroup", "request": {"name":"example"}}
2024-05-27T08:11:49+02:00   DEBUG   provider-aws    Connecting to the service provider  {"uid": "baccf863-b384-46e6-a060-43bde0665a20", "name": "example", "gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup"}
2024-05-27T08:11:49+02:00   DEBUG   provider-aws    Observing the external resource {"uid": "baccf863-b384-46e6-a060-43bde0665a20", "name": "example", "gvk": "codeguruprofiler.aws.upbound.io/v1beta1, Kind=ProfilingGroup"}
2024-05-27T08:11:49+02:00   DEBUG   provider-aws    Cannot observe external resource    {"controller": "managed/codeguruprofiler.aws.upbound.io/v1beta1, kind=profilinggroup", "request": {"name":"example"}, "uid": "baccf863-b384-46e6-a060-43bde0665a20", "version": "89522", "external-name": "", "error": "read resource request failed: setting Amazon CodeGuru Profiler Profiling Group: operation error CodeGuruProfiler: DescribeProfilingGroup, serialization failed: serialization failed: input member profilingGroupName must not be empty: operation error CodeGuruProfiler: DescribeProfilingGroup, serialization failed: serialization failed: input member profilingGroupName must not be empty", "errorVerbose": "setting Amazon CodeGuru Profiler Profiling Group: operation error CodeGuruProfiler: DescribeProfilingGroup, serialization failed: serialization failed: input member profilingGroupName must not be empty: operation error CodeGuruProfiler: DescribeProfilingGroup, serialization failed: serialization failed: input member profilingGroupName must not be empty\ngithub.com/crossplane/upjet/pkg/controller.getFatalDiagnostics\n\tgithub.com/crossplane/upjet@v1.4.0/pkg/controller/external_tfpluginfw.go:676\ngithub.com/crossplane/upjet/pkg/controller.(*terraformPluginFrameworkExternalClient).Observe\n\tgithub.com/crossplane/upjet@v1.4.0/pkg/controller/external_tfpluginfw.go:309\ngithub.com/crossplane/upjet/pkg/controller.(*terraformPluginFrameworkAsyncExternalClient).Observe\n\tgithub.com/crossplane/upjet@v1.4.0/pkg/controller/external_async_tfpluginfw.go:122\ngithub.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*Reconciler).Reconcile\n\tgithub.com/crossplane/crossplane-runtime@v1.16.0-rc.2.0.20240510094504-3f697876fa57/pkg/reconciler/managed/reconciler.go:914\ngithub.com/crossplane/crossplane-runtime/pkg/ratelimiter.(*Reconciler).Reconcile\n\tgithub.com/crossplane/crossplane-runtime@v1.16.0-rc.2.0.20240510094504-3f697876fa57/pkg/ratelimiter/reconciler.go:54\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:119\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:316\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:266\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:227\nruntime.goexit\n\truntime/asm_arm64.s:1222\nread resource request failed\ngithub.com/crossplane/upjet/pkg/controller.(*terraformPluginFrameworkExternalClient).Observe\n\tgithub.com/crossplane/upjet@v1.4.0/pkg/controller/external_tfpluginfw.go:310\ngithub.com/crossplane/upjet/pkg/controller.(*terraformPluginFrameworkAsyncExternalClient).Observe\n\tgithub.com/crossplane/upjet@v1.4.0/pkg/controller/external_async_tfpluginfw.go:122\ngithub.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*Reconciler).Reconcile\n\tgithub.com/crossplane/crossplane-runtime@v1.16.0-rc.2.0.20240510094504-3f697876fa57/pkg/reconciler/managed/reconciler.go:914\ngithub.com/crossplane/crossplane-runtime/pkg/ratelimiter.(*Reconciler).Reconcile\n\tgithub.com/crossplane/crossplane-runtime@v1.16.0-rc.2.0.20240510094504-3f697876fa57/pkg/ratelimiter/reconciler.go:54\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:119\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:316\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:266\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/controller-runtime@v0.17.3/pkg/internal/controller/controller.go:227\nruntime.goexit\n\truntime/asm_arm64.s:1222"}
jeanduplessis commented 1 month ago

/test-examples="examples/codeguruprofiler/v1beta1/profilinggroup.yaml"

turkenf commented 4 weeks ago

Hi @chlunde,

The v1.6.0 release is planned for tomorrow, June 6, if you want to include this resource in the release, please look at the comments above, thanks in advance.

chlunde commented 4 weeks ago

@turkenf Thanks! Sorry for the late reply, I've been traveling. I had to rebase due to conflicts. I also added name: example to the example, and tested manually creating the profiling group. To import an existing, I had to set external-name matching the name.

turkenf commented 4 weeks ago

/test-examples="examples/codeguruprofiler/v1beta1/profilinggroup.yaml"

turkenf commented 4 weeks ago

Thanks, fixed! I see the terraform provider sets state.ID = profilingGroup.Name. I don't fully understand the pros and cons here (i.e. what is broken with using NameAsIdentifier). One thing is that we now both have name and external-name, but I think they will have to be the same to make any sense. Maybe we should have a cel-expression in the future to enforce that if external name is set, it must match the name?

Actually, you are right @chlunde, I misunderstood the situation here 🤦 I suggested the IdentifierFromProvider to you, assuming that there were special characters etc. in the spec.forProvider.name syntax (which we can not specify in the metadata.name). But now that I look at it again, I don't see such a necessity.

Screenshot 2024-06-06 at 12 21 14

After this enlightenment, I think it is more appropriate to use NameAsIdentifier in terms of API normalization and for the reasons you stated.

Sorry for the misunderstanding, if you don't mind, could you please set the external name configuration to NameAsIdentifier as you did in the first case?

chlunde commented 4 weeks ago

@turkenf cool! I've updated (and retested)

turkenf commented 4 weeks ago

/test-examples="examples/codeguruprofiler/v1beta1/profilinggroup.yaml"