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

Commit

Permalink
Merge pull request #8 from gruntwork-io/module-design-test
Browse files Browse the repository at this point in the history
[WIP] Add Terratest of the first example
  • Loading branch information
robmorgan authored Jan 17, 2019
2 parents eed633b + 627d58a commit f4ebb09
Show file tree
Hide file tree
Showing 3 changed files with 250 additions and 0 deletions.
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

}

0 comments on commit f4ebb09

Please sign in to comment.