forked from hashicorp/terraform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package e2etest | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform/e2e" | ||
) | ||
|
||
// TestProviderDevOverrides is a test that terraform can execute a 3rd party | ||
// provisioner plugin. | ||
func TestProvisioner(t *testing.T) { | ||
t.Parallel() | ||
|
||
// This test reaches out to releases.hashicorp.com to download the | ||
// template and null providers, so it can only run if network access is | ||
// allowed. | ||
skipIfCannotAccessNetwork(t) | ||
|
||
tf := e2e.NewBinary(terraformBin, "testdata/provisioner") | ||
defer tf.Close() | ||
|
||
//// INIT | ||
_, stderr, err := tf.Run("init") | ||
if err != nil { | ||
t.Fatalf("unexpected init error: %s\nstderr:\n%s", err, stderr) | ||
} | ||
|
||
//// PLAN | ||
_, stderr, err = tf.Run("plan", "-out=tfplan") | ||
if err != nil { | ||
t.Fatalf("unexpected plan error: %s\nstderr:\n%s", err, stderr) | ||
} | ||
|
||
//// APPLY | ||
stdout, stderr, err := tf.Run("apply", "tfplan") | ||
if err != nil { | ||
t.Fatalf("unexpected apply error: %s\nstderr:\n%s", err, stderr) | ||
} | ||
|
||
if !strings.Contains(stdout, "HelloProvisioner") { | ||
t.Fatalf("missing provisioner output:\n%s", stdout) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
resource "null_resource" "a" { | ||
provisioner "local-exec" { | ||
command = "echo HelloProvisioner" | ||
} | ||
} |