Skip to content
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

Terraform import command crash failures for resources with ids of the form x/y #41

Closed
ashishth09 opened this issue Aug 6, 2017 · 0 comments · Fixed by #46
Closed

Terraform import command crash failures for resources with ids of the form x/y #41

ashishth09 opened this issue Aug 6, 2017 · 0 comments · Fixed by #46

Comments

@ashishth09
Copy link
Contributor

Hi @radeksimko ,

I am writing a resource where I need to compose the id of the resource from two other fields. I recalled k8s resource does something like that for example -

https://github.com/terraform-providers/terraform-provider-kubernetes/blob/master/kubernetes/structures.go#L15-L18

It just clicked me that calls like below would lead to a crash if some one would do -

terraform import resource_kubernetes_config_map.mymap mapname

like someone forgets that actual id is namespace/mapname
https://github.com/terraform-providers/terraform-provider-kubernetes/blob/master/kubernetes/resource_kubernetes_config_map.go#L79

It's all theory in my head at this point. But looks like we should return some meaningful error from the function which decomposes the id into sub-parts, probably something like
func idParts(string) (string, string, error)

@ashishth09 ashishth09 changed the title Terraform import command failures for resources with ids of the form x/y Terraform import command crash failures for resources with ids of the form x/y Aug 6, 2017
@ghost ghost locked and limited conversation to collaborators Apr 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants