State management, external backend?

Hi everyone, how does coder manage the terraform state of its workspaces? Is it stored in the Postgres database? Is there any option of them being stored externally, such as S3?
6 Replies
Codercord
Codercord3mo ago
Category: Feature request Product: Coder OSS (v2) What platform are you hosting Coder OSS (v2) on?
Phorcys
Phorcys3mo ago
@Andrej yes, Coder stores the state inside the pgsql database there is no way to store the state externally AFAIK
Andrej
AndrejOP3mo ago
any idea which table? is there any docs for this?
zounce
zounce3mo ago
https://developer.hashicorp.com/terraform/language/backend Coder supports remote Terraform state files IIRC, you just have to configure it within the template using the backend block I don't believe we have any external documentation for the database, but it's the provisioner_state column on the workspace_builds table, the state from a build of a workspace can also be read using coder state pull <wsname>
Andrej
AndrejOP3mo ago
yeah, im aware of the backend block. i was just playing around and trying if its possible to dynamically set the backend, since coder needs the providers (and backends) defined before you can input anything via parameters.
zounce
zounce3mo ago
there's coder state push as well, you could probably try hacking around with that? but of course feel free to make a feature request for this, if you think it'd be beneficial for others

Did you find this page helpful?