- Notifications
You must be signed in to change notification settings - Fork928
feat: Update Terraform provider to support "dir" in "coder_agent"#1219
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
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE ONLY workspace_agents | ||
DROP COLUMN IF EXISTS directory; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ALTER TABLE ONLY workspace_agents | ||
-- UNIX paths are a maximum length of 4096. | ||
ADD COLUMN IF NOT EXISTS directory varchar(4096) DEFAULT '' NOT NULL; |
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -124,6 +124,8 @@ func (t *terraform) Provision(stream proto.DRPCProvisioner_ProvisionStream) erro | ||
"CODER_WORKSPACE_TRANSITION="+strings.ToLower(start.Metadata.WorkspaceTransition.String()), | ||
"CODER_WORKSPACE_NAME="+start.Metadata.WorkspaceName, | ||
"CODER_WORKSPACE_OWNER="+start.Metadata.WorkspaceOwner, | ||
"CODER_WORKSPACE_ID="+start.Metadata.WorkspaceId, | ||
"CODER_WORKSPACE_OWNER_ID="+start.Metadata.WorkspaceOwnerId, | ||
code-asher marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
) | ||
for key, value := range provisionersdk.AgentScriptEnv() { | ||
env = append(env, key+"="+value) | ||
@@ -330,6 +332,12 @@ func parseTerraformPlan(ctx context.Context, terraform *tfexec.Terraform, planfi | ||
agent.StartupScript = startupScript | ||
} | ||
} | ||
if directoryRaw, has := resource.Expressions["dir"]; has { | ||
dir, ok := directoryRaw.ConstantValue.(string) | ||
if ok { | ||
agent.Directory = dir | ||
} | ||
} | ||
agents[resource.Address] = agent | ||
} | ||
@@ -381,6 +389,7 @@ func parseTerraformApply(ctx context.Context, terraform *tfexec.Terraform, state | ||
Auth string `mapstructure:"auth"` | ||
OperatingSystem string `mapstructure:"os"` | ||
Architecture string `mapstructure:"arch"` | ||
Directory string `mapstructure:"dir"` | ||
ID string `mapstructure:"id"` | ||
Token string `mapstructure:"token"` | ||
Env map[string]string `mapstructure:"env"` | ||
@@ -405,6 +414,7 @@ func parseTerraformApply(ctx context.Context, terraform *tfexec.Terraform, state | ||
StartupScript: attrs.StartupScript, | ||
OperatingSystem: attrs.OperatingSystem, | ||
Architecture: attrs.Architecture, | ||
Directory: attrs.Directory, | ||
} | ||
switch attrs.Auth { | ||
case "token": | ||
Uh oh!
There was an error while loading.Please reload this page.