Skip to content

Commit

Permalink
Merge pull request #941 from hashicorp/WAYP-2855-no-code-execution-mode
Browse files Browse the repository at this point in the history
[WAYP-2855] Enable execution mode option for creating no-code workspaces
  • Loading branch information
paladin-devops authored Jul 29, 2024
2 parents e95eb4f + 1e22652 commit fc3bea3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 8 additions & 1 deletion registry_no_code_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ type RegistryNoCodeModules interface {

type RegistryNoCodeModuleCreateWorkspaceOptions struct {
Type string `jsonapi:"primary,no-code-module-workspace"`
// Add more create options here

// Name is the name of the workspace, which can only include letters,
// numbers, and _. This will be used as an identifier and must be unique in
Expand All @@ -68,6 +67,14 @@ type RegistryNoCodeModuleCreateWorkspaceOptions struct {

// SourceUrl is the URL of the source of the workspace.
SourceURL *string `jsonapi:"attr,source-url,omitempty"`

// ExecutionMode is the execution mode of the workspace.
ExecutionMode *string `jsonapi:"attr,execution-mode,omitempty"`

// AgentPoolId is the ID of the agent pool to use for the workspace.
// This is required when execution mode is set to "agent".
// This must not be specified when execution mode is set to "remote".
AgentPoolID *string `jsonapi:"attr,agent-pool-id,omitempty"`
}

type RegistryNoCodeModuleUpgradeWorkspaceOptions struct {
Expand Down
8 changes: 5 additions & 3 deletions registry_no_code_module_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,10 @@ func TestRegistryNoCodeModulesCreateWorkspace(t *testing.T) {
ctx,
ncm.ID,
&RegistryNoCodeModuleCreateWorkspaceOptions{
Name: wn,
SourceName: String(sn),
SourceURL: String(su),
Name: wn,
SourceName: String(sn),
SourceURL: String(su),
ExecutionMode: String("remote"),
},
)
r.NoError(err)
Expand All @@ -371,6 +372,7 @@ func TestRegistryNoCodeModulesCreateWorkspace(t *testing.T) {
r.Equal(wn, w.Name)
r.Equal(sn, w.SourceName)
r.Equal(su, w.SourceURL)
r.Equal("remote", w.ExecutionMode)
})

t.Run("fail to create a workspace with a bad module ID", func(t *testing.T) {
Expand Down

0 comments on commit fc3bea3

Please sign in to comment.