Persistent AWS EBS/EC2 home directory
Problem—When I click restart in the coder web GUI, it recreates my workspace and causes the EBS volume to be recreated, causing me to lose all of the data.
I understand why that is as a terraform recreate is happening.
So, before I go down the rabbit hole of making custom scripts, etc., I just wanted to see if there was an out-of-the-box method from the coder.
I found this doco - https://coder.com/docs/admin/templates/extending-templates/resource-persistence But it doesn't seem right for what I want.
Napkin-style plan for what I think should happen -
The user hits restart.
Recreation happens, but the EBS is detached from the instance.
A new instance spins up and attaches the EBS again.
Source code based on this template - https://github.com/coder/coder/blob/main/examples/templates/aws-linux/main.tf
Resource Persistence | Coder Docs
Control resource persistence
GitHub
coder/examples/templates/aws-linux/main.tf at main · coder/coder
Provision remote development environments via Terraform - coder/coder
4 Replies
<#1326347271616598047>
Category
Help needed
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
@Chris2pi
try setting the following in your volume's resource block
this is what we do with docker
https://github.com/coder/coder/blob/9494afaae148b9b34643caa2d1465be8cb344311/examples/templates/docker/main.tf#L156-L181
Perfect that seems to have resolved the issue
I wonder how we could improve the doco with this or would this be more base terraform knowledge?
agreed, I think this would be something we can add to the docs, i've added the "improvement-needed" tag so I can look into it when I get the chance