crossplane-contrib / provider-jet-aws

AWS Provider for Crossplane that is built with Terrajet.
https://crossplane.io
Apache License 2.0
37 stars 30 forks source link

IAM User Example is not working #112

Closed luebken closed 3 years ago

luebken commented 3 years ago

What happened?

I've tried the example and got the error: Results in "Error: Invalid AWS Region:"

 Warning  CannotObserveExternalResource  2s  managed/iam.aws.tf.crossplane.io/v1alpha1, kind=user  cannot run refresh: cannot refresh: {"@level":"info","@message":"Terraform 1.0.5","@module":"terraform.ui","@timestamp":"2021-10-15T14:40:34.413053Z","terraform":"1.0.5","type":"version","ui":"0.1.0"}
{"@level":"error","@message":"Error: Invalid AWS Region: ","@module":"terraform.ui","@timestamp":"2021-10-15T14:40:35.147470Z","diagnostic":{"severity":"error","summary":"Invalid AWS Region: ","detail":"","address":"provider[\"registry.terraform.io/hashicorp/aws\"]","range":{"filename":"main.tf.json","start":{"line":1,"column":40,"byte":39},"end":{"line":1,"column":41,"byte":40}},"snippet":{"context":"provider.tf-provider","code":"{\"provider\":{\"tf-provider\":{\"region\":\"\"}},\"resource\":{\"aws_iam_user\":{\"sample-user\":{\"lifecycle\":{\"prevent_destroy\":true},\"name\":\"sample-user\",\"tags\":{\"k1\":\"v1\"}}}},\"terraform\":{\"required_providers\":{\"tf-provider\":{\"source\":\"hashicorp/aws\",\"version\":\"3.56.0\"}}}}","start_line":1,"highlight_start_offset":39,"highlight_end_offset":40,"values":[]}},"type":"diagnostic"}
: exit status 1

Adding a region fixed it.

What would you expect?

Ideally that there is no region in the yaml definition but I sense that this might be a larger change. But the examples should be working.

luebken commented 3 years ago

I still get an "Error: Invalid AWS Region:" when I use the current example:

On a fresh kind cluster:

kubectl get providers provider-tf-aws
NAME              INSTALLED   HEALTHY   PACKAGE                             AGE
provider-tf-aws   True        True      crossplane/provider-tf-aws:v0.2.3   7m56s
kubectl get user.iam.aws.tf.crossplane.io/sample-user
NAME          READY   SYNCED   EXTERNAL-NAME   AGE
sample-user           False    sample-user     5m37s
kubectl describe user.iam.aws.tf.crossplane.io/sample-user

Name:         sample-user
Namespace:    
Labels:       <none>
Annotations:  crossplane.io/external-name: sample-user
API Version:  iam.aws.tf.crossplane.io/v1alpha1
Kind:         User
Metadata:
  Creation Timestamp:  2021-10-17T07:26:42Z
  Generation:          1
  Managed Fields:
    API Version:  iam.aws.tf.crossplane.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:kubectl.kubernetes.io/last-applied-configuration:
      f:spec:
        .:
        f:deletionPolicy:
        f:forProvider:
        f:providerConfigRef:
          .:
          f:name:
    Manager:      kubectl-client-side-apply
    Operation:    Update
    Time:         2021-10-17T07:26:42Z
    API Version:  iam.aws.tf.crossplane.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          f:crossplane.io/external-name:
      f:status:
        .:
        f:atProvider:
        f:conditions:
    Manager:         crossplane-provider
    Operation:       Update
    Time:            2021-10-17T07:26:50Z
  Resource Version:  3471
  UID:               dace344e-f06e-4da8-ac84-1a25d15344ed
Spec:
  Deletion Policy:  Delete
  For Provider:
  Provider Config Ref:
    Name:  default
Status:
  At Provider:
  Conditions:
    Last Transition Time:  2021-10-17T07:32:29Z
    Message:               observe failed: cannot run refresh: cannot refresh: {"@level":"info","@message":"Terraform 1.0.5","@module":"terraform.ui","@timestamp":"2021-10-17T07:32:28.905831Z","terraform":"1.0.5","type":"version","ui":"0.1.0"}
{"@level":"error","@message":"Error: Invalid AWS Region: ","@module":"terraform.ui","@timestamp":"2021-10-17T07:32:29.678801Z","diagnostic":{"severity":"error","summary":"Invalid AWS Region: ","detail":"","address":"provider[\"registry.terraform.io/hashicorp/aws\"]","range":{"filename":"main.tf.json","start":{"line":1,"column":40,"byte":39},"end":{"line":1,"column":41,"byte":40}},"snippet":{"context":"provider.tf-provider","code":"{\"provider\":{\"tf-provider\":{\"region\":\"\"}},\"resource\":{\"aws_iam_user\":{\"sample-user\":{\"lifecycle\":{\"prevent_destroy\":true},\"name\":\"sample-user\"}}},\"terraform\":{\"required_providers\":{\"tf-provider\":{\"source\":\"hashicorp/aws\",\"version\":\"3.56.0\"}}}}","start_line":1,"highlight_start_offset":39,"highlight_end_offset":40,"values":[]}},"type":"diagnostic"}
: exit status 1
    Reason:  ReconcileError
    Status:  False
    Type:    Synced
Events:
  Type     Reason                         Age    From                                                  Message
  ----     ------                         ----   ----                                                  -------
  Warning  CannotObserveExternalResource  5m49s  managed/iam.aws.tf.crossplane.io/v1alpha1, kind=user  cannot run refresh: cannot refresh: {"@level":"info","@message":"Terraform 1.0.5","@module":"terraform.ui","@timestamp":"2021-10-17T07:26:49.983860Z","terraform":"1.0.5","type":"version","ui":"0.1.0"}
{"@level":"error","@message":"Error: Invalid AWS Region: ","@module":"terraform.ui","@timestamp":"2021-10-17T07:26:50.761350Z","diagnostic":{"severity":"error","summary":"Invalid AWS Region: ","detail":"","address":"provider[\"registry.terraform.io/hashicorp/aws\"]","range":{"filename":"main.tf.json","start":{"line":1,"column":40,"byte":39},"end":{"line":1,"column":41,"byte":40}},"snippet":{"context":"provider.tf-provider","code":"{\"provider\":{\"tf-provider\":{\"region\":\"\"}},\"resource\":{\"aws_iam_user\":{\"sample-user\":{\"lifecycle\":{\"prevent_destroy\":true},\"name\":\"sample-user\"}}},\"terraform\":{\"required_providers\":{\"tf-provider\":{\"source\":\"hashicorp/aws\",\"version\":\"3.56.0\"}}}}","start_line":1,"highlight_start_offset":39,"highlight_end_offset":40,"values":[]}},"type":"diagnostic"}
: exit status 1
  Warning  CannotObserveExternalResource  5m44s  managed/iam.aws.tf.crossplane.io/v1alpha1, kind=user  cannot run refresh: cannot refresh: {"@level":"info","@message":"Terraform 1.0.5","@module":"terraform.ui","@timestamp":"2021-10-17T07:26:54.807284Z","terraform":"1.0.5","type":"version","ui":"0.1.0"}
{"@level":"error","@message":"Error: Invalid AWS Region: ","@module":"terraform.ui","@timestamp":"2021-10-17T07:26:55.619470Z","diagnostic":{"severity":"error","summary":"Invalid AWS Region: ","detail":"","address":"provider[\"registry.terraform.io/hashicorp/aws\"]","range":{"filename":"main.tf.json","start":{"line":1,"column":40,"byte":39},"end":{"line":1,"column":41,"byte":40}},"snippet":{"context":"provider.tf-provider","code":"{\"provider\":{\"tf-provider\":{\"region\":\"\"}},\"resource\":{\"aws_iam_user\":{\"sample-user\":{\"lifecycle\":{\"prevent_destroy\":true},\"name\":\"sample-user\"}}},\"terraform\":{\"required_providers\":{\"tf-provider\":{\"source\":\"hashicorp/aws\",\"version\":\"3.56.0\"}}}}","start_line":1,"highlight_start_offset":39,"highlight_end_offset":40,"values":[]}},"type":"diagnostic"}
: exit status 1
  Warning  CannotObserveExternalResource  5m39s  managed/iam.aws.tf.crossplane.io/v1alpha1, kind=user  cannot run refresh: cannot refresh: {"@level":"info","@message":"Terraform 1.0.5","@module":"terraform.ui","@timestamp":"2021-10-17T07:26:59.702468Z","terraform":"1.0.5","type":"version","ui":"0.1.0"}
{"@level":"error","@message":"Error: Invalid AWS Region: ","@module":"terraform.ui","@timestamp":"2021-10-17T07:27:00.473515Z","diagnostic":{"severity":"error","summary":"Invalid AWS Region: ","detail":"","address":"provider[\"registry.terraform.io/hashicorp/aws\"]","range":{"filename":"main.tf.json","start":{"line":1,"column":40,"byte":39},"end":{"line":1,"column":41,"byte":40}},"snippet":{"context":"provider.tf-provider","code":"{\"provider\":{\"tf-provider\":{\"region\":\"\"}},\"resource\":{\"aws_iam_user\":{\"sample-user\":{\"lifecycle\":{\"prevent_destroy\":true},\"name\":\"sample-user\"}}},\"terraform\":{\"required_providers\":{\"tf-provider\":{\"source\":\"hashicorp/aws\",\"version\":\"3.56.0\"}}}}","start_line":1,"highlight_start_offset":39,"highlight_end_offset":40,"values":[]}},"type":"diagnostic"}
: exit status 1
  Warning  CannotObserveExternalResource  5m31s  managed/iam.aws.tf.crossplane.io/v1alpha1, kind=user  cannot run refresh: cannot refresh: {"@level":"info","@message":"Terraform 1.0.5","@module":"terraform.ui","@timestamp":"2021-10-17T07:27:07.530733Z","terraform":"1.0.5","type":"version","ui":"0.1.0"}
{"@level":"error","@message":"Error: Invalid AWS Region: ","@module":"terraform.ui","@timestamp":"2021-10-17T07:27:08.340221Z","diagnostic":{"severity":"error","summary":"Invalid AWS Region: ","detail":"","address":"provider[\"registry.terraform.io/hashicorp/aws\"]","range":{"filename":"main.tf.json","start":{"line":1,"column":40,"byte":39},"end":{"line":1,"column":41,"byte":40}},"snippet":{"context":"provider.tf-provider","code":"{\"provider\":{\"tf-provider\":{\"region\":\"\"}},\"resource\":{\"aws_iam_user\":{\"sample-user\":{\"lifecycle\":{\"prevent_destroy\":true},\"name\":\"sample-user\"}}},\"terraform\":{\"required_providers\":{\"tf-provider\":{\"source\":\"hashicorp/aws\",\"version\":\"3.56.0\"}}}}","start_line":1,"highlight_start_offset":39,"highlight_end_offset":40,"values":[]}},"type":"diagnostic"}
: exit status 1
  Warning  CannotObserveExternalResource  5m23s  managed/iam.aws.tf.crossplane.io/v1alpha1, kind=user  cannot run refresh: cannot refresh: {"@level":"info","@message":"Terraform 1.0.5","@module":"terraform.ui","@timestamp":"2021-10-17T07:27:15.407600Z","terraform":"1.0.5","type":"version","ui":"0.1.0"}
{"@level":"error","@message":"Error: Invalid AWS Region: ","@module":"terraform.ui","@timestamp":"2021-10-17T07:27:16.156718Z","diagnostic":{"severity":"error","summary":"Invalid AWS Region: ","detail":"","address":"provider[\"registry.terraform.io/hashicorp/aws\"]","range":{"filename":"main.tf.json","start":{"line":1,"column":40,"byte":39},"end":{"line":1,"column":41,"byte":40}},"snippet":{"context":"provider.tf-provider","code":"{\"provider\":{\"tf-provider\":{\"region\":\"\"}},\"resource\":{\"aws_iam_user\":{\"sample-user\":{\"lifecycle\":{\"prevent_destroy\":true},\"name\":\"sample-user\"}}},\"terraform\":{\"required_providers\":{\"tf-provider\":{\"source\":\"hashicorp/aws\",\"version\":\"3.56.0\"}}}}","start_line":1,"highlight_start_offset":39,"highlight_end_offset":40,"values":[]}},"type":"diagnostic"}
: exit status 1
  Warning  CannotObserveExternalResource  5m19s  managed/iam.aws.tf.crossplane.io/v1alpha1, kind=user  cannot run refresh: cannot refresh: {"@level":"info","@message":"Terraform 1.0.5","@module":"terraform.ui","@timestamp":"2021-10-17T07:27:20.205737Z","terraform":"1.0.5","type":"version","ui":"0.1.0"}
{"@level":"error","@message":"Error: Invalid AWS Region: ","@module":"terraform.ui","@timestamp":"2021-10-17T07:27:20.948145Z","diagnostic":{"severity":"error","summary":"Invalid AWS Region: ","detail":"","address":"provider[\"registry.terraform.io/hashicorp/aws\"]","range":{"filename":"main.tf.json","start":{"line":1,"column":40,"byte":39},"end":{"line":1,"column":41,"byte":40}},"snippet":{"context":"provider.tf-provider","code":"{\"provider\":{\"tf-provider\":{\"region\":\"\"}},\"resource\":{\"aws_iam_user\":{\"sample-user\":{\"lifecycle\":{\"prevent_destroy\":true},\"name\":\"sample-user\"}}},\"terraform\":{\"required_providers\":{\"tf-provider\":{\"source\":\"hashicorp/aws\",\"version\":\"3.56.0\"}}}}","start_line":1,"highlight_start_offset":39,"highlight_end_offset":40,"values":[]}},"type":"diagnostic"}
: exit status 1
  Warning  CannotObserveExternalResource  5m14s  managed/iam.aws.tf.crossplane.io/v1alpha1, kind=user  cannot run refresh: cannot refresh: {"@level":"info","@message":"Terraform 1.0.5","@module":"terraform.ui","@timestamp":"2021-10-17T07:27:25.044640Z","terraform":"1.0.5","type":"version","ui":"0.1.0"}
{"@level":"error","@message":"Error: Invalid AWS Region: ","@module":"terraform.ui","@timestamp":"2021-10-17T07:27:25.786809Z","diagnostic":{"severity":"error","summary":"Invalid AWS Region: ","detail":"","address":"provider[\"registry.terraform.io/hashicorp/aws\"]","range":{"filename":"main.tf.json","start":{"line":1,"column":40,"byte":39},"end":{"line":1,"column":41,"byte":40}},"snippet":{"context":"provider.tf-provider","code":"{\"provider\":{\"tf-provider\":{\"region\":\"\"}},\"resource\":{\"aws_iam_user\":{\"sample-user\":{\"lifecycle\":{\"prevent_destroy\":true},\"name\":\"sample-user\"}}},\"terraform\":{\"required_providers\":{\"tf-provider\":{\"source\":\"hashicorp/aws\",\"version\":\"3.56.0\"}}}}","start_line":1,"highlight_start_offset":39,"highlight_end_offset":40,"values":[]}},"type":"diagnostic"}
: exit status 1
  Warning  CannotObserveExternalResource  5m6s  managed/iam.aws.tf.crossplane.io/v1alpha1, kind=user  cannot run refresh: cannot refresh: {"@level":"info","@message":"Terraform 1.0.5","@module":"terraform.ui","@timestamp":"2021-10-17T07:27:32.850528Z","terraform":"1.0.5","type":"version","ui":"0.1.0"}
{"@level":"error","@message":"Error: Invalid AWS Region: ","@module":"terraform.ui","@timestamp":"2021-10-17T07:27:33.594410Z","diagnostic":{"severity":"error","summary":"Invalid AWS Region: ","detail":"","address":"provider[\"registry.terraform.io/hashicorp/aws\"]","range":{"filename":"main.tf.json","start":{"line":1,"column":40,"byte":39},"end":{"line":1,"column":41,"byte":40}},"snippet":{"context":"provider.tf-provider","code":"{\"provider\":{\"tf-provider\":{\"region\":\"\"}},\"resource\":{\"aws_iam_user\":{\"sample-user\":{\"lifecycle\":{\"prevent_destroy\":true},\"name\":\"sample-user\"}}},\"terraform\":{\"required_providers\":{\"tf-provider\":{\"source\":\"hashicorp/aws\",\"version\":\"3.56.0\"}}}}","start_line":1,"highlight_start_offset":39,"highlight_end_offset":40,"values":[]}},"type":"diagnostic"}
: exit status 1
  Warning  CannotObserveExternalResource  4m58s  managed/iam.aws.tf.crossplane.io/v1alpha1, kind=user  cannot run refresh: cannot refresh: {"@level":"info","@message":"Terraform 1.0.5","@module":"terraform.ui","@timestamp":"2021-10-17T07:27:40.646398Z","terraform":"1.0.5","type":"version","ui":"0.1.0"}
{"@level":"error","@message":"Error: Invalid AWS Region: ","@module":"terraform.ui","@timestamp":"2021-10-17T07:27:41.453792Z","diagnostic":{"severity":"error","summary":"Invalid AWS Region: ","detail":"","address":"provider[\"registry.terraform.io/hashicorp/aws\"]","range":{"filename":"main.tf.json","start":{"line":1,"column":40,"byte":39},"end":{"line":1,"column":41,"byte":40}},"snippet":{"context":"provider.tf-provider","code":"{\"provider\":{\"tf-provider\":{\"region\":\"\"}},\"resource\":{\"aws_iam_user\":{\"sample-user\":{\"lifecycle\":{\"prevent_destroy\":true},\"name\":\"sample-user\"}}},\"terraform\":{\"required_providers\":{\"tf-provider\":{\"source\":\"hashicorp/aws\",\"version\":\"3.56.0\"}}}}","start_line":1,"highlight_start_offset":39,"highlight_end_offset":40,"values":[]}},"type":"diagnostic"}
: exit status 1
  Warning  CannotObserveExternalResource  45s (x42 over 4m53s)  managed/iam.aws.tf.crossplane.io/v1alpha1, kind=user  (combined from similar events): cannot run refresh: cannot refresh: {"@level":"info","@message":"Terraform 1.0.5","@module":"terraform.ui","@timestamp":"2021-10-17T07:31:54.131011Z","terraform":"1.0.5","type":"version","ui":"0.1.0"}
{"@level":"error","@message":"Error: Invalid AWS Region: ","@module":"terraform.ui","@timestamp":"2021-10-17T07:31:54.861646Z","diagnostic":{"severity":"error","summary":"Invalid AWS Region: ","detail":"","address":"provider[\"registry.terraform.io/hashicorp/aws\"]","range":{"filename":"main.tf.json","start":{"line":1,"column":40,"byte":39},"end":{"line":1,"column":41,"byte":40}},"snippet":{"context":"provider.tf-provider","code":"{\"provider\":{\"tf-provider\":{\"region\":\"\"}},\"resource\":{\"aws_iam_user\":{\"sample-user\":{\"lifecycle\":{\"prevent_destroy\":true},\"name\":\"sample-user\"}}},\"terraform\":{\"required_providers\":{\"tf-provider\":{\"source\":\"hashicorp/aws\",\"version\":\"3.56.0\"}}}}","start_line":1,"highlight_start_offset":39,"highlight_end_offset":40,"values":[]}},"type":"diagnostic"}
: exit status 1
luebken commented 3 years ago

Works with crossplane/provider-tf-aws:v0.2.0-28.gd2c0024f