Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Where is this name field coming from? #18

Closed
mikebollandajw opened this issue Feb 25, 2022 · 3 comments
Closed

Where is this name field coming from? #18

mikebollandajw opened this issue Feb 25, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@mikebollandajw
Copy link

What happened?

There is an error when trying to generate an azuread resource

1.6457344224525993e+09  DEBUG   events  Warning {"object": {"kind":"Application","name":"azuread-application","uid":"9b8ccec1-484b-4faf-9e01-92f1b5ab2ad3","apiVersion":"azuread.azuread.jet.crossplane.io/v1alpha1","resourceVersion":"7502087"}, "reason": "CannotObserveExternalResource", "message": "cannot run refresh: refresh failed: Extraneous JSON object property: No argument or block type is named \"name\".: File name: main.tf.json"}
1.6457344824875672e+09  DEBUG   provider-jet-azuread    Reconciling     {"controller": "managed/azuread.azuread.jet.crossplane.io/v1alpha1, kind=application", "request": "/azuread-application"}
1.6457344826753385e+09  DEBUG   provider-jet-azuread    refresh ended   {"workspace": "/tmp/9b8ccec1-484b-4faf-9e01-92f1b5ab2ad3", "out": "{\"@level\":\"info\",\"@message\":\"Terraform 1.1.6\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2022-02-24T20:28:02.519063Z\",\"terraform\":\"1.1.6\",\"type\":\"version\",\"ui\":\"1.0\"}\n{\"@level\":\"error\",\"@message\":\"Error: Extraneous JSON object property\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2022-02-24T20:28:02.672277Z\",\"diagnostic\":{\"severity\":\"error\",\"summary\":\"Extraneous JSON object property\",\"detail\":\"No argument or block type is named \\\"name\\\".\",\"range\":{\"filename\":\"main.tf.json\",\"start\":{\"line\":1,\"column\":311,\"byte\":310},\"end\":{\"line\":1,\"column\":317,\"byte\":316}},\"snippet\":{\"context\":\"resource.azuread_application.azuread-application\",\"code\":\"{\\\"provider\\\":{\\\"azuread\\\":{\\\"client_id\\\":\\\"XXXXXXXXXXXXXXXXXXXXXXXXX\\\",\\\"client_secret\\\":\\\"XXXXXXXXXXXXXXXXXXXXXXXXX\\\",\\\"tenant_id\\\":\\\"XXXXXXXXXXXXXXXXXXXXXXXXX\\\"}},\\\"resource\\\":{\\\"azuread_application\\\":{\\\"azuread-application\\\":{\\\"display_name\\\":\\\"test_application\\\",\\\"lifecycle\\\":{\\\"prevent_destroy\\\":true},\\\"name\\\":\\\"azuread-application\\\"}}},\\\"terraform\\\":{\\\"required_providers\\\":{\\\"azuread\\\":{\\\"source\\\":\\\"hashicorp/azuread\\\",\\\"version\\\":\\\"2.18.0\\\"}}}}\",\"start_line\":1,\"highlight_start_offset\":310,\"highlight_end_offset\":316,\"values\":[]}},\"type\":\"diagnostic\"}\n"}
1.645734482675425e+09   DEBUG   provider-jet-azuread    Cannot observe external resource        {"controller": "managed/azuread.azuread.jet.crossplane.io/v1alpha1, kind=application", "request": "/azuread-application", "uid": "9b8ccec1-484b-4faf-9e01-92f1b5ab2ad3", "version": "7502087", "external-name": "azuread-application", "error": "cannot run refresh: refresh failed: Extraneous JSON object property: No argument or block type is named \"name\".: File name: main.tf.json", "errorVerbose": "refresh failed: Extraneous JSON object property: No argument or block type is named \"name\".: File name: main.tf.json\ncannot run refresh\ngithub.com/crossplane/terrajet/pkg/controller.(*external).Observe\n\t/mnt/c/dev/git/provider-jet-azuread/.work/pkg/pkg/mod/github.com/crossplane/terrajet@v0.4.0/pkg/controller/external.go:125\ngithub.com/crossplane/crossplane-runtime/pkg/reconciler/managed.(*Reconciler).Reconcile\n\t/mnt/c/dev/git/provider-jet-azuread/.work/pkg/pkg/mod/github.com/crossplane/crossplane-runtime@v0.15.1-0.20220106140106-428b7c390375/pkg/reconciler/managed/reconciler.go:758\ngithub.com/crossplane/crossplane-runtime/pkg/ratelimiter.(*Reconciler).Reconcile\n\t/mnt/c/dev/git/provider-jet-azuread/.work/pkg/pkg/mod/github.com/crossplane/crossplane-runtime@v0.15.1-0.20220106140106-428b7c390375/pkg/ratelimiter/reconciler.go:54\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\t/mnt/c/dev/git/provider-jet-azuread/.work/pkg/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:114\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/mnt/c/dev/git/provider-jet-azuread/.work/pkg/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:311\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/mnt/c/dev/git/provider-jet-azuread/.work/pkg/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:266\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/mnt/c/dev/git/provider-jet-azuread/.work/pkg/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:227\nruntime.goexit\n\t/mnt/c/Users/Mike.Bolland/go/src/runtime/asm_amd64.s:1581"}
1.6457344826756868e+09  DEBUG   events  Warning {"object": {"kind":"Application","name":"azuread-application","uid":"9b8ccec1-484b-4faf-9e01-92f1b5ab2ad3","apiVersion":"azuread.azuread.jet.crossplane.io/v1alpha1","resourceVersion":"7502087"}, "reason": "CannotObserveExternalResource", "message": "cannot run refresh: refresh failed: Extraneous JSON object property: No argument or block type is named \"name\".: File name: main.tf.json"}
1.6457345090279298e+09  DEBUG   provider-jet-azuread    Reconciling     {"controller": "managed/azuread.azuread.jet.crossplane.io/v1alpha1, kind=application", "request": "/azuread-application"}
1.645734509027983e+09   DEBUG   provider-jet-azuread    Cannot get managed resource     {"controller": "managed/azuread.azuread.jet.crossplane.io/v1alpha1, kind=application", "request": "/azuread-application", "error": "Application.azuread.azuread.jet.crossplane.io \"azuread-application\" not found"}
1.6457345093279011e+09  DEBUG   provider-jet-azuread    Reconciling     {"controller": "providerconfig/providerconfig.azuread.jet.crossplane.io", "request": "/azuread-creds-next"}
1.6457345094354095e+09  DEBUG   provider-jet-azuread    Reconciling     {"controller": "providerconfig/providerconfig.azuread.jet.crossplane.io", "request": "/azuread-creds-next"}
1.6457345431087437e+09  DEBUG   provider-jet-azuread    Reconciling     {"controller": "managed/azuread.azuread.jet.crossplane.io/v1alpha1, kind=application", "request": "/azuread-application"}
1.645734543108836e+09   DEBUG   provider-jet-azuread    Cannot get managed resource     {"controller": "managed/azuread.azuread.jet.crossplane.io/v1alpha1, kind=application", "request": "/azuread-application", "error": "Application.azuread.azuread.jet.crossplane.io \"azuread-application\" not found"}

How can we reproduce it?

Follow the generating a provider guide on the website and use azuread as your terraform provider

What environment did it happen in?

Crossplane version:
crossplane/provider-aws:v0.24.1
k8s: v1.21.5-eks-bc4871b

@mikebollandajw mikebollandajw added the bug Something isn't working label Feb 25, 2022
@turkenh
Copy link
Collaborator

turkenh commented Feb 25, 2022

@mikebollandajw
Copy link
Author

mikebollandajw commented Feb 28, 2022

Hi, i believe you are saying this needs to be adjusted in GO from name to the import description on the application page?

https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/application#import

Ie this appears to be a guid of type id so i presume im replacing NameAsIdentifier with IdentifierFromProvider but it wasnt clear where that needs to be changed

provider-jet-azuread$ grep "NameAsIdentifier" * -R

  • no results -

@mikebollandajw
Copy link
Author

this has been resolved by following the guide for defining custom provider https://github.com/crossplane/terrajet/blob/28422508962842a1e455eaf7879d16599644715b/docs/generating-a-provider.md?plain=1#L147

thanks again

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants