-
Notifications
You must be signed in to change notification settings - Fork 991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels/annotations not being imported through terraform import #722
Comments
I bumped into the same thing, I believe that it's related to the original stand that |
Maybe we can filter well known labels like as specified here: https://kubernetes.io/docs/reference/kubernetes-api/labels-annotations-taints/ ? similar to what is proposed here with tolerations #955 (comment) I opened a PR for tolerations #978 |
Running into this as well. Terraform v0.12.29
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Running
terraform import
on a bunch of resources does not import metadata labels nor annotations to state.Terraform Version
Terraform v0.12.18
Affected Resource(s)
I just reproduced it with kubernetes_cluster_role, kubernetes_cluster_role_binding, kubernetes_config_map, kubernetes_deployment, kubernetes_namespace, kubernetes_role, kubernetes_role_binding, kubernetes_service and kubernetes_service_account. But I assume it affects all resources with labels in metadata.
Terraform Configuration Files
Partial example:
Expected Behavior
Terraform import should've included label and annotation metadata in state.
Actual Behavior
It didn't. JSON screenshot comparing some of the state of one of the resources in the environment where I initially created it, and to the right, the one where I tried to terraform import it:
Steps to Reproduce
Instantiate the resource in one environment, try to import it in another one. Label metadata will be missing.
Important Factoids
Not really important, but just in case it's useful as a testing scenario or w/e: this was found during a refactor where an environment controlled resources that were to be shared with another environment. As a solution, a separate (shared) environment was created and the resources imported to it so that terraform_remote_state could be used in each user environment.
NOTE: This was edited to add annotations after the fact, as I just noticed a resource that missed its annotations as well.
The text was updated successfully, but these errors were encountered: