mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: Add Terraform Provider for agent resources (#368)
* ci: Update DataDog GitHub branch to fallback to GITHUB_REF This was detecting branches, but not our "main" branch before. Hopefully this fixes it! * Add basic Terraform Provider * Rename post files to upload * Add tests for resources * Skip instance identity test * Add tests for ensuring agent get's passed through properly * Fix linting errors * Add echo path * Fix agent authentication * Update codersdk/files.go Co-authored-by: Bryan <bryan@coder.com> Co-authored-by: Bryan <bryan@coder.com>
This commit is contained in:
@@ -516,16 +516,20 @@ func (server *provisionerdServer) CompleteJob(ctx context.Context, completed *pr
|
||||
}
|
||||
// This could be a bulk insert to improve performance.
|
||||
for _, protoResource := range jobType.WorkspaceProvision.Resources {
|
||||
var instanceID sql.NullString
|
||||
if protoResource.Agent != nil && protoResource.Agent.GetGoogleInstanceIdentity() != nil {
|
||||
instanceID = sql.NullString{
|
||||
String: protoResource.Agent.GetGoogleInstanceIdentity().InstanceId,
|
||||
Valid: true,
|
||||
}
|
||||
}
|
||||
_, err = db.InsertWorkspaceResource(ctx, database.InsertWorkspaceResourceParams{
|
||||
ID: uuid.New(),
|
||||
CreatedAt: database.Now(),
|
||||
WorkspaceHistoryID: input.WorkspaceHistoryID,
|
||||
InstanceID: sql.NullString{
|
||||
Valid: protoResource.InstanceId != "",
|
||||
String: protoResource.InstanceId,
|
||||
},
|
||||
Type: protoResource.Type,
|
||||
Name: protoResource.Name,
|
||||
Type: protoResource.Type,
|
||||
Name: protoResource.Name,
|
||||
InstanceID: instanceID,
|
||||
// TODO: Generate this at the variable validation phase.
|
||||
// Set the value in `default_source`, and disallow overwrite.
|
||||
WorkspaceAgentToken: uuid.NewString(),
|
||||
|
||||
Reference in New Issue
Block a user