Skip to content

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Dec 8, 2023

This PR adds support for coder_env (coder/terraform-provider-coder#174).

The terraform/proto structure is conducive towards allowing additional logic in the future, as discussed in #10166.

For now, we simply piggy-back on the workspace_agents.environment_variables column with the additional envs. It felt premature to add a separate table and logic in the agent for this, however, a downside is that conflicts are silently ignored (we simply don't set the env if it's already set on the agent resource or by another module).

Ideas for non-silent discard are welcome. And if preferred, I can create the workspace_agent_env table with accompanying agent logic to process the extra envs. The agent can then log the conflict.

Fixes #10166

@mafredri mafredri force-pushed the mafredri/feat-coder-env branch 2 times, most recently from d18e00c to b63880b Compare December 8, 2023 14:41
@mafredri mafredri force-pushed the mafredri/feat-coder-env branch from b63880b to 04ac5cc Compare December 8, 2023 15:14
@mafredri mafredri force-pushed the mafredri/feat-coder-env branch from 0fc68f9 to 983cad8 Compare December 8, 2023 15:46
@mafredri mafredri marked this pull request as ready for review December 8, 2023 15:49
Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this behaviour is fine.
LGTM

There's definitely a set of environment variables we don't want folks to be able to override, lest they brick their workspace.
So this behaviour of not overriding is fine for now.

Perhaps later we could have a denylist of environment variables, but that's not for now.

@mafredri mafredri merged commit 3e5d292 into main Dec 11, 2023
@mafredri mafredri deleted the mafredri/feat-coder-env branch December 11, 2023 14:10
@github-actions github-actions bot locked and limited conversation to collaborators Dec 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add coder_env so that modules can set environment variables
3 participants