fix: Log streaming broken with TFE local execution mode (#2364)

This commit is contained in:
Casper Biering
2022-07-12 17:53:55 +02:00
committed by GitHub
parent b650303032
commit abb9e41787
6 changed files with 19 additions and 2 deletions

View File

@@ -104,6 +104,7 @@ const (
VarFileAllowlistFlag = "var-file-allowlist"
VCSStatusName = "vcs-status-name"
TFEHostnameFlag = "tfe-hostname"
TFELocalExecutionModeFlag = "tfe-local-execution-mode"
TFETokenFlag = "tfe-token"
WriteGitCredsFlag = "write-git-creds"
WebBasicAuthFlag = "web-basic-auth"
@@ -422,6 +423,10 @@ var boolFlags = map[string]boolFlag{
description: "Skips cloning the PR repo if there are no projects were changed in the PR.",
defaultValue: false,
},
TFELocalExecutionModeFlag: {
description: "Enable if you're using local execution mode (instead of TFE/C's remote execution mode).",
defaultValue: false,
},
WebBasicAuthFlag: {
description: "Switches on or off the Basic Authentication on the HTTP Middleware interface",
defaultValue: DefaultWebBasicAuth,

View File

@@ -102,6 +102,7 @@ var testFlags = map[string]interface{}{
SSLKeyFileFlag: "key-file",
TFDownloadURLFlag: "https://my-hostname.com",
TFEHostnameFlag: "my-hostname",
TFELocalExecutionModeFlag: true,
TFETokenFlag: "my-token",
VCSStatusName: "my-status",
WriteGitCredsFlag: true,

View File

@@ -626,6 +626,12 @@ Values are chosen in this order:
If using Terraform Cloud (i.e. you don't have your own Terraform Enterprise installation)
no need to set since it defaults to `app.terraform.io`.
* ### `--tfe-local-execution-mode`
```bash
atlantis server --tfe-local-execution-mode
```
Enable if you're using local execution mode (instead of TFE/C's remote execution mode). See [Terraform Cloud](terraform-cloud.html) for more details.
* ### `--tfe-token`
```bash
atlantis server --tfe-token="xxx.atlasv1.yyy"

View File

@@ -73,6 +73,10 @@ flag to its hostname.
That's it! Atlantis should be able to perform Terraform operations using Terraform Cloud/Enterprise's
remote state backend now.
:::warning
If you're using local execution mode for your workspaces, remember to set the
`--tfe-local-execution-mode`. Otherwise you won't see the logs in Atlantis.
:::warning
The Terraform Cloud/Enterprise integration only works with the built-in
`plan` and `apply` steps. It does not work with custom `run` steps that replace

View File

@@ -351,9 +351,9 @@ func NewServer(userConfig UserConfig, config Config) (*Server, error) {
}
var projectCmdOutputHandler jobs.ProjectCommandOutputHandler
// When TFE is enabled log streaming is not necessary.
if userConfig.TFEToken != "" {
if userConfig.TFEToken != "" && !userConfig.TFELocalExecutionMode {
// When TFE is enabled and using remote execution mode log streaming is not necessary.
projectCmdOutputHandler = &jobs.NoopProjectOutputHandler{}
} else {
projectCmdOutput := make(chan *jobs.ProjectCmdOutputLine)

View File

@@ -85,6 +85,7 @@ type UserConfig struct {
SSLKeyFile string `mapstructure:"ssl-key-file"`
TFDownloadURL string `mapstructure:"tf-download-url"`
TFEHostname string `mapstructure:"tfe-hostname"`
TFELocalExecutionMode bool `mapstructure:"tfe-local-execution-mode"`
TFEToken string `mapstructure:"tfe-token"`
VarFileAllowlist string `mapstructure:"var-file-allowlist"`
VCSStatusName string `mapstructure:"vcs-status-name"`