Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

[WIP] Add Terratest of the first example #8

Merged
merged 4 commits into from
Jan 17, 2019
Merged
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
199 changes: 199 additions & 0 deletions test/Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions test/gke_cluster_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package test

import (
"path/filepath"
"testing"

"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/gruntwork-io/terratest/modules/test-structure"
)

func TestGKECluster(t *testing.T) {
t.Parallel()

testFolder := test_structure.CopyTerraformFolderToTemp(t, "..", "examples")
terraformModulePath := filepath.Join(testFolder, "gke-regional-public-cluster")

project := "graphite-test-rileykarson"
region := "us-central1"
terratestOptions := createGKEClusterTerraformOptions(t, project, region, terraformModulePath)
defer terraform.Destroy(t, terratestOptions)

terraform.InitAndApply(t, terratestOptions)
}
28 changes: 28 additions & 0 deletions test/terratest_options.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package test

import (
"testing"

"github.com/gruntwork-io/terratest/modules/terraform"
)

func createGKEClusterTerraformOptions(
t *testing.T,
project string,
region string,
templatePath string,
) *terraform.Options {
terraformVars := map[string]interface{}{
"region": region,
"project": project,
}

terratestOptions := terraform.Options{
TerraformDir: templatePath,
Vars: terraformVars,
}

return &terratestOptions

}