Skip to content

Commit

Permalink
Fix TF tokens/env vars for CI (#1029)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauren Voswinkel authored Apr 16, 2021
1 parent 93cac34 commit c9b010e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
8 changes: 8 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
version: 2.1

workflows:
build:
jobs:
- build:
context:
- vault-plugin-secrets-terraform

jobs:
build:
docker:
Expand Down
3 changes: 2 additions & 1 deletion vault/resource_terraform_cloud_secret_backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package vault

import (
"fmt"
"os"
"strings"
"testing"

Expand All @@ -13,7 +14,7 @@ import (

func TestTerraformCloudSecretBackend(t *testing.T) {
backend := acctest.RandomWithPrefix("tf-test-terraform-cloud")
token := "026a0c16-87cd-4c2d-b3f3-fb539f592b7e"
token := os.Getenv("TEST_TF_TOKEN")
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testAccPreCheck(t) },
Expand Down
20 changes: 10 additions & 10 deletions vault/resource_terraform_cloud_secret_creds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import (
func TestAccResourceTerraformCloudSecretCredsOrganizationBasic(t *testing.T) {
backend := acctest.RandomWithPrefix("tf-test-terraform-cloud")
name := acctest.RandomWithPrefix("tf-test-name")
token := os.Getenv("TF_TOKEN")
organization := os.Getenv("TF_ORGANIZATION")
token := os.Getenv("TEST_TF_TOKEN")
organization := os.Getenv("TEST_TF_ORGANIZATION")

resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() {
util.TestAccPreCheck(t)
if token == "" || organization == "" {
t.Skipf("TF_TOKEN and TF_ORGANIZATION must be set. Are currently %s and %s respectively", token, organization)
t.Skipf("TEST_TF_TOKEN and TEST_TF_ORGANIZATION must be set. Are currently %s and %s respectively", token, organization)
}
},
CheckDestroy: testAccResourceTerraformCloudSecretCredsCheckDestroy,
Expand All @@ -44,16 +44,16 @@ func TestAccResourceTerraformCloudSecretCredsOrganizationBasic(t *testing.T) {
func TestAccResourceTerraformCloudSecretCredsTeamBasic(t *testing.T) {
backend := acctest.RandomWithPrefix("tf-test-terraform-cloud")
name := acctest.RandomWithPrefix("tf-test-name")
token := os.Getenv("TF_TOKEN")
organization := os.Getenv("TF_ORGANIZATION")
teamId := os.Getenv("TF_TEAM_ID")
token := os.Getenv("TEST_TF_TOKEN")
organization := os.Getenv("TEST_TF_ORGANIZATION")
teamId := os.Getenv("TEST_TF_TEAM_ID")

resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() {
util.TestAccPreCheck(t)
if token == "" || organization == "" || teamId == "" {
t.Skipf("TF_TOKEN, TF_ORGANIZATION, and TF_TEAM_ID must be set. Are currently %s, %s and %s respectively", token, organization, teamId)
t.Skipf("TEST_TF_TOKEN, TEST_TF_ORGANIZATION, and TEST_TF_TEAM_ID must be set. Are currently %s, %s and %s respectively", token, organization, teamId)
}
},
CheckDestroy: testAccResourceTerraformCloudSecretCredsCheckDestroy,
Expand All @@ -74,15 +74,15 @@ func TestAccResourceTerraformCloudSecretCredsTeamBasic(t *testing.T) {
func TestAccResourceTerraformCloudSecretCredsUserBasic(t *testing.T) {
backend := acctest.RandomWithPrefix("tf-test-terraform-cloud")
name := acctest.RandomWithPrefix("tf-test-name")
token := os.Getenv("TF_TOKEN")
userId := os.Getenv("TF_USER_ID")
token := os.Getenv("TEST_TF_TOKEN")
userId := os.Getenv("TEST_TF_USER_ID")

resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() {
util.TestAccPreCheck(t)
if token == "" || userId == "" {
t.Skipf("TF_TOKEN and TF_USER_ID must be set. Are currently %s and %s respectively", token, userId)
t.Skipf("TEST_TF_TOKEN and TEST_TF_USER_ID must be set. Are currently %s and %s respectively", token, userId)
}
},
CheckDestroy: testAccResourceTerraformCloudSecretCredsCheckDestroy,
Expand Down
6 changes: 3 additions & 3 deletions vault/resource_terraform_cloud_secret_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
func TestTerraformCloudSecretRole(t *testing.T) {
backend := acctest.RandomWithPrefix("tf-test-backend")
name := acctest.RandomWithPrefix("tf-test-name")
token := os.Getenv("TF_TOKEN")
teamId := os.Getenv("TF_TEAM_ID")
userId := os.Getenv("TF_USER_ID")
token := os.Getenv("TEST_TF_TOKEN")
teamId := os.Getenv("TEST_TF_TEAM_ID")
userId := os.Getenv("TEST_TF_USER_ID")
organization := "hashicorp-vault-testing"
resource.Test(t, resource.TestCase{
Providers: testProviders,
Expand Down

0 comments on commit c9b010e

Please sign in to comment.