terraform-provider-vultr
terraform-provider-vultr copied to clipboard
[Feature] - Allow instances to attach existing block storages during creation
Is your feature request related to a problem? Please describe.
I use separate projects for my block storages and instances. Project with storages needs to be created before project with instances, so it doesn't seem to be possible to use attached_to_instance
option (from here) without creating dependency hell.
Describe the solution you'd like
I would like to be able to attach block storage using instance configuration (described here) during instance creation. New option could be added as attached_storage_ids = []
.
Describe alternatives you've considered
Another solution to my problem would be to add new resource similar to aws_volume_attachment
(explained here). It sounds a bit harder to implement in Vultr provider, but more flexible and better in general in long-term.
@NotJustPizza
I don't have an immediate fix for this but it's something we can def look into
@ddymko Any update or ETA? This issue turned out to be biggest wall preventing me from doing more advanced setups that require storage blocks under Vultr.
@NotJustPizza
I haven't had a chance to find a proper solution to this. Introducing a new field on instances where instances would make a underlying call to attach itself to block storage would cause drift on that given block resource. The same would be said for a vultr_volume_attachment
this would cause drift against the block resource.
I would like to support this without having to remove existing functionality (from the block resource).
That being said we will spend time this week looking to see if there is a way forward that isn't disruptive
@NotJustPizza Hello! Could you please elaborate on the requirement for storage to be created before instances? Since nothing could be done with storage until attached to an instance, it seems the dependency should be the opposite.
I would just like to understand the use case better and if I'm missing something, thanks!
Hello @Oogy and @ddymko! Sorry for very late response! I didn't use Vultr for ages now, but I recently returned to give it another try, so it would be great to have this case solved :)
Reason behind my request is quite simple, I want ability to create compute instances on demand using Terraform while preserving some data between sessions in storage. Currently if you want to delete instances without deleting data you have to mess with terraform state
, so I figured out that if you allow storage to be created first I will be to separate data from compute and make my setup more flexible.