diff --git a/.circleci/config.yml b/.circleci/config.yml index 117e912e45..545380aa64 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,7 +17,11 @@ jobs: docker: - image: circleci/golang:1.12 environment: - TERRAFORM_VERSION: 0.11.13 + # This version of TF will be downloaded before Atlantis is started. + # We do this instead of setting --default-tf-version because setting + # that flag starts the download asynchronously so we'd have a race + # condition. + TERRAFORM_VERSION: 0.12.0 steps: - checkout - run: make build-service diff --git a/Dockerfile b/Dockerfile index 52b7dc3776..82fea53069 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM runatlantis/atlantis-base:v3.0 LABEL authors="Anubhav Mishra, Luke Kysow" # install terraform binaries -ENV DEFAULT_TERRAFORM_VERSION=0.11.13 +ENV DEFAULT_TERRAFORM_VERSION=0.12.0 # In the official Atlantis image we only have the latest of each Terrafrom version. RUN AVAILABLE_TERRAFORM_VERSIONS="0.8.8 0.9.11 0.10.8 ${DEFAULT_TERRAFORM_VERSION}" && \ diff --git a/scripts/e2e.sh b/scripts/e2e.sh index 10ef895638..8e48ee783d 100755 --- a/scripts/e2e.sh +++ b/scripts/e2e.sh @@ -8,7 +8,13 @@ ${CIRCLE_WORKING_DIRECTORY}/scripts/e2e-deps.sh cd "${CIRCLE_WORKING_DIRECTORY}/e2e" # start atlantis server in the background and wait for it to start -./atlantis server --gh-user="$GITHUB_USERNAME" --gh-token="$GITHUB_PASSWORD" --data-dir="/tmp" --log-level="debug" --repo-whitelist="github.com/runatlantis/atlantis-tests" --allow-repo-config &> /tmp/atlantis-server.log & +./atlantis server \ + --gh-user="$GITHUB_USERNAME" \ + --gh-token="$GITHUB_PASSWORD" \ + --data-dir="/tmp" \ + --log-level="debug" \ + --repo-whitelist="github.com/runatlantis/atlantis-tests" \ + --allow-repo-config &> /tmp/atlantis-server.log & sleep 2 # start ngrok in the background and wait for it to start diff --git a/server/events/terraform/terraform_client_test.go b/server/events/terraform/terraform_client_test.go index a4ccc45dc8..b532163767 100644 --- a/server/events/terraform/terraform_client_test.go +++ b/server/events/terraform/terraform_client_test.go @@ -218,14 +218,14 @@ func TestRunCommandWithVersion_DLsTF(t *testing.T) { mockDownloader := mocks.NewMockDownloader() // Set up our mock downloader to write a fake tf binary when it's called. - baseURL := "https://releases.hashicorp.com/terraform/0.12.0" - expURL := fmt.Sprintf("%s/terraform_0.12.0_%s_%s.zip?checksum=file:%s/terraform_0.12.0_SHA256SUMS", + baseURL := "https://releases.hashicorp.com/terraform/99.99.99" + expURL := fmt.Sprintf("%s/terraform_99.99.99_%s_%s.zip?checksum=file:%s/terraform_99.99.99_SHA256SUMS", baseURL, runtime.GOOS, runtime.GOARCH, baseURL) - When(mockDownloader.GetFile(filepath.Join(tmp, "bin", "terraform0.12.0"), expURL)).Then(func(params []pegomock.Param) pegomock.ReturnValues { - err := ioutil.WriteFile(params[0].(string), []byte("#!/bin/sh\necho '\nTerraform v0.12.0\n'"), 0755) + When(mockDownloader.GetFile(filepath.Join(tmp, "bin", "terraform99.99.99"), expURL)).Then(func(params []pegomock.Param) pegomock.ReturnValues { + err := ioutil.WriteFile(params[0].(string), []byte("#!/bin/sh\necho '\nTerraform v99.99.99\n'"), 0755) return []pegomock.ReturnValue{err} }) @@ -233,11 +233,11 @@ func TestRunCommandWithVersion_DLsTF(t *testing.T) { Ok(t, err) Equals(t, "0.11.10", c.DefaultVersion().String()) - v, err := version.NewVersion("0.12.0") + v, err := version.NewVersion("99.99.99") Ok(t, err) output, err := c.RunCommandWithVersion(nil, tmp, nil, v, "") Assert(t, err == nil, "err: %s: %s", err, output) - Equals(t, "\nTerraform v0.12.0\n\n", output) + Equals(t, "\nTerraform v99.99.99\n\n", output) } // tempSetEnv sets env var key to value. It returns a function that when called diff --git a/server/events_controller_e2e_test.go b/server/events_controller_e2e_test.go index f7e38d5216..7fc732b96c 100644 --- a/server/events_controller_e2e_test.go +++ b/server/events_controller_e2e_test.go @@ -13,14 +13,13 @@ import ( "strings" "testing" - getter "github.com/hashicorp/go-getter" - "github.com/runatlantis/atlantis/server/events/db" - "github.com/runatlantis/atlantis/server/events/yaml/valid" - "github.com/google/go-github/github" + "github.com/hashicorp/go-getter" + "github.com/hashicorp/go-version" . "github.com/petergtz/pegomock" "github.com/runatlantis/atlantis/server" "github.com/runatlantis/atlantis/server/events" + "github.com/runatlantis/atlantis/server/events/db" "github.com/runatlantis/atlantis/server/events/locking" "github.com/runatlantis/atlantis/server/events/mocks" "github.com/runatlantis/atlantis/server/events/mocks/matchers" @@ -30,6 +29,7 @@ import ( vcsmocks "github.com/runatlantis/atlantis/server/events/vcs/mocks" "github.com/runatlantis/atlantis/server/events/webhooks" "github.com/runatlantis/atlantis/server/events/yaml" + "github.com/runatlantis/atlantis/server/events/yaml/valid" "github.com/runatlantis/atlantis/server/logging" . "github.com/runatlantis/atlantis/testing" ) @@ -44,6 +44,9 @@ func TestGitHubWorkflow(t *testing.T) { if testing.Short() { t.SkipNow() } + // Ensure we have >= TF 0.12 locally. + ensureRunning012(t) + cases := []struct { Description string // RepoDir is relative to testfixtures/test-repos. @@ -617,15 +620,15 @@ func assertCommentEquals(t *testing.T, expFile string, act string, repoDir strin exp, err := ioutil.ReadFile(filepath.Join(absRepoPath(t, repoDir), expFile)) Ok(t, err) - // Replace all 'Creation complete after 1s ID: 1111818181' strings with - // 'Creation complete after *s ID: **********' so we can do a comparison. - idRegex := regexp.MustCompile(`Creation complete after [0-9]+s \(ID: [0-9]+\)`) - act = idRegex.ReplaceAllString(act, "Creation complete after *s (ID: ******************)") + // Replace all 'Creation complete after 0s [id=2135833172528078362]' strings with + // 'Creation complete after *s [id=*******************]' so we can do a comparison. + idRegex := regexp.MustCompile(`Creation complete after [0-9]+s \[id=[0-9]+]`) + act = idRegex.ReplaceAllString(act, "Creation complete after *s [id=*******************]") // Replace all null_resource.simple{n}: .* with null_resource.simple: because // with multiple resources being created the logs are all out of order which // makes comparison impossible. - resourceRegex := regexp.MustCompile(`null_resource\.simple\d?:.*`) + resourceRegex := regexp.MustCompile(`null_resource\.simple(\[\d])?\d?:.*`) act = resourceRegex.ReplaceAllString(act, "null_resource.simple:") expStr := string(exp) @@ -654,3 +657,39 @@ func assertCommentEquals(t *testing.T, expFile string, act string, repoDir strin } } } + +// Will fail test if terraform isn't in path and isn't version >= 0.12 +func ensureRunning012(t *testing.T) { + localPath, err := exec.LookPath("terraform") + if err != nil { + t.Log("terraform >= 0.12 must be installed to run this test") + t.FailNow() + } + versionOutBytes, err := exec.Command(localPath, "version").Output() // #nosec + if err != nil { + t.Logf("error running terraform version: %s", err) + t.FailNow() + } + versionOutput := string(versionOutBytes) + match := versionRegex.FindStringSubmatch(versionOutput) + if len(match) <= 1 { + t.Logf("could not parse terraform version from %s", versionOutput) + t.FailNow() + } + localVersion, err := version.NewVersion(match[1]) + Ok(t, err) + minVersion, err := version.NewVersion("0.12.0") + Ok(t, err) + if localVersion.LessThan(minVersion) { + t.Logf("must have terraform version >= %s, you have %s", minVersion, localVersion) + t.FailNow() + } +} + +// versionRegex extracts the version from `terraform version` output. +// Terraform v0.12.0-alpha4 (2c36829d3265661d8edbd5014de8090ea7e2a076) +// => 0.12.0-alpha4 +// +// Terraform v0.11.10 +// => 0.11.10 +var versionRegex = regexp.MustCompile("Terraform v(.*?)(\\s.*)?\n") diff --git a/server/testfixtures/test-repos/automerge/exp-output-apply-dir1.txt b/server/testfixtures/test-repos/automerge/exp-output-apply-dir1.txt index c24e6b347d..bae9bd1d09 100644 --- a/server/testfixtures/test-repos/automerge/exp-output-apply-dir1.txt +++ b/server/testfixtures/test-repos/automerge/exp-output-apply-dir1.txt @@ -1,10 +1,17 @@ Ran Apply for dir: `dir1` workspace: `default` ```diff -null_resource.automerge: Creating... -null_resource.automerge: Creation complete after *s (ID: ******************) +null_resource.automerge[0]: Creating... +null_resource.automerge[0]: Creation complete after *s [id=*******************] Apply complete! Resources: 1 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + ``` diff --git a/server/testfixtures/test-repos/automerge/exp-output-apply-dir2.txt b/server/testfixtures/test-repos/automerge/exp-output-apply-dir2.txt index ced332d51c..d6039490dc 100644 --- a/server/testfixtures/test-repos/automerge/exp-output-apply-dir2.txt +++ b/server/testfixtures/test-repos/automerge/exp-output-apply-dir2.txt @@ -1,10 +1,17 @@ Ran Apply for dir: `dir2` workspace: `default` ```diff -null_resource.automerge: Creating... -null_resource.automerge: Creation complete after *s (ID: ******************) +null_resource.automerge[0]: Creating... +null_resource.automerge[0]: Creation complete after *s [id=*******************] Apply complete! Resources: 1 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + ``` diff --git a/server/testfixtures/test-repos/automerge/exp-output-autoplan.txt b/server/testfixtures/test-repos/automerge/exp-output-autoplan.txt index 70ff3a5ba8..5c0f9fe035 100644 --- a/server/testfixtures/test-repos/automerge/exp-output-autoplan.txt +++ b/server/testfixtures/test-repos/automerge/exp-output-autoplan.txt @@ -4,6 +4,8 @@ Ran Plan for 2 projects: 1. dir: `dir2` workspace: `default` ### 1. dir: `dir1` workspace: `default` +
Show Output + ```diff An execution plan has been generated and is shown below. @@ -12,8 +14,11 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ null_resource.automerge - id: + # null_resource.automerge[0] will be created ++ resource "null_resource" "automerge" { + + id = (known after apply) + } + Plan: 1 to add, 0 to change, 0 to destroy. ``` @@ -23,9 +28,12 @@ Plan: 1 to add, 0 to change, 0 to destroy. * :put_litter_in_its_place: To **delete** this plan click [here](lock-url) * :repeat: To **plan** this project again, comment: * `atlantis plan -d dir1` +
--- ### 2. dir: `dir2` workspace: `default` +
Show Output + ```diff An execution plan has been generated and is shown below. @@ -34,8 +42,11 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ null_resource.automerge - id: + # null_resource.automerge[0] will be created ++ resource "null_resource" "automerge" { + + id = (known after apply) + } + Plan: 1 to add, 0 to change, 0 to destroy. ``` @@ -45,6 +56,7 @@ Plan: 1 to add, 0 to change, 0 to destroy. * :put_litter_in_its_place: To **delete** this plan click [here](lock-url) * :repeat: To **plan** this project again, comment: * `atlantis plan -d dir2` +
--- * :fast_forward: To **apply** all unapplied plans from this pull request, comment: diff --git a/server/testfixtures/test-repos/modules-yaml/exp-output-apply-production.txt b/server/testfixtures/test-repos/modules-yaml/exp-output-apply-production.txt index a6aee0e769..74ef084b01 100644 --- a/server/testfixtures/test-repos/modules-yaml/exp-output-apply-production.txt +++ b/server/testfixtures/test-repos/modules-yaml/exp-output-apply-production.txt @@ -1,14 +1,24 @@ Ran Apply for dir: `production` workspace: `default` +
Show Output + ```diff module.null.null_resource.this: Creating... -module.null.null_resource.this: Creation complete after *s (ID: ******************) +module.null.null_resource.this: Creation complete after *s [id=*******************] Apply complete! Resources: 1 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + Outputs: var = production ``` +
diff --git a/server/testfixtures/test-repos/modules-yaml/exp-output-apply-staging.txt b/server/testfixtures/test-repos/modules-yaml/exp-output-apply-staging.txt index 4d98c17f95..da1897d5a6 100644 --- a/server/testfixtures/test-repos/modules-yaml/exp-output-apply-staging.txt +++ b/server/testfixtures/test-repos/modules-yaml/exp-output-apply-staging.txt @@ -1,14 +1,24 @@ Ran Apply for dir: `staging` workspace: `default` +
Show Output + ```diff module.null.null_resource.this: Creating... -module.null.null_resource.this: Creation complete after *s (ID: ******************) +module.null.null_resource.this: Creation complete after *s [id=*******************] Apply complete! Resources: 1 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + Outputs: var = staging ``` +
diff --git a/server/testfixtures/test-repos/modules-yaml/exp-output-autoplan.txt b/server/testfixtures/test-repos/modules-yaml/exp-output-autoplan.txt index 2f739dfb13..9f0f0df8bd 100644 --- a/server/testfixtures/test-repos/modules-yaml/exp-output-autoplan.txt +++ b/server/testfixtures/test-repos/modules-yaml/exp-output-autoplan.txt @@ -4,6 +4,8 @@ Ran Plan for 2 projects: 1. dir: `production` workspace: `default` ### 1. dir: `staging` workspace: `default` +
Show Output + ```diff An execution plan has been generated and is shown below. @@ -12,8 +14,11 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ module.null.null_resource.this - id: + # module.null.null_resource.this will be created ++ resource "null_resource" "this" { + + id = (known after apply) + } + Plan: 1 to add, 0 to change, 0 to destroy. ``` @@ -23,9 +28,12 @@ Plan: 1 to add, 0 to change, 0 to destroy. * :put_litter_in_its_place: To **delete** this plan click [here](lock-url) * :repeat: To **plan** this project again, comment: * `atlantis plan -d staging` +
--- ### 2. dir: `production` workspace: `default` +
Show Output + ```diff An execution plan has been generated and is shown below. @@ -34,8 +42,11 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ module.null.null_resource.this - id: + # module.null.null_resource.this will be created ++ resource "null_resource" "this" { + + id = (known after apply) + } + Plan: 1 to add, 0 to change, 0 to destroy. ``` @@ -45,6 +56,7 @@ Plan: 1 to add, 0 to change, 0 to destroy. * :put_litter_in_its_place: To **delete** this plan click [here](lock-url) * :repeat: To **plan** this project again, comment: * `atlantis plan -d production` +
--- * :fast_forward: To **apply** all unapplied plans from this pull request, comment: diff --git a/server/testfixtures/test-repos/modules/exp-output-apply-production.txt b/server/testfixtures/test-repos/modules/exp-output-apply-production.txt index a6aee0e769..74ef084b01 100644 --- a/server/testfixtures/test-repos/modules/exp-output-apply-production.txt +++ b/server/testfixtures/test-repos/modules/exp-output-apply-production.txt @@ -1,14 +1,24 @@ Ran Apply for dir: `production` workspace: `default` +
Show Output + ```diff module.null.null_resource.this: Creating... -module.null.null_resource.this: Creation complete after *s (ID: ******************) +module.null.null_resource.this: Creation complete after *s [id=*******************] Apply complete! Resources: 1 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + Outputs: var = production ``` +
diff --git a/server/testfixtures/test-repos/modules/exp-output-apply-staging.txt b/server/testfixtures/test-repos/modules/exp-output-apply-staging.txt index 4d98c17f95..da1897d5a6 100644 --- a/server/testfixtures/test-repos/modules/exp-output-apply-staging.txt +++ b/server/testfixtures/test-repos/modules/exp-output-apply-staging.txt @@ -1,14 +1,24 @@ Ran Apply for dir: `staging` workspace: `default` +
Show Output + ```diff module.null.null_resource.this: Creating... -module.null.null_resource.this: Creation complete after *s (ID: ******************) +module.null.null_resource.this: Creation complete after *s [id=*******************] Apply complete! Resources: 1 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + Outputs: var = staging ``` +
diff --git a/server/testfixtures/test-repos/modules/exp-output-autoplan-only-staging.txt b/server/testfixtures/test-repos/modules/exp-output-autoplan-only-staging.txt index e5bd5103d6..5d53aae696 100644 --- a/server/testfixtures/test-repos/modules/exp-output-autoplan-only-staging.txt +++ b/server/testfixtures/test-repos/modules/exp-output-autoplan-only-staging.txt @@ -1,5 +1,7 @@ Ran Plan for dir: `staging` workspace: `default` +
Show Output + ```diff An execution plan has been generated and is shown below. @@ -8,8 +10,11 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ module.null.null_resource.this - id: + # module.null.null_resource.this will be created ++ resource "null_resource" "this" { + + id = (known after apply) + } + Plan: 1 to add, 0 to change, 0 to destroy. ``` @@ -19,6 +24,7 @@ Plan: 1 to add, 0 to change, 0 to destroy. * :put_litter_in_its_place: To **delete** this plan click [here](lock-url) * :repeat: To **plan** this project again, comment: * `atlantis plan -d staging` +
--- * :fast_forward: To **apply** all unapplied plans from this pull request, comment: diff --git a/server/testfixtures/test-repos/modules/exp-output-plan-production.txt b/server/testfixtures/test-repos/modules/exp-output-plan-production.txt index 0731962ff7..41847cb335 100644 --- a/server/testfixtures/test-repos/modules/exp-output-plan-production.txt +++ b/server/testfixtures/test-repos/modules/exp-output-plan-production.txt @@ -1,5 +1,7 @@ Ran Plan for dir: `production` workspace: `default` +
Show Output + ```diff An execution plan has been generated and is shown below. @@ -8,8 +10,11 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ module.null.null_resource.this - id: + # module.null.null_resource.this will be created ++ resource "null_resource" "this" { + + id = (known after apply) + } + Plan: 1 to add, 0 to change, 0 to destroy. ``` @@ -19,6 +24,7 @@ Plan: 1 to add, 0 to change, 0 to destroy. * :put_litter_in_its_place: To **delete** this plan click [here](lock-url) * :repeat: To **plan** this project again, comment: * `atlantis plan -d production` +
--- * :fast_forward: To **apply** all unapplied plans from this pull request, comment: diff --git a/server/testfixtures/test-repos/modules/exp-output-plan-staging.txt b/server/testfixtures/test-repos/modules/exp-output-plan-staging.txt index e5bd5103d6..5d53aae696 100644 --- a/server/testfixtures/test-repos/modules/exp-output-plan-staging.txt +++ b/server/testfixtures/test-repos/modules/exp-output-plan-staging.txt @@ -1,5 +1,7 @@ Ran Plan for dir: `staging` workspace: `default` +
Show Output + ```diff An execution plan has been generated and is shown below. @@ -8,8 +10,11 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ module.null.null_resource.this - id: + # module.null.null_resource.this will be created ++ resource "null_resource" "this" { + + id = (known after apply) + } + Plan: 1 to add, 0 to change, 0 to destroy. ``` @@ -19,6 +24,7 @@ Plan: 1 to add, 0 to change, 0 to destroy. * :put_litter_in_its_place: To **delete** this plan click [here](lock-url) * :repeat: To **plan** this project again, comment: * `atlantis plan -d staging` +
--- * :fast_forward: To **apply** all unapplied plans from this pull request, comment: diff --git a/server/testfixtures/test-repos/server-side-cfg/exp-output-apply-default-workspace.txt b/server/testfixtures/test-repos/server-side-cfg/exp-output-apply-default-workspace.txt index b78638daf0..dc6833899e 100644 --- a/server/testfixtures/test-repos/server-side-cfg/exp-output-apply-default-workspace.txt +++ b/server/testfixtures/test-repos/server-side-cfg/exp-output-apply-default-workspace.txt @@ -1,14 +1,24 @@ Ran Apply for dir: `.` workspace: `default` +
Show Output + ```diff null_resource.simple: null_resource.simple: Apply complete! Resources: 1 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + Outputs: workspace = default ``` +
diff --git a/server/testfixtures/test-repos/server-side-cfg/exp-output-apply-staging-workspace.txt b/server/testfixtures/test-repos/server-side-cfg/exp-output-apply-staging-workspace.txt index af43f3e28e..4df252bfcb 100644 --- a/server/testfixtures/test-repos/server-side-cfg/exp-output-apply-staging-workspace.txt +++ b/server/testfixtures/test-repos/server-side-cfg/exp-output-apply-staging-workspace.txt @@ -1,14 +1,24 @@ Ran Apply for dir: `.` workspace: `staging` +
Show Output + ```diff null_resource.simple: null_resource.simple: Apply complete! Resources: 1 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + Outputs: workspace = staging ``` +
diff --git a/server/testfixtures/test-repos/server-side-cfg/exp-output-autoplan.txt b/server/testfixtures/test-repos/server-side-cfg/exp-output-autoplan.txt index 73e701a5f3..7ce9f84f69 100644 --- a/server/testfixtures/test-repos/server-side-cfg/exp-output-autoplan.txt +++ b/server/testfixtures/test-repos/server-side-cfg/exp-output-autoplan.txt @@ -16,8 +16,11 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ null_resource.simple - id: + # null_resource.simple[0] will be created ++ resource "null_resource" "simple" { + + id = (known after apply) + } + Plan: 1 to add, 0 to change, 0 to destroy. postplan custom @@ -33,6 +36,8 @@ postplan custom --- ### 2. dir: `.` workspace: `staging` +
Show Output + ```diff preinit staging @@ -43,8 +48,11 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ null_resource.simple - id: + # null_resource.simple[0] will be created ++ resource "null_resource" "simple" { + + id = (known after apply) + } + Plan: 1 to add, 0 to change, 0 to destroy. ``` @@ -54,6 +62,7 @@ Plan: 1 to add, 0 to change, 0 to destroy. * :put_litter_in_its_place: To **delete** this plan click [here](lock-url) * :repeat: To **plan** this project again, comment: * `atlantis plan -w staging` +
--- * :fast_forward: To **apply** all unapplied plans from this pull request, comment: diff --git a/server/testfixtures/test-repos/simple-yaml/exp-output-apply-all.txt b/server/testfixtures/test-repos/simple-yaml/exp-output-apply-all.txt index c144599164..04650e8e2d 100644 --- a/server/testfixtures/test-repos/simple-yaml/exp-output-apply-all.txt +++ b/server/testfixtures/test-repos/simple-yaml/exp-output-apply-all.txt @@ -4,18 +4,28 @@ Ran Apply for 2 projects: 1. dir: `.` workspace: `staging` ### 1. dir: `.` workspace: `default` +
Show Output + ```diff null_resource.simple: null_resource.simple: Apply complete! Resources: 1 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + Outputs: var = fromconfig workspace = default ``` +
--- ### 2. dir: `.` workspace: `staging` @@ -29,6 +39,13 @@ null_resource.simple: Apply complete! Resources: 1 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + Outputs: var = fromfile diff --git a/server/testfixtures/test-repos/simple-yaml/exp-output-apply-default.txt b/server/testfixtures/test-repos/simple-yaml/exp-output-apply-default.txt index 0bb8ea3c5e..b1cf7d000b 100644 --- a/server/testfixtures/test-repos/simple-yaml/exp-output-apply-default.txt +++ b/server/testfixtures/test-repos/simple-yaml/exp-output-apply-default.txt @@ -1,15 +1,25 @@ Ran Apply for dir: `.` workspace: `default` +
Show Output + ```diff null_resource.simple: null_resource.simple: Apply complete! Resources: 1 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + Outputs: var = fromconfig workspace = default ``` +
diff --git a/server/testfixtures/test-repos/simple-yaml/exp-output-apply-staging.txt b/server/testfixtures/test-repos/simple-yaml/exp-output-apply-staging.txt index 6724319de6..e95937a713 100644 --- a/server/testfixtures/test-repos/simple-yaml/exp-output-apply-staging.txt +++ b/server/testfixtures/test-repos/simple-yaml/exp-output-apply-staging.txt @@ -10,6 +10,13 @@ null_resource.simple: Apply complete! Resources: 1 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + Outputs: var = fromfile diff --git a/server/testfixtures/test-repos/simple-yaml/exp-output-autoplan.txt b/server/testfixtures/test-repos/simple-yaml/exp-output-autoplan.txt index 3fff439369..f7a80a450d 100644 --- a/server/testfixtures/test-repos/simple-yaml/exp-output-autoplan.txt +++ b/server/testfixtures/test-repos/simple-yaml/exp-output-autoplan.txt @@ -16,8 +16,11 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ null_resource.simple - id: + # null_resource.simple[0] will be created ++ resource "null_resource" "simple" { + + id = (known after apply) + } + Plan: 1 to add, 0 to change, 0 to destroy. postplan @@ -33,6 +36,8 @@ postplan --- ### 2. dir: `.` workspace: `staging` +
Show Output + ```diff An execution plan has been generated and is shown below. @@ -41,8 +46,11 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ null_resource.simple - id: + # null_resource.simple[0] will be created ++ resource "null_resource" "simple" { + + id = (known after apply) + } + Plan: 1 to add, 0 to change, 0 to destroy. ``` @@ -52,6 +60,7 @@ Plan: 1 to add, 0 to change, 0 to destroy. * :put_litter_in_its_place: To **delete** this plan click [here](lock-url) * :repeat: To **plan** this project again, comment: * `atlantis plan -w staging` +
--- * :fast_forward: To **apply** all unapplied plans from this pull request, comment: diff --git a/server/testfixtures/test-repos/simple/exp-output-apply-var-all.txt b/server/testfixtures/test-repos/simple/exp-output-apply-var-all.txt index 5abaf0d5a2..3f7608772d 100644 --- a/server/testfixtures/test-repos/simple/exp-output-apply-var-all.txt +++ b/server/testfixtures/test-repos/simple/exp-output-apply-var-all.txt @@ -16,6 +16,13 @@ null_resource.simple: Apply complete! Resources: 3 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + Outputs: var = default_workspace @@ -38,6 +45,13 @@ null_resource.simple: Apply complete! Resources: 3 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + Outputs: var = new_workspace diff --git a/server/testfixtures/test-repos/simple/exp-output-apply-var-default-workspace.txt b/server/testfixtures/test-repos/simple/exp-output-apply-var-default-workspace.txt index 826036aca5..a6e2b9cc49 100644 --- a/server/testfixtures/test-repos/simple/exp-output-apply-var-default-workspace.txt +++ b/server/testfixtures/test-repos/simple/exp-output-apply-var-default-workspace.txt @@ -12,6 +12,13 @@ null_resource.simple: Apply complete! Resources: 3 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + Outputs: var = default_workspace diff --git a/server/testfixtures/test-repos/simple/exp-output-apply-var-new-workspace.txt b/server/testfixtures/test-repos/simple/exp-output-apply-var-new-workspace.txt index e1048ce5ed..131f651bc2 100644 --- a/server/testfixtures/test-repos/simple/exp-output-apply-var-new-workspace.txt +++ b/server/testfixtures/test-repos/simple/exp-output-apply-var-new-workspace.txt @@ -12,6 +12,13 @@ null_resource.simple: Apply complete! Resources: 3 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + Outputs: var = new_workspace diff --git a/server/testfixtures/test-repos/simple/exp-output-apply-var.txt b/server/testfixtures/test-repos/simple/exp-output-apply-var.txt index 30752a67bc..1d62accca9 100644 --- a/server/testfixtures/test-repos/simple/exp-output-apply-var.txt +++ b/server/testfixtures/test-repos/simple/exp-output-apply-var.txt @@ -12,6 +12,13 @@ null_resource.simple: Apply complete! Resources: 3 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + Outputs: var = overridden diff --git a/server/testfixtures/test-repos/simple/exp-output-apply.txt b/server/testfixtures/test-repos/simple/exp-output-apply.txt index da5671e1c7..88c40e056d 100644 --- a/server/testfixtures/test-repos/simple/exp-output-apply.txt +++ b/server/testfixtures/test-repos/simple/exp-output-apply.txt @@ -12,6 +12,13 @@ null_resource.simple: Apply complete! Resources: 3 added, 0 changed, 0 destroyed. +The state of your infrastructure has been saved to the path +below. This state is required to modify and destroy your +infrastructure, so keep it safe. To inspect the complete state +use the `terraform show` command. + +State path: terraform.tfstate + Outputs: var = default diff --git a/server/testfixtures/test-repos/simple/exp-output-atlantis-plan-new-workspace.txt b/server/testfixtures/test-repos/simple/exp-output-atlantis-plan-new-workspace.txt index 85ed283bba..aceca399c2 100644 --- a/server/testfixtures/test-repos/simple/exp-output-atlantis-plan-new-workspace.txt +++ b/server/testfixtures/test-repos/simple/exp-output-atlantis-plan-new-workspace.txt @@ -10,14 +10,21 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ null_resource.simple - id: + # null_resource.simple[0] will be created ++ resource "null_resource" "simple" { + + id = (known after apply) + } -+ null_resource.simple2 - id: + # null_resource.simple2 will be created ++ resource "null_resource" "simple2" { + + id = (known after apply) + } + + # null_resource.simple3 will be created ++ resource "null_resource" "simple3" { + + id = (known after apply) + } -+ null_resource.simple3 - id: Plan: 3 to add, 0 to change, 0 to destroy. ``` diff --git a/server/testfixtures/test-repos/simple/exp-output-atlantis-plan-var-overridden.txt b/server/testfixtures/test-repos/simple/exp-output-atlantis-plan-var-overridden.txt index 73862ca01c..09aaabba6a 100644 --- a/server/testfixtures/test-repos/simple/exp-output-atlantis-plan-var-overridden.txt +++ b/server/testfixtures/test-repos/simple/exp-output-atlantis-plan-var-overridden.txt @@ -10,14 +10,21 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ null_resource.simple - id: + # null_resource.simple[0] will be created ++ resource "null_resource" "simple" { + + id = (known after apply) + } -+ null_resource.simple2 - id: + # null_resource.simple2 will be created ++ resource "null_resource" "simple2" { + + id = (known after apply) + } + + # null_resource.simple3 will be created ++ resource "null_resource" "simple3" { + + id = (known after apply) + } -+ null_resource.simple3 - id: Plan: 3 to add, 0 to change, 0 to destroy. ``` diff --git a/server/testfixtures/test-repos/simple/exp-output-atlantis-plan.txt b/server/testfixtures/test-repos/simple/exp-output-atlantis-plan.txt index 29e86fb150..d51f44ff8e 100644 --- a/server/testfixtures/test-repos/simple/exp-output-atlantis-plan.txt +++ b/server/testfixtures/test-repos/simple/exp-output-atlantis-plan.txt @@ -10,14 +10,21 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ null_resource.simple - id: + # null_resource.simple[0] will be created ++ resource "null_resource" "simple" { + + id = (known after apply) + } -+ null_resource.simple2 - id: + # null_resource.simple2 will be created ++ resource "null_resource" "simple2" { + + id = (known after apply) + } + + # null_resource.simple3 will be created ++ resource "null_resource" "simple3" { + + id = (known after apply) + } -+ null_resource.simple3 - id: Plan: 3 to add, 0 to change, 0 to destroy. ``` diff --git a/server/testfixtures/test-repos/simple/exp-output-autoplan.txt b/server/testfixtures/test-repos/simple/exp-output-autoplan.txt index f44ade708a..d20e62e185 100644 --- a/server/testfixtures/test-repos/simple/exp-output-autoplan.txt +++ b/server/testfixtures/test-repos/simple/exp-output-autoplan.txt @@ -10,14 +10,21 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ null_resource.simple - id: + # null_resource.simple[0] will be created ++ resource "null_resource" "simple" { + + id = (known after apply) + } -+ null_resource.simple2 - id: + # null_resource.simple2 will be created ++ resource "null_resource" "simple2" { + + id = (known after apply) + } + + # null_resource.simple3 will be created ++ resource "null_resource" "simple3" { + + id = (known after apply) + } -+ null_resource.simple3 - id: Plan: 3 to add, 0 to change, 0 to destroy. ``` diff --git a/server/testfixtures/test-repos/tfvars-yaml-no-autoplan/exp-output-plan-default.txt b/server/testfixtures/test-repos/tfvars-yaml-no-autoplan/exp-output-plan-default.txt index f308a1aa11..7a33d16436 100644 --- a/server/testfixtures/test-repos/tfvars-yaml-no-autoplan/exp-output-plan-default.txt +++ b/server/testfixtures/test-repos/tfvars-yaml-no-autoplan/exp-output-plan-default.txt @@ -1,5 +1,7 @@ Ran Plan for project: `default` dir: `.` workspace: `default` +
Show Output + ```diff An execution plan has been generated and is shown below. @@ -8,8 +10,11 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ null_resource.simple - id: + # null_resource.simple[0] will be created ++ resource "null_resource" "simple" { + + id = (known after apply) + } + Plan: 1 to add, 0 to change, 0 to destroy. ``` @@ -19,6 +24,7 @@ Plan: 1 to add, 0 to change, 0 to destroy. * :put_litter_in_its_place: To **delete** this plan click [here](lock-url) * :repeat: To **plan** this project again, comment: * `atlantis plan -p default` +
--- * :fast_forward: To **apply** all unapplied plans from this pull request, comment: diff --git a/server/testfixtures/test-repos/tfvars-yaml-no-autoplan/exp-output-plan-staging.txt b/server/testfixtures/test-repos/tfvars-yaml-no-autoplan/exp-output-plan-staging.txt index b50326c4aa..b3cb4f5059 100644 --- a/server/testfixtures/test-repos/tfvars-yaml-no-autoplan/exp-output-plan-staging.txt +++ b/server/testfixtures/test-repos/tfvars-yaml-no-autoplan/exp-output-plan-staging.txt @@ -1,5 +1,7 @@ Ran Plan for project: `staging` dir: `.` workspace: `default` +
Show Output + ```diff An execution plan has been generated and is shown below. @@ -8,8 +10,11 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ null_resource.simple - id: + # null_resource.simple[0] will be created ++ resource "null_resource" "simple" { + + id = (known after apply) + } + Plan: 1 to add, 0 to change, 0 to destroy. ``` @@ -19,6 +24,7 @@ Plan: 1 to add, 0 to change, 0 to destroy. * :put_litter_in_its_place: To **delete** this plan click [here](lock-url) * :repeat: To **plan** this project again, comment: * `atlantis plan -p staging` +
--- * :fast_forward: To **apply** all unapplied plans from this pull request, comment: diff --git a/server/testfixtures/test-repos/tfvars-yaml/exp-output-autoplan.txt b/server/testfixtures/test-repos/tfvars-yaml/exp-output-autoplan.txt index f93de7fb89..9dcbc2bbc8 100644 --- a/server/testfixtures/test-repos/tfvars-yaml/exp-output-autoplan.txt +++ b/server/testfixtures/test-repos/tfvars-yaml/exp-output-autoplan.txt @@ -4,6 +4,8 @@ Ran Plan for 2 projects: 1. project: `staging` dir: `.` workspace: `default` ### 1. project: `default` dir: `.` workspace: `default` +
Show Output + ```diff An execution plan has been generated and is shown below. @@ -12,8 +14,11 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ null_resource.simple - id: + # null_resource.simple[0] will be created ++ resource "null_resource" "simple" { + + id = (known after apply) + } + Plan: 1 to add, 0 to change, 0 to destroy. workspace=default @@ -25,9 +30,12 @@ workspace=default * :put_litter_in_its_place: To **delete** this plan click [here](lock-url) * :repeat: To **plan** this project again, comment: * `atlantis plan -p default` +
--- ### 2. project: `staging` dir: `.` workspace: `default` +
Show Output + ```diff An execution plan has been generated and is shown below. @@ -36,8 +44,11 @@ Resource actions are indicated with the following symbols: Terraform will perform the following actions: -+ null_resource.simple - id: + # null_resource.simple[0] will be created ++ resource "null_resource" "simple" { + + id = (known after apply) + } + Plan: 1 to add, 0 to change, 0 to destroy. ``` @@ -47,6 +58,7 @@ Plan: 1 to add, 0 to change, 0 to destroy. * :put_litter_in_its_place: To **delete** this plan click [here](lock-url) * :repeat: To **plan** this project again, comment: * `atlantis plan -p staging` +
--- * :fast_forward: To **apply** all unapplied plans from this pull request, comment: diff --git a/testing/Dockerfile b/testing/Dockerfile index ec54db83c2..568b822d6d 100644 --- a/testing/Dockerfile +++ b/testing/Dockerfile @@ -5,7 +5,7 @@ FROM circleci/golang:1.12 # Install Terraform -ENV TERRAFORM_VERSION=0.11.13 +ENV TERRAFORM_VERSION=0.12.0 RUN curl -LOks https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \ sudo mkdir -p /usr/local/bin/tf/versions/${TERRAFORM_VERSION} && \ sudo unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin/tf/versions/${TERRAFORM_VERSION} && \