terraform-provider-kubernetes icon indicating copy to clipboard operation
terraform-provider-kubernetes copied to clipboard

BUG: Relying on undefined behavior - parsing kubernetes resource names

Open thockin opened this issue 2 years ago • 2 comments

https://github.com/hashicorp/terraform-provider-kubernetes/blob/main/kubernetes/structures_pod.go#L50

The random suffix of a pod or other resource is not guaranteed to be 5 characters, nor is the characterset defined. Those are implementation details, not to be depended on. This is brittle and could change at any time.

You should be using labels to extract metadata, not parsing the name. That's literally why they exist.

thockin avatar Mar 10 '23 22:03 thockin

Hi @thockin,

Thank you for pointing out this. We will take this into consideration in future releases.

arybolovlev avatar Mar 15 '23 08:03 arybolovlev

Almost a year later this bug still exists. If kubernetes changes this behavior you will break.

thockin avatar Jan 14 '24 21:01 thockin