Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: addcoder_env#174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mafredri merged 3 commits intomainfrommafredri/coder-env
Dec 8, 2023
Merged

feat: addcoder_env#174

mafredri merged 3 commits intomainfrommafredri/coder-env
Dec 8, 2023

Conversation

mafredri
Copy link
Member

@mafredrimafredri commentedDec 8, 2023
edited
Loading

I opted for the single-var approach (vs multi as described in#170) because I don't see a use-case for settinga lot of environment variables, and I feel it better matches the resource name and I foresee use-cases for per-environment settings (overwrite, unset, prepend, append, etc.).

Fixes#170
Refscoder/coder#10166

return &schema.Resource{
Description: "Use this resource to set an environment variable in a workspace.",
CreateContext: func(_ context.Context, rd *schema.ResourceData, _ interface{}) diag.Diagnostics {
rd.SetId(uuid.NewString())
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I considered disallowing envs here, likePATH,CODER_AGENT_TOKEN, etc. However, I opted for doing this agent side instead (we'll log an error).

Copy link
Member

@mtojekmtojek left a comment

Choose a reason for hiding this comment

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

I left a few ideas for further improvement. What you proposed is good for MVP.

@@ -80,6 +80,7 @@ func New() *schema.Provider {
"coder_app": appResource(),
"coder_metadata": metadataResource(),
"coder_script": scriptResource(),
"coder_env": envResource(),
Copy link
Member

Choose a reason for hiding this comment

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

Thinking loud: Do we need an "opposite" resource?coder_no_env to remove the ENV variable?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

For sure, I'd say that goes as a prop:resource "coder_env" "" { name = "FOO", unset = true }. Discussion ongoing incoder/coder#10166.

mtojek reacted with thumbs up emoji
ForceNew: true,
Required: true,
},
"value": {
Copy link
Member

Choose a reason for hiding this comment

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

Thinking loud:default_value if not set?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

What's the use-case? Maybe we can add it later if we identify one? Since this is an optional string the default value is empty string, which is just fine.

Copy link
Member

Choose a reason for hiding this comment

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

Something similar to: using generic dot files if the user didn't provide a custom URL. But I agree to postpone it for later until we meet scenario.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Maybe that can be handled in terraform? Likevalue = something_something ? other : "fallback", I think this is OK since we're not really looking for user input for variables and it's unlikely you define acoder_env unless you have an idea of what it should be. 🤔

mtojek and matifali reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

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

This is fine for now, thanks for challenging

Copy link
Member

@matifalimatifali left a comment

Choose a reason for hiding this comment

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

Great work. <3 I am eager to test this :)

@mafredrimafredri merged commit471368b intomainDec 8, 2023
@mafredrimafredri deleted the mafredri/coder-env branchDecember 8, 2023 14:10
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsDec 8, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mtojekmtojekmtojek approved these changes

@matifalimatifalimatifali approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Feature Request: Addcoder_env Resource for Injecting Environment Variables into Workspaces
3 participants
@mafredri@matifali@mtojek

[8]ページ先頭

©2009-2025 Movatter.jp