iterative / terraform-provider-iterative

☁️ Terraform plugin for machine learning workloads: spot instance recovery & auto-termination | AWS, GCP, Azure, Kubernetes
https://registry.terraform.io/providers/iterative/iterative/latest/docs
Apache License 2.0
287 stars 27 forks source link

`task` Fix id-generation #631

Closed dacbd closed 1 year ago

dacbd commented 1 year ago

:hear_no_evil: Much sad! 8 hrs of debugging for such a small fix :see_no_evil:

my day's TLDR:

Any id/name greater than 28 aka: maximumLongLength-shortLength-uint32(len("tpi---")) resulted in improperly generating the digest and so the inferred bucket name was different from terraform create to terraform refresh which results in the follow error: image

Discovered via some BB testing because below Bitbucket CI env is a uuid and thus >28 you can also replicate the error by setting a name for your task that is also >28 chars: https://github.com/iterative/terraform-provider-iterative/blob/c3f1c08c60d32b954e8e23b23feae2e7431100c5/iterative/resource_task.go#L371-L388