This repository was archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
can't get the correct terraform state file when importing the existed resources #297
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
importing existed resources with yaml file filled required fields and annotations: crossplane.io/external-name: xxx
expected to import the resource, but following the logs: the provider can't get the good result during oberservation, which means, it failed to get the right tfstate file and thought the resources does't existed and try to create one.
cat terraform.tfstate
{
"version": 4,
"terraform_version": "1.1.5",
"serial": 1,
"lineage": "4a5f1ef0-9c2e-41fa-a0c6-3b3a92cc8666",
"outputs": {},
"resources": []
}
some logs:
DEBUG provider-jet-alicloud refresh ended {"workspace": "/tmp/4a5f1ef0-9c2e-41fa-a0c6-3b3a92cc8666", "out": "{\"@level\":\"info\",\"@message\":\"Terraform 1.1.5\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2022-08-17T05:36:22.570388Z\",\"terraform\":\"1.1.5\",\"type\":\"version\",\"ui\":\"1.0\"}\n{\"@level\":\"info\",\"@message\":\"Plan: 0 to add, 0 to change, 0 to destroy.\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2022-08-17T05:36:25.251256Z\",\"changes\":{\"add\":0,\"change\":0,\"remove\":0,\"operation\":\"plan\"},\"type\":\"change_summary\"}\n{\"@level\":\"info\",\"@message\":\"Apply complete! Resources: 0 added, 0 changed, 0 destroyed.\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2022-08-17T05:36:25.255911Z\",\"changes\":{\"add\":0,\"change\":0,\"remove\":0,\"operation\":\"apply\"},\"type\":\"change_summary\"}\n{\"@level\":\"info\",\"@message\":\"Outputs: 0\",\"@module\":\"terraform.ui\",\"@timestamp\":\"2022-08-17T05:36:25.255961Z\",\"outputs\":{},\"type\":\"outputs\"}\n"}
1.6607145853248382e+09 DEBUG provider-jet-alicloud Successfully requested creation of external resource {"controller": "managed/managedk8s.alicloud.jet.crossplane.io/v1alpha1, kind=managedkubernetes", "request": "/k8s-infra-test", "uid": "4a5f1ef0-9c2e-41fa-a0c6-3b3a92cc8666", "version": "3686057787", "external-name": "k8s-infra-test", "external-name": "k8s-infra-test"}
How can we reproduce it?
my config file:
apiVersion: managedk8s.alicloud.jet.crossplane.io/v1alpha1
kind: ManagedKubernetes
metadata:
name: k8s-infra-test
annotations:
external-name: k8s-infra-test
spec:
forProvider:
workerVswitchIds:
- vsw-ufxxxxxxxxxxxxx
securityGroupId: sg-uf63gxxxxxxxxxxxx
providerConfigRef:
name: default-mk8s
deletionPolicy: Delete
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working