mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
feat: improve terraform template parsing errors (#2331)
This commit is contained in:
@ -510,12 +510,14 @@ func (p *Server) runTemplateImport(ctx, shutdown context.Context, provisioner sd
|
||||
p.failActiveJobf("client disconnected")
|
||||
return
|
||||
}
|
||||
|
||||
// Parse parameters and update the job with the parameter specs
|
||||
_, err := client.UpdateJob(ctx, &proto.UpdateJobRequest{
|
||||
JobId: job.GetJobId(),
|
||||
Logs: []*proto.Log{{
|
||||
Source: proto.LogSource_PROVISIONER_DAEMON,
|
||||
Level: sdkproto.LogLevel_INFO,
|
||||
Stage: "Parse parameters",
|
||||
Stage: "Parsing template parameters",
|
||||
CreatedAt: time.Now().UTC().UnixMilli(),
|
||||
}},
|
||||
})
|
||||
@ -523,13 +525,11 @@ func (p *Server) runTemplateImport(ctx, shutdown context.Context, provisioner sd
|
||||
p.failActiveJobf("write log: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
parameterSchemas, err := p.runTemplateImportParse(ctx, provisioner, job)
|
||||
if err != nil {
|
||||
p.failActiveJobf("run parse: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
updateResponse, err := client.UpdateJob(ctx, &proto.UpdateJobRequest{
|
||||
JobId: job.JobId,
|
||||
ParameterSchemas: parameterSchemas,
|
||||
@ -551,6 +551,7 @@ func (p *Server) runTemplateImport(ctx, shutdown context.Context, provisioner sd
|
||||
}
|
||||
}
|
||||
|
||||
// Determine persistent resources
|
||||
_, err = client.UpdateJob(ctx, &proto.UpdateJobRequest{
|
||||
JobId: job.GetJobId(),
|
||||
Logs: []*proto.Log{{
|
||||
@ -572,6 +573,8 @@ func (p *Server) runTemplateImport(ctx, shutdown context.Context, provisioner sd
|
||||
p.failActiveJobf("template import provision for start: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Determine ephemeral resources.
|
||||
_, err = client.UpdateJob(ctx, &proto.UpdateJobRequest{
|
||||
JobId: job.GetJobId(),
|
||||
Logs: []*proto.Log{{
|
||||
|
Reference in New Issue
Block a user