Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add flags that will be used for terraformadmin mode #725

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 15 additions & 0 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ const (
LyftModeFlag = "lyft-mode"
LyftWorkerQueueURLFlag = "lyft-worker-queue-url"

RepoNameForTerraformAdminFlag = "repo-name-for-terraform-admin-flag"
RootNameForTerraformAdminFlag = "root-name-for-terraform-admin-flag"
RevisionForTerraformAdminFlag = "revision-for-terraform-admin-flag"
// NOTE: Must manually set these as defaults in the setDefaults function.
DefaultADBasicUser = ""
DefaultADBasicPassword = ""
Expand Down Expand Up @@ -238,6 +241,18 @@ var stringFlags = map[string]stringFlag{
description: "Provide queue of AWS SQS queue for atlantis work to pull GH events from and process.",
defaultValue: "",
},
RepoNameForTerraformAdminFlag: {
description: "The repo name is necessary when running in terraform admin mode so that we know which repo to clone",
defaultValue: "",
},
RootNameForTerraformAdminFlag: {
description: "The root name is necessary when running in terraform admin mode so that we know which root to run ops on",
defaultValue: "",
},
RevisionForTerraformAdminFlag: {
description: "The revision is necessary when running in terraform admin mode so that we know which revision to run ops on",
defaultValue: "",
},
}

var boolFlags = map[string]boolFlag{
Expand Down
7 changes: 7 additions & 0 deletions server/legacy/user_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const (
Gateway
Worker
TemporalWorker
TerraformAdmin
)

// UserConfig holds config values passed in by the user.
Expand Down Expand Up @@ -75,6 +76,10 @@ type UserConfig struct {

// Supports adding a default URL to the checkrun UI when details URL is not set
DefaultCheckrunDetailsURL string `mapstructure:"default-checkrun-details-url"`

RepoNameForTerraformAdminFlag string `mapstructure:"repo-name-for-terraform-admin-flag"`
RootNameForTerraformAdminFlag string `mapstructure:"root-name-for-terraform-admin-flag"`
RevisionForTerraformAdminFlag string `mapstructure:"revision-for-terraform-admin-flag"`
}

// ToLogLevel returns the LogLevel object corresponding to the user-passed
Expand Down Expand Up @@ -104,6 +109,8 @@ func (u UserConfig) ToLyftMode() Mode {
return Worker
case "temporalworker":
return TemporalWorker
case "terraformadmin":
return TerraformAdmin
}
return Default
}
4 changes: 4 additions & 0 deletions server/legacy/user_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ func TestUserConfig_ToLyftMode(t *testing.T) {
userMode string
expMode server.Mode
}{
{
"terraformadmin",
server.TerraformAdmin,
},
{
"default",
server.Default,
Expand Down
Loading