Skip to content

Commit 3dc1e22

Browse files
authored
feat: add template_id and template_name to workspace data source (#9655)
1 parent d171b36 commit 3dc1e22

File tree

6 files changed

+136
-117
lines changed

6 files changed

+136
-117
lines changed

coderd/provisionerdserver/provisionerdserver.go

+1
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ func (s *server) AcquireJob(ctx context.Context, _ *proto.Empty) (*proto.Acquire
378378
WorkspaceOwnerOidcAccessToken: workspaceOwnerOIDCAccessToken,
379379
WorkspaceId: workspace.ID.String(),
380380
WorkspaceOwnerId: owner.ID.String(),
381+
TemplateId: template.ID.String(),
381382
TemplateName: template.Name,
382383
TemplateVersion: templateVersion.Name,
383384
WorkspaceOwnerSessionToken: sessionToken,

coderd/provisionerdserver/provisionerdserver_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ func TestAcquireJob(t *testing.T) {
284284
WorkspaceOwnerOidcAccessToken: link.OAuthAccessToken,
285285
WorkspaceId: workspace.ID.String(),
286286
WorkspaceOwnerId: user.ID.String(),
287+
TemplateId: template.ID.String(),
287288
TemplateName: template.Name,
288289
TemplateVersion: version.Name,
289290
WorkspaceOwnerSessionToken: sessionToken,

provisioner/terraform/provision.go

+2
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ func provisionEnv(
196196
"CODER_WORKSPACE_ID="+metadata.GetWorkspaceId(),
197197
"CODER_WORKSPACE_OWNER_ID="+metadata.GetWorkspaceOwnerId(),
198198
"CODER_WORKSPACE_OWNER_SESSION_TOKEN="+metadata.GetWorkspaceOwnerSessionToken(),
199+
"CODER_WORKSPACE_TEMPLATE_ID="+metadata.GetTemplateId(),
200+
"CODER_WORKSPACE_TEMPLATE_NAME="+metadata.GetTemplateName(),
199201
)
200202
for key, value := range provisionersdk.AgentScriptEnv() {
201203
env = append(env, key+"="+value)

0 commit comments

Comments
 (0)