Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update external agent handling in workspace agents and adjust Terrafo…
…rm resource references
  • Loading branch information
kacpersaw committed Aug 19, 2025
commit fb7bc71ce5d80cfa02f9831de5391e7f653c2535
23 changes: 0 additions & 23 deletions enterprise/coderd/workspaceagents.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,29 +52,6 @@ func (api *API) workspaceExternalAgentCredentials(rw http.ResponseWriter, r *htt
return
}

resources, err := api.Database.GetWorkspaceResourcesByJobID(ctx, build.JobID)
if err != nil {
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
Message: "Failed to get workspace resources.",
Detail: err.Error(),
})
return
}

found := false
for _, resource := range resources {
if resource.Type == "coder_external_agent" && resource.Name == agentName {
found = true
break
}
}
if !found {
httpapi.Write(ctx, rw, http.StatusNotFound, codersdk.Response{
Message: fmt.Sprintf("Agent '%s' does not have an external agent associated with it.", agentName),
})
return
}

agents, err := api.Database.GetWorkspaceAgentsByWorkspaceAndBuildNumber(ctx, database.GetWorkspaceAgentsByWorkspaceAndBuildNumberParams{
WorkspaceID: workspace.ID,
BuildNumber: build.BuildNumber,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ resource "coder_agent" "dev1" {
}

resource "coder_external_agent" "dev1" {
token = coder_agent.dev1.token
agent_id = coder_agent.dev1.token
}