e2e test for remote state read

This commit is contained in:
James Bardin 2020-06-24 14:09:59 -04:00
parent a0fad2c6b4
commit 731b19ab46
3 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,29 @@
package e2etest
import (
"path/filepath"
"testing"
"github.com/hashicorp/terraform/e2e"
)
func TestTerraformProviderRead(t *testing.T) {
// Ensure the terraform provider can correctly read a remote state
t.Parallel()
fixturePath := filepath.Join("testdata", "terraform-provider")
tf := e2e.NewBinary(terraformBin, fixturePath)
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")
if err != nil {
t.Fatalf("unexpected plan error: %s\nstderr:\n%s", err, stderr)
}
}

View File

@ -5,6 +5,6 @@ provider "terraform" {
data "terraform_remote_state" "test" {
backend = "local"
config = {
path = "nothing.tfstate"
path = "test.tfstate"
}
}

View File

@ -0,0 +1,13 @@
{
"version": 4,
"terraform_version": "0.13.0",
"serial": 1,
"lineage": "8fab7b5a-511c-d586-988e-250f99c8feb4",
"outputs": {
"out": {
"value": "test",
"type": "string"
}
},
"resources": []
}