2014-06-03 17:08:00 -05:00
|
|
|
package terraform
|
|
|
|
|
|
|
|
import (
|
2016-08-01 16:16:22 -05:00
|
|
|
"flag"
|
2015-03-01 23:28:41 -06:00
|
|
|
"fmt"
|
2016-07-06 08:56:29 -05:00
|
|
|
"io"
|
2014-09-22 18:48:18 -05:00
|
|
|
"io/ioutil"
|
2016-08-01 16:16:22 -05:00
|
|
|
"log"
|
2014-09-22 18:48:18 -05:00
|
|
|
"os"
|
2014-06-03 17:08:00 -05:00
|
|
|
"path/filepath"
|
2015-03-01 23:28:41 -06:00
|
|
|
"strings"
|
2014-06-30 13:14:03 -05:00
|
|
|
"sync"
|
2014-06-03 17:08:00 -05:00
|
|
|
"testing"
|
|
|
|
|
2015-10-15 15:52:27 -05:00
|
|
|
"github.com/hashicorp/go-getter"
|
2014-06-03 17:08:00 -05:00
|
|
|
"github.com/hashicorp/terraform/config"
|
2014-09-22 17:37:29 -05:00
|
|
|
"github.com/hashicorp/terraform/config/module"
|
2016-10-26 14:46:22 -05:00
|
|
|
"github.com/hashicorp/terraform/helper/experiment"
|
2016-08-01 16:16:22 -05:00
|
|
|
"github.com/hashicorp/terraform/helper/logging"
|
2014-06-03 17:08:00 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// This is the directory where our test fixtures are.
|
|
|
|
const fixtureDir = "./test-fixtures"
|
|
|
|
|
2016-08-01 16:16:22 -05:00
|
|
|
func TestMain(m *testing.M) {
|
2016-10-26 14:46:22 -05:00
|
|
|
experiment.Flag(flag.CommandLine)
|
2016-08-01 16:16:22 -05:00
|
|
|
flag.Parse()
|
2016-10-01 18:51:00 -05:00
|
|
|
|
2016-08-01 16:16:22 -05:00
|
|
|
if testing.Verbose() {
|
|
|
|
// if we're verbose, use the logging requested by TF_LOG
|
|
|
|
logging.SetOutput()
|
|
|
|
} else {
|
|
|
|
// otherwise silence all logs
|
|
|
|
log.SetOutput(ioutil.Discard)
|
|
|
|
}
|
|
|
|
|
2016-10-01 18:51:00 -05:00
|
|
|
// Make sure shadow operations fail our real tests
|
|
|
|
contextFailOnShadowError = true
|
|
|
|
|
2016-10-01 23:30:09 -05:00
|
|
|
// Always DeepCopy the Diff on every Plan during a test
|
|
|
|
contextTestDeepCopyOnPlan = true
|
|
|
|
|
2016-08-01 16:16:22 -05:00
|
|
|
os.Exit(m.Run())
|
|
|
|
}
|
|
|
|
|
2014-09-22 18:48:18 -05:00
|
|
|
func tempDir(t *testing.T) string {
|
|
|
|
dir, err := ioutil.TempDir("", "tf")
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
|
|
|
if err := os.RemoveAll(dir); err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return dir
|
|
|
|
}
|
|
|
|
|
2015-04-21 23:31:53 -05:00
|
|
|
// tempEnv lets you temporarily set an environment variable. It returns
|
2016-08-17 13:28:58 -05:00
|
|
|
// a function to defer to reset the old value.
|
2015-04-21 23:31:53 -05:00
|
|
|
// the old value that should be set via a defer.
|
2016-08-17 13:28:58 -05:00
|
|
|
func tempEnv(t *testing.T, k string, v string) func() {
|
2016-10-31 13:00:19 -05:00
|
|
|
old, oldOk := os.LookupEnv(k)
|
2015-04-21 23:31:53 -05:00
|
|
|
os.Setenv(k, v)
|
2016-10-31 13:00:19 -05:00
|
|
|
return func() {
|
|
|
|
if !oldOk {
|
|
|
|
os.Unsetenv(k)
|
|
|
|
} else {
|
|
|
|
os.Setenv(k, old)
|
|
|
|
}
|
|
|
|
}
|
2015-04-21 23:31:53 -05:00
|
|
|
}
|
|
|
|
|
2014-06-05 04:32:10 -05:00
|
|
|
func testConfig(t *testing.T, name string) *config.Config {
|
2015-06-23 09:15:26 -05:00
|
|
|
c, err := config.LoadFile(filepath.Join(fixtureDir, name, "main.tf"))
|
2014-06-05 04:32:10 -05:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return c
|
|
|
|
}
|
|
|
|
|
2014-09-22 17:37:29 -05:00
|
|
|
func testModule(t *testing.T, name string) *module.Tree {
|
|
|
|
mod, err := module.NewTreeModule("", filepath.Join(fixtureDir, name))
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
|
|
|
|
2015-10-15 15:52:27 -05:00
|
|
|
s := &getter.FolderStorage{StorageDir: tempDir(t)}
|
2014-09-22 18:48:18 -05:00
|
|
|
if err := mod.Load(s, module.GetModeGet); err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
|
|
|
|
2014-09-22 17:37:29 -05:00
|
|
|
return mod
|
|
|
|
}
|
|
|
|
|
2016-07-06 08:56:29 -05:00
|
|
|
// testModuleInline takes a map of path -> config strings and yields a config
|
|
|
|
// structure with those files loaded from disk
|
|
|
|
func testModuleInline(t *testing.T, config map[string]string) *module.Tree {
|
|
|
|
cfgPath, err := ioutil.TempDir("", "tf-test")
|
|
|
|
if err != nil {
|
|
|
|
t.Errorf("Error creating temporary directory for config: %s", err)
|
|
|
|
}
|
|
|
|
defer os.RemoveAll(cfgPath)
|
|
|
|
|
|
|
|
for path, configStr := range config {
|
|
|
|
dir := filepath.Dir(path)
|
|
|
|
if dir != "." {
|
|
|
|
err := os.MkdirAll(filepath.Join(cfgPath, dir), os.FileMode(0777))
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Error creating subdir: %s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Write the configuration
|
|
|
|
cfgF, err := os.Create(filepath.Join(cfgPath, path))
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Error creating temporary file for config: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
_, err = io.Copy(cfgF, strings.NewReader(configStr))
|
|
|
|
cfgF.Close()
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Error creating temporary file for config: %s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Parse the configuration
|
|
|
|
mod, err := module.NewTreeModule("", cfgPath)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Error loading configuration: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Load the modules
|
|
|
|
modStorage := &getter.FolderStorage{
|
|
|
|
StorageDir: filepath.Join(cfgPath, ".tfmodules"),
|
|
|
|
}
|
|
|
|
err = mod.Load(modStorage, module.GetModeGet)
|
|
|
|
if err != nil {
|
|
|
|
t.Errorf("Error downloading modules: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return mod
|
|
|
|
}
|
|
|
|
|
2015-03-01 23:28:41 -06:00
|
|
|
func testStringMatch(t *testing.T, s fmt.Stringer, expected string) {
|
|
|
|
actual := strings.TrimSpace(s.String())
|
|
|
|
expected = strings.TrimSpace(expected)
|
|
|
|
if actual != expected {
|
|
|
|
t.Fatalf("Actual\n\n%s\n\nExpected:\n\n%s", actual, expected)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-25 14:58:27 -05:00
|
|
|
func testProviderFuncFixed(rp ResourceProvider) ResourceProviderFactory {
|
|
|
|
return func() (ResourceProvider, error) {
|
|
|
|
return rp, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-08 14:42:50 -05:00
|
|
|
func testProvisionerFuncFixed(rp ResourceProvisioner) ResourceProvisionerFactory {
|
|
|
|
return func() (ResourceProvisioner, error) {
|
|
|
|
return rp, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-30 13:14:03 -05:00
|
|
|
// HookRecordApplyOrder is a test hook that records the order of applies
|
|
|
|
// by recording the PreApply event.
|
|
|
|
type HookRecordApplyOrder struct {
|
|
|
|
NilHook
|
|
|
|
|
|
|
|
Active bool
|
|
|
|
|
|
|
|
IDs []string
|
2014-09-17 17:00:19 -05:00
|
|
|
States []*InstanceState
|
2014-09-17 18:33:24 -05:00
|
|
|
Diffs []*InstanceDiff
|
2014-06-30 13:14:03 -05:00
|
|
|
|
|
|
|
l sync.Mutex
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *HookRecordApplyOrder) PreApply(
|
2014-09-25 12:40:44 -05:00
|
|
|
info *InstanceInfo,
|
2014-09-17 17:00:19 -05:00
|
|
|
s *InstanceState,
|
2014-09-17 18:33:24 -05:00
|
|
|
d *InstanceDiff) (HookAction, error) {
|
2017-01-20 22:36:53 -06:00
|
|
|
if d.Empty() {
|
|
|
|
return HookActionContinue, nil
|
|
|
|
}
|
|
|
|
|
2014-06-30 13:14:03 -05:00
|
|
|
if h.Active {
|
|
|
|
h.l.Lock()
|
|
|
|
defer h.l.Unlock()
|
|
|
|
|
2014-09-25 12:40:44 -05:00
|
|
|
h.IDs = append(h.IDs, info.Id)
|
2014-06-30 13:14:03 -05:00
|
|
|
h.Diffs = append(h.Diffs, d)
|
|
|
|
h.States = append(h.States, s)
|
|
|
|
}
|
|
|
|
|
|
|
|
return HookActionContinue, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Below are all the constant strings that are the expected output for
|
|
|
|
// various tests.
|
|
|
|
|
2014-09-29 11:13:15 -05:00
|
|
|
const testTerraformInputProviderStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
bar = override
|
|
|
|
foo = us-east-1
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
bar = baz
|
|
|
|
num = 2
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2014-10-08 12:18:45 -05:00
|
|
|
const testTerraformInputProviderOnlyStr = `
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
foo = us-west-2
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
|
|
|
const testTerraformInputVarOnlyStr = `
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
foo = us-east-1
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2015-03-06 17:04:12 -06:00
|
|
|
const testTerraformInputVarOnlyUnsetStr = `
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
bar = baz
|
|
|
|
foo = foovalue
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2014-09-29 01:37:36 -05:00
|
|
|
const testTerraformInputVarsStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
bar = override
|
|
|
|
foo = us-east-1
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
bar = baz
|
|
|
|
num = 2
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2014-06-18 18:38:08 -05:00
|
|
|
const testTerraformApplyStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
foo = bar
|
2014-07-01 12:28:42 -05:00
|
|
|
type = aws_instance
|
2014-06-18 18:38:08 -05:00
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
num = 2
|
2014-07-01 12:28:42 -05:00
|
|
|
type = aws_instance
|
2014-06-18 18:38:08 -05:00
|
|
|
`
|
|
|
|
|
2016-10-20 23:53:35 -05:00
|
|
|
const testTerraformApplyDataBasicStr = `
|
|
|
|
data.null_data_source.testing:
|
|
|
|
ID = yo
|
|
|
|
`
|
|
|
|
|
2016-08-31 13:49:25 -05:00
|
|
|
const testTerraformApplyRefCountStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
foo = 3
|
|
|
|
type = aws_instance
|
|
|
|
|
|
|
|
Dependencies:
|
|
|
|
aws_instance.foo
|
|
|
|
aws_instance.foo.0:
|
|
|
|
ID = foo
|
|
|
|
aws_instance.foo.1:
|
|
|
|
ID = foo
|
|
|
|
aws_instance.foo.2:
|
|
|
|
ID = foo
|
|
|
|
`
|
|
|
|
|
2015-03-23 17:36:53 -05:00
|
|
|
const testTerraformApplyProviderAliasStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
provider = aws.bar
|
|
|
|
foo = bar
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
num = 2
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2016-11-04 18:35:48 -05:00
|
|
|
const testTerraformApplyProviderAliasConfigStr = `
|
|
|
|
another_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
provider = another.two
|
|
|
|
another_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
`
|
|
|
|
|
2014-11-24 21:18:52 -06:00
|
|
|
const testTerraformApplyEmptyModuleStr = `
|
|
|
|
<no state>
|
|
|
|
Outputs:
|
|
|
|
|
|
|
|
end = XXXX
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
<no state>
|
|
|
|
Outputs:
|
|
|
|
|
|
|
|
aws_access_key = YYYYY
|
|
|
|
aws_route53_zone_id = XXXX
|
|
|
|
aws_secret_key = ZZZZ
|
|
|
|
`
|
|
|
|
|
2014-09-29 19:00:45 -05:00
|
|
|
const testTerraformApplyDependsCreateBeforeStr = `
|
|
|
|
aws_instance.lb:
|
|
|
|
ID = foo
|
|
|
|
instance = foo
|
|
|
|
type = aws_instance
|
|
|
|
|
|
|
|
Dependencies:
|
|
|
|
aws_instance.web
|
|
|
|
aws_instance.web:
|
|
|
|
ID = foo
|
|
|
|
require_new = ami-new
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2014-09-23 13:13:50 -05:00
|
|
|
const testTerraformApplyCreateBeforeStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
require_new = xyz
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2015-02-16 23:06:09 -06:00
|
|
|
const testTerraformApplyCreateBeforeUpdateStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
foo = baz
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2014-07-02 18:16:38 -05:00
|
|
|
const testTerraformApplyCancelStr = `
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
num = 2
|
|
|
|
`
|
|
|
|
|
2014-06-23 14:19:41 -05:00
|
|
|
const testTerraformApplyComputeStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
2014-06-30 21:29:07 -05:00
|
|
|
foo = computed_dynamical
|
2014-07-01 12:28:42 -05:00
|
|
|
type = aws_instance
|
2014-09-17 19:40:59 -05:00
|
|
|
|
|
|
|
Dependencies:
|
|
|
|
aws_instance.foo
|
2014-06-23 14:19:41 -05:00
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
2014-06-30 21:29:07 -05:00
|
|
|
dynamical = computed_dynamical
|
2014-07-01 12:28:42 -05:00
|
|
|
num = 2
|
|
|
|
type = aws_instance
|
2014-06-23 14:19:41 -05:00
|
|
|
`
|
|
|
|
|
2014-10-10 01:15:42 -05:00
|
|
|
const testTerraformApplyCountDecStr = `
|
|
|
|
aws_instance.foo.0:
|
|
|
|
ID = bar
|
|
|
|
foo = foo
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.foo.1:
|
|
|
|
ID = bar
|
|
|
|
foo = foo
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
|
|
|
const testTerraformApplyCountDecToOneStr = `
|
2015-02-12 22:06:42 -06:00
|
|
|
aws_instance.foo:
|
2014-10-10 01:15:42 -05:00
|
|
|
ID = bar
|
|
|
|
foo = foo
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2015-03-01 23:28:41 -06:00
|
|
|
const testTerraformApplyCountDecToOneCorruptedStr = `
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = bar
|
|
|
|
foo = foo
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
|
|
|
const testTerraformApplyCountDecToOneCorruptedPlanStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
DESTROY: aws_instance.foo.0
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = bar
|
|
|
|
foo = foo
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.foo.0:
|
|
|
|
ID = baz
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2014-10-12 11:41:27 -05:00
|
|
|
const testTerraformApplyCountTaintedStr = `
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-10-17 20:03:30 -05:00
|
|
|
const testTerraformApplyCountVariableStr = `
|
|
|
|
aws_instance.foo.0:
|
|
|
|
ID = foo
|
|
|
|
foo = foo
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.foo.1:
|
|
|
|
ID = foo
|
|
|
|
foo = foo
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2016-08-31 13:54:14 -05:00
|
|
|
const testTerraformApplyCountVariableRefStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
foo = 2
|
|
|
|
type = aws_instance
|
|
|
|
|
|
|
|
Dependencies:
|
|
|
|
aws_instance.foo
|
|
|
|
aws_instance.foo.0:
|
|
|
|
ID = foo
|
|
|
|
aws_instance.foo.1:
|
|
|
|
ID = foo
|
|
|
|
`
|
|
|
|
|
2014-07-08 18:12:14 -05:00
|
|
|
const testTerraformApplyMinimalStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
`
|
|
|
|
|
2014-09-23 19:13:50 -05:00
|
|
|
const testTerraformApplyModuleStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
foo = bar
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
num = 2
|
|
|
|
type = aws_instance
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
aws_instance.baz:
|
|
|
|
ID = foo
|
|
|
|
foo = bar
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2015-02-20 11:40:41 -06:00
|
|
|
const testTerraformApplyModuleBoolStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
foo = 1
|
|
|
|
type = aws_instance
|
|
|
|
|
|
|
|
Dependencies:
|
|
|
|
module.child
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
<no state>
|
|
|
|
Outputs:
|
|
|
|
|
|
|
|
leader = 1
|
|
|
|
`
|
|
|
|
|
2015-05-02 20:21:00 -05:00
|
|
|
const testTerraformApplyModuleDestroyOrderStr = `
|
|
|
|
<no state>
|
|
|
|
module.child:
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2015-02-16 21:04:05 -06:00
|
|
|
const testTerraformApplyMultiProviderStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
foo = bar
|
|
|
|
type = aws_instance
|
|
|
|
do_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
num = 2
|
|
|
|
type = do_instance
|
|
|
|
`
|
|
|
|
|
2015-06-26 14:00:02 -05:00
|
|
|
const testTerraformApplyModuleOnlyProviderStr = `
|
|
|
|
<no state>
|
|
|
|
module.child:
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
test_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
`
|
|
|
|
|
2015-06-24 22:58:52 -05:00
|
|
|
const testTerraformApplyModuleProviderAliasStr = `
|
|
|
|
<no state>
|
|
|
|
module.child:
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
provider = aws.eu
|
|
|
|
`
|
|
|
|
|
2016-11-04 19:47:20 -05:00
|
|
|
const testTerraformApplyModuleVarRefExistingStr = `
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
foo = bar
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
type = aws_instance
|
|
|
|
value = bar
|
|
|
|
`
|
|
|
|
|
2015-04-29 13:27:12 -05:00
|
|
|
const testTerraformApplyOutputOrphanStr = `
|
|
|
|
<no state>
|
|
|
|
Outputs:
|
|
|
|
|
|
|
|
foo = bar
|
|
|
|
`
|
|
|
|
|
2016-11-02 00:42:41 -05:00
|
|
|
const testTerraformApplyOutputOrphanModuleStr = `
|
|
|
|
module.child:
|
|
|
|
<no state>
|
|
|
|
Outputs:
|
|
|
|
|
|
|
|
foo = bar
|
|
|
|
`
|
|
|
|
|
2014-07-09 12:36:49 -05:00
|
|
|
const testTerraformApplyProvisionerStr = `
|
2014-07-22 11:56:39 -05:00
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
2014-09-17 19:42:43 -05:00
|
|
|
|
|
|
|
Dependencies:
|
|
|
|
aws_instance.foo
|
2014-07-22 11:56:39 -05:00
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
dynamical = computed_dynamical
|
|
|
|
num = 2
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2016-11-03 12:25:11 -05:00
|
|
|
const testTerraformApplyProvisionerModuleStr = `
|
|
|
|
<no state>
|
|
|
|
module.child:
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
`
|
|
|
|
|
2014-07-22 11:56:39 -05:00
|
|
|
const testTerraformApplyProvisionerFailStr = `
|
2016-04-21 14:59:10 -05:00
|
|
|
aws_instance.bar: (tainted)
|
|
|
|
ID = foo
|
2014-07-09 12:36:49 -05:00
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
num = 2
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2014-10-17 01:19:07 -05:00
|
|
|
const testTerraformApplyProvisionerFailCreateStr = `
|
2016-04-21 14:59:10 -05:00
|
|
|
aws_instance.bar: (tainted)
|
|
|
|
ID = foo
|
2014-10-17 01:19:07 -05:00
|
|
|
`
|
|
|
|
|
2014-10-17 01:20:46 -05:00
|
|
|
const testTerraformApplyProvisionerFailCreateNoIdStr = `
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-09-22 19:18:51 -05:00
|
|
|
const testTerraformApplyProvisionerFailCreateBeforeDestroyStr = `
|
2016-04-21 14:59:10 -05:00
|
|
|
aws_instance.bar: (1 deposed)
|
2014-09-22 19:18:51 -05:00
|
|
|
ID = bar
|
|
|
|
require_new = abc
|
2016-04-21 14:59:10 -05:00
|
|
|
Deposed ID 1 = foo (tainted)
|
2014-09-22 19:18:51 -05:00
|
|
|
`
|
|
|
|
|
2014-07-24 09:58:45 -05:00
|
|
|
const testTerraformApplyProvisionerResourceRefStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
num = 2
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2015-02-23 16:56:02 -06:00
|
|
|
const testTerraformApplyProvisionerSelfRefStr = `
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
foo = bar
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2015-02-23 17:02:26 -06:00
|
|
|
const testTerraformApplyProvisionerMultiSelfRefStr = `
|
|
|
|
aws_instance.foo.0:
|
|
|
|
ID = foo
|
|
|
|
foo = number 0
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.foo.1:
|
|
|
|
ID = foo
|
|
|
|
foo = number 1
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.foo.2:
|
|
|
|
ID = foo
|
|
|
|
foo = number 2
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2016-11-23 11:25:20 -06:00
|
|
|
const testTerraformApplyProvisionerMultiSelfRefSingleStr = `
|
|
|
|
aws_instance.foo.0:
|
|
|
|
ID = foo
|
|
|
|
foo = number 0
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.foo.1:
|
|
|
|
ID = foo
|
|
|
|
foo = number 1
|
|
|
|
type = aws_instance
|
|
|
|
|
|
|
|
Dependencies:
|
|
|
|
aws_instance.foo.0
|
|
|
|
aws_instance.foo.2:
|
|
|
|
ID = foo
|
|
|
|
foo = number 2
|
|
|
|
type = aws_instance
|
|
|
|
|
|
|
|
Dependencies:
|
|
|
|
aws_instance.foo.0
|
|
|
|
`
|
|
|
|
|
2014-09-22 13:15:22 -05:00
|
|
|
const testTerraformApplyProvisionerDiffStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
foo = bar
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2014-06-30 13:14:03 -05:00
|
|
|
const testTerraformApplyDestroyStr = `
|
2014-07-02 21:56:29 -05:00
|
|
|
<no state>
|
2014-06-30 13:14:03 -05:00
|
|
|
`
|
|
|
|
|
2015-07-19 15:53:31 -05:00
|
|
|
const testTerraformApplyDestroyNestedModuleStr = `
|
|
|
|
module.child.subchild:
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-07-02 19:26:39 -05:00
|
|
|
const testTerraformApplyErrorStr = `
|
2015-02-13 14:50:13 -06:00
|
|
|
aws_instance.bar:
|
|
|
|
ID = bar
|
2014-09-17 19:45:38 -05:00
|
|
|
|
|
|
|
Dependencies:
|
|
|
|
aws_instance.foo
|
2014-07-02 19:26:39 -05:00
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
num = 2
|
|
|
|
`
|
|
|
|
|
2014-09-23 12:53:29 -05:00
|
|
|
const testTerraformApplyErrorCreateBeforeDestroyStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = bar
|
|
|
|
require_new = abc
|
|
|
|
`
|
|
|
|
|
2014-09-23 13:10:23 -05:00
|
|
|
const testTerraformApplyErrorDestroyCreateBeforeDestroyStr = `
|
2015-03-04 12:15:53 -06:00
|
|
|
aws_instance.bar: (1 deposed)
|
2014-09-23 13:10:23 -05:00
|
|
|
ID = foo
|
2015-03-04 12:15:53 -06:00
|
|
|
Deposed ID 1 = bar
|
2014-09-23 13:10:23 -05:00
|
|
|
`
|
|
|
|
|
2014-07-02 19:26:39 -05:00
|
|
|
const testTerraformApplyErrorPartialStr = `
|
2015-02-13 14:50:13 -06:00
|
|
|
aws_instance.bar:
|
|
|
|
ID = bar
|
2014-09-17 19:45:38 -05:00
|
|
|
|
|
|
|
Dependencies:
|
|
|
|
aws_instance.foo
|
2014-07-02 19:26:39 -05:00
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
num = 2
|
|
|
|
`
|
|
|
|
|
2016-11-11 20:54:37 -06:00
|
|
|
const testTerraformApplyResourceDependsOnModuleStr = `
|
|
|
|
aws_instance.a:
|
|
|
|
ID = foo
|
|
|
|
|
|
|
|
Dependencies:
|
|
|
|
module.child
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
aws_instance.child:
|
|
|
|
ID = foo
|
|
|
|
`
|
|
|
|
|
2016-11-12 17:38:28 -06:00
|
|
|
const testTerraformApplyResourceDependsOnModuleDeepStr = `
|
|
|
|
aws_instance.a:
|
|
|
|
ID = foo
|
|
|
|
|
|
|
|
Dependencies:
|
|
|
|
module.child
|
|
|
|
|
|
|
|
module.child.grandchild:
|
|
|
|
aws_instance.c:
|
|
|
|
ID = foo
|
|
|
|
`
|
|
|
|
|
|
|
|
const testTerraformApplyResourceDependsOnModuleInModuleStr = `
|
|
|
|
<no state>
|
|
|
|
module.child:
|
|
|
|
aws_instance.b:
|
|
|
|
ID = foo
|
|
|
|
|
|
|
|
Dependencies:
|
|
|
|
module.grandchild
|
|
|
|
module.child.grandchild:
|
|
|
|
aws_instance.c:
|
|
|
|
ID = foo
|
|
|
|
`
|
|
|
|
|
2014-07-26 23:02:34 -05:00
|
|
|
const testTerraformApplyTaintStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
num = 2
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2015-02-26 11:50:18 -06:00
|
|
|
const testTerraformApplyTaintDepStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = bar
|
|
|
|
foo = foo
|
|
|
|
num = 2
|
|
|
|
type = aws_instance
|
|
|
|
|
|
|
|
Dependencies:
|
|
|
|
aws_instance.foo
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
num = 2
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
|
|
|
const testTerraformApplyTaintDepRequireNewStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
foo = foo
|
|
|
|
require_new = yes
|
|
|
|
type = aws_instance
|
|
|
|
|
|
|
|
Dependencies:
|
|
|
|
aws_instance.foo
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
num = 2
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2014-07-04 17:36:28 -05:00
|
|
|
const testTerraformApplyOutputStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
|
|
|
foo = bar
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
num = 2
|
|
|
|
type = aws_instance
|
|
|
|
|
|
|
|
Outputs:
|
|
|
|
|
|
|
|
foo_num = 2
|
|
|
|
`
|
|
|
|
|
2015-11-09 14:15:25 -06:00
|
|
|
const testTerraformApplyOutputAddStr = `
|
|
|
|
aws_instance.test.0:
|
|
|
|
ID = foo
|
|
|
|
foo = foo0
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.test.1:
|
|
|
|
ID = foo
|
|
|
|
foo = foo1
|
|
|
|
type = aws_instance
|
|
|
|
|
|
|
|
Outputs:
|
|
|
|
|
|
|
|
firstOutput = foo0
|
|
|
|
secondOutput = foo1
|
|
|
|
`
|
|
|
|
|
2014-11-24 18:49:38 -06:00
|
|
|
const testTerraformApplyOutputListStr = `
|
|
|
|
aws_instance.bar.0:
|
|
|
|
ID = foo
|
|
|
|
foo = bar
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.bar.1:
|
|
|
|
ID = foo
|
|
|
|
foo = bar
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.bar.2:
|
|
|
|
ID = foo
|
|
|
|
foo = bar
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
num = 2
|
|
|
|
type = aws_instance
|
|
|
|
|
|
|
|
Outputs:
|
|
|
|
|
2016-04-11 12:40:06 -05:00
|
|
|
foo_num = [bar,bar,bar]
|
2014-11-24 18:49:38 -06:00
|
|
|
`
|
|
|
|
|
2014-07-05 12:48:47 -05:00
|
|
|
const testTerraformApplyOutputMultiStr = `
|
|
|
|
aws_instance.bar.0:
|
|
|
|
ID = foo
|
|
|
|
foo = bar
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.bar.1:
|
|
|
|
ID = foo
|
|
|
|
foo = bar
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.bar.2:
|
|
|
|
ID = foo
|
|
|
|
foo = bar
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
num = 2
|
|
|
|
type = aws_instance
|
|
|
|
|
|
|
|
Outputs:
|
|
|
|
|
|
|
|
foo_num = bar,bar,bar
|
|
|
|
`
|
|
|
|
|
2014-07-06 16:09:44 -05:00
|
|
|
const testTerraformApplyOutputMultiIndexStr = `
|
|
|
|
aws_instance.bar.0:
|
|
|
|
ID = foo
|
|
|
|
foo = bar
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.bar.1:
|
|
|
|
ID = foo
|
|
|
|
foo = bar
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.bar.2:
|
|
|
|
ID = foo
|
|
|
|
foo = bar
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
num = 2
|
|
|
|
type = aws_instance
|
|
|
|
|
|
|
|
Outputs:
|
|
|
|
|
|
|
|
foo_num = bar
|
|
|
|
`
|
|
|
|
|
2014-06-23 15:08:25 -05:00
|
|
|
const testTerraformApplyUnknownAttrStr = `
|
2015-02-13 14:50:13 -06:00
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
|
|
|
num = 2
|
|
|
|
type = aws_instance
|
2014-06-23 15:08:25 -05:00
|
|
|
`
|
|
|
|
|
2014-06-23 14:28:02 -05:00
|
|
|
const testTerraformApplyVarsStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
2014-07-22 10:06:09 -05:00
|
|
|
bar = foo
|
2014-07-22 10:18:53 -05:00
|
|
|
baz = override
|
2014-07-22 10:06:09 -05:00
|
|
|
foo = us-west-2
|
2014-07-01 12:28:42 -05:00
|
|
|
type = aws_instance
|
2014-06-23 14:28:02 -05:00
|
|
|
aws_instance.foo:
|
|
|
|
ID = foo
|
2014-07-22 10:14:20 -05:00
|
|
|
bar = baz
|
core: Allow lists and maps as variable overrides
Terraform 0.7 introduces lists and maps as first-class values for
variables, in addition to string values which were previously available.
However, there was previously no way to override the default value of a
list or map, and the functionality for overriding specific map keys was
broken.
Using the environment variable method for setting variable values, there
was previously no way to give a variable a value of a list or map. These
now support HCL for individual values - specifying:
TF_VAR_test='["Hello", "World"]'
will set the variable `test` to a two-element list containing "Hello"
and "World". Specifying
TF_VAR_test_map='{"Hello = "World", "Foo" = "bar"}'
will set the variable `test_map` to a two-element map with keys "Hello"
and "Foo", and values "World" and "bar" respectively.
The same logic is applied to `-var` flags, and the file parsed by
`-var-files` ("autoVariables").
Note that care must be taken to not run into shell expansion for `-var-`
flags and environment variables.
We also merge map keys where appropriate. The override syntax has
changed (to be noted in CHANGELOG as a breaking change), so several
tests needed their syntax updating from the old `amis.us-east-1 =
"newValue"` style to `amis = "{ "us-east-1" = "newValue"}"` style as
defined in TF-002.
In order to continue supporting the `-var "foo=bar"` type of variable
flag (which is not valid HCL), a special case error is checked after HCL
parsing fails, and the old code path runs instead.
2016-07-20 20:38:26 -05:00
|
|
|
list = Hello,World
|
|
|
|
map = Baz,Foo,Hello
|
2014-06-23 14:28:02 -05:00
|
|
|
num = 2
|
2014-07-01 12:28:42 -05:00
|
|
|
type = aws_instance
|
2014-06-23 14:28:02 -05:00
|
|
|
`
|
|
|
|
|
2015-04-21 23:31:53 -05:00
|
|
|
const testTerraformApplyVarsEnvStr = `
|
|
|
|
aws_instance.bar:
|
|
|
|
ID = foo
|
core: Allow lists and maps as variable overrides
Terraform 0.7 introduces lists and maps as first-class values for
variables, in addition to string values which were previously available.
However, there was previously no way to override the default value of a
list or map, and the functionality for overriding specific map keys was
broken.
Using the environment variable method for setting variable values, there
was previously no way to give a variable a value of a list or map. These
now support HCL for individual values - specifying:
TF_VAR_test='["Hello", "World"]'
will set the variable `test` to a two-element list containing "Hello"
and "World". Specifying
TF_VAR_test_map='{"Hello = "World", "Foo" = "bar"}'
will set the variable `test_map` to a two-element map with keys "Hello"
and "Foo", and values "World" and "bar" respectively.
The same logic is applied to `-var` flags, and the file parsed by
`-var-files` ("autoVariables").
Note that care must be taken to not run into shell expansion for `-var-`
flags and environment variables.
We also merge map keys where appropriate. The override syntax has
changed (to be noted in CHANGELOG as a breaking change), so several
tests needed their syntax updating from the old `amis.us-east-1 =
"newValue"` style to `amis = "{ "us-east-1" = "newValue"}"` style as
defined in TF-002.
In order to continue supporting the `-var "foo=bar"` type of variable
flag (which is not valid HCL), a special case error is checked after HCL
parsing fails, and the old code path runs instead.
2016-07-20 20:38:26 -05:00
|
|
|
bar = Hello,World
|
|
|
|
baz = Baz,Foo,Hello
|
2015-04-21 23:31:53 -05:00
|
|
|
foo = baz
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2014-06-20 12:44:49 -05:00
|
|
|
const testTerraformPlanStr = `
|
2014-06-25 20:22:42 -05:00
|
|
|
DIFF:
|
|
|
|
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.bar
|
2014-06-18 11:30:59 -05:00
|
|
|
foo: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.foo
|
2014-06-18 11:30:59 -05:00
|
|
|
num: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
2014-06-25 20:22:42 -05:00
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
2014-06-05 08:57:06 -05:00
|
|
|
`
|
2014-06-05 22:17:03 -05:00
|
|
|
|
2014-06-20 12:44:49 -05:00
|
|
|
const testTerraformPlanComputedStr = `
|
2014-06-25 20:22:42 -05:00
|
|
|
DIFF:
|
|
|
|
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.bar
|
2014-06-18 11:30:59 -05:00
|
|
|
foo: "" => "<computed>"
|
|
|
|
type: "" => "aws_instance"
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.foo
|
2014-07-07 16:57:41 -05:00
|
|
|
foo: "" => "<computed>"
|
|
|
|
num: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
|
|
|
const testTerraformPlanComputedIdStr = `
|
|
|
|
DIFF:
|
|
|
|
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.bar
|
2014-07-07 16:57:41 -05:00
|
|
|
foo: "" => "<computed>"
|
|
|
|
type: "" => "aws_instance"
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.foo
|
2014-07-07 16:57:41 -05:00
|
|
|
foo: "" => "<computed>"
|
2014-06-18 11:30:59 -05:00
|
|
|
num: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
2014-06-25 20:22:42 -05:00
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-08-30 19:25:34 -05:00
|
|
|
const testTerraformPlanComputedListStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.bar
|
|
|
|
foo: "" => "<computed>"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
CREATE: aws_instance.foo
|
|
|
|
list.#: "" => "<computed>"
|
|
|
|
num: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2016-12-10 18:17:29 -06:00
|
|
|
const testTerraformPlanComputedMultiIndexStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.bar
|
|
|
|
foo: "" => "<computed>"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
CREATE: aws_instance.foo.0
|
|
|
|
ip.#: "" => "<computed>"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
CREATE: aws_instance.foo.1
|
|
|
|
ip.#: "" => "<computed>"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-07-03 23:24:17 -05:00
|
|
|
const testTerraformPlanCountStr = `
|
|
|
|
DIFF:
|
|
|
|
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.bar
|
2014-07-03 23:24:17 -05:00
|
|
|
foo: "" => "foo,foo,foo,foo,foo"
|
|
|
|
type: "" => "aws_instance"
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.foo.0
|
2014-07-03 23:24:17 -05:00
|
|
|
foo: "" => "foo"
|
|
|
|
type: "" => "aws_instance"
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.foo.1
|
2014-07-03 23:24:17 -05:00
|
|
|
foo: "" => "foo"
|
|
|
|
type: "" => "aws_instance"
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.foo.2
|
2014-07-03 23:24:17 -05:00
|
|
|
foo: "" => "foo"
|
|
|
|
type: "" => "aws_instance"
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.foo.3
|
2014-07-03 23:24:17 -05:00
|
|
|
foo: "" => "foo"
|
|
|
|
type: "" => "aws_instance"
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.foo.4
|
2014-07-03 23:24:17 -05:00
|
|
|
foo: "" => "foo"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-10-03 00:02:59 -05:00
|
|
|
const testTerraformPlanCountIndexStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.foo.0
|
|
|
|
foo: "" => "0"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
CREATE: aws_instance.foo.1
|
|
|
|
foo: "" => "1"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-10-03 00:07:23 -05:00
|
|
|
const testTerraformPlanCountIndexZeroStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.foo
|
|
|
|
foo: "" => "0"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-10-02 19:24:22 -05:00
|
|
|
const testTerraformPlanCountOneIndexStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.bar
|
|
|
|
foo: "" => "foo"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
CREATE: aws_instance.foo
|
|
|
|
foo: "" => "foo"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-10-02 19:18:40 -05:00
|
|
|
const testTerraformPlanCountZeroStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.bar
|
|
|
|
foo: "" => ""
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-10-02 17:47:00 -05:00
|
|
|
const testTerraformPlanCountVarStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.bar
|
|
|
|
foo: "" => "foo,foo,foo"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
CREATE: aws_instance.foo.0
|
|
|
|
foo: "" => "foo"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
CREATE: aws_instance.foo.1
|
|
|
|
foo: "" => "foo"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
CREATE: aws_instance.foo.2
|
|
|
|
foo: "" => "foo"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-07-03 23:42:18 -05:00
|
|
|
const testTerraformPlanCountDecreaseStr = `
|
|
|
|
DIFF:
|
|
|
|
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.bar
|
2014-07-03 23:42:18 -05:00
|
|
|
foo: "" => "bar"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
DESTROY: aws_instance.foo.1
|
|
|
|
DESTROY: aws_instance.foo.2
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
aws_instance.foo.0:
|
|
|
|
ID = bar
|
|
|
|
foo = foo
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.foo.1:
|
|
|
|
ID = bar
|
|
|
|
aws_instance.foo.2:
|
|
|
|
ID = bar
|
|
|
|
`
|
|
|
|
|
2014-07-03 23:47:07 -05:00
|
|
|
const testTerraformPlanCountIncreaseStr = `
|
|
|
|
DIFF:
|
|
|
|
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.bar
|
2014-07-03 23:47:07 -05:00
|
|
|
foo: "" => "bar"
|
|
|
|
type: "" => "aws_instance"
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.foo.1
|
2014-07-03 23:47:07 -05:00
|
|
|
foo: "" => "foo"
|
|
|
|
type: "" => "aws_instance"
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.foo.2
|
2014-07-03 23:47:07 -05:00
|
|
|
foo: "" => "foo"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = bar
|
|
|
|
foo = foo
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2014-07-26 16:55:42 -05:00
|
|
|
const testTerraformPlanCountIncreaseFromOneStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.bar
|
|
|
|
foo: "" => "bar"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
CREATE: aws_instance.foo.1
|
|
|
|
foo: "" => "foo"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
CREATE: aws_instance.foo.2
|
|
|
|
foo: "" => "foo"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
aws_instance.foo.0:
|
|
|
|
ID = bar
|
|
|
|
foo = foo
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2015-03-01 23:39:48 -06:00
|
|
|
const testTerraformPlanCountIncreaseFromOneCorruptedStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.bar
|
|
|
|
foo: "" => "bar"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
DESTROY: aws_instance.foo
|
|
|
|
CREATE: aws_instance.foo.1
|
|
|
|
foo: "" => "foo"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
CREATE: aws_instance.foo.2
|
|
|
|
foo: "" => "foo"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = bar
|
|
|
|
foo = foo
|
|
|
|
type = aws_instance
|
|
|
|
aws_instance.foo.0:
|
|
|
|
ID = bar
|
|
|
|
foo = foo
|
|
|
|
type = aws_instance
|
|
|
|
`
|
|
|
|
|
2014-06-29 18:28:50 -05:00
|
|
|
const testTerraformPlanDestroyStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
DESTROY: aws_instance.one
|
|
|
|
DESTROY: aws_instance.two
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
aws_instance.one:
|
|
|
|
ID = bar
|
|
|
|
aws_instance.two:
|
|
|
|
ID = baz
|
|
|
|
`
|
|
|
|
|
2014-07-24 22:16:15 -05:00
|
|
|
const testTerraformPlanDiffVarStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.bar
|
|
|
|
num: "" => "3"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
UPDATE: aws_instance.foo
|
|
|
|
num: "2" => "3"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = bar
|
|
|
|
num = 2
|
|
|
|
`
|
|
|
|
|
2014-07-08 18:58:31 -05:00
|
|
|
const testTerraformPlanEmptyStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.bar
|
|
|
|
CREATE: aws_instance.foo
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2016-01-19 14:37:55 -06:00
|
|
|
const testTerraformPlanEscapedVarStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.foo
|
|
|
|
foo: "" => "bar-${baz}"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-09-23 16:15:40 -05:00
|
|
|
const testTerraformPlanModulesStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.bar
|
|
|
|
foo: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
CREATE: aws_instance.foo
|
|
|
|
num: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
CREATE: aws_instance.foo
|
|
|
|
num: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2015-04-14 12:48:45 -05:00
|
|
|
const testTerraformPlanModuleCycleStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.b
|
|
|
|
CREATE: aws_instance.c
|
|
|
|
some_input: "" => "<computed>"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-09-25 22:44:34 -05:00
|
|
|
const testTerraformPlanModuleDestroyStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
DESTROY: aws_instance.foo
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
DESTROY: aws_instance.foo
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = bar
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = bar
|
|
|
|
`
|
|
|
|
|
2015-05-06 22:13:19 -05:00
|
|
|
const testTerraformPlanModuleDestroyCycleStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
module.a_module:
|
|
|
|
DESTROY: aws_instance.a
|
|
|
|
module.b_module:
|
|
|
|
DESTROY: aws_instance.b
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
module.a_module:
|
|
|
|
aws_instance.a:
|
|
|
|
ID = a
|
|
|
|
module.b_module:
|
|
|
|
aws_instance.b:
|
|
|
|
ID = b
|
|
|
|
`
|
|
|
|
|
2014-12-05 17:18:45 -06:00
|
|
|
const testTerraformPlanModuleDestroyMultivarStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
DESTROY: aws_instance.foo.0
|
|
|
|
DESTROY: aws_instance.foo.1
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
module.child:
|
|
|
|
aws_instance.foo.0:
|
|
|
|
ID = bar0
|
|
|
|
aws_instance.foo.1:
|
|
|
|
ID = bar1
|
|
|
|
`
|
|
|
|
|
2014-09-23 18:44:21 -05:00
|
|
|
const testTerraformPlanModuleInputStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.bar
|
|
|
|
foo: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
CREATE: aws_instance.foo
|
|
|
|
foo: "" => "42"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-09-23 19:05:44 -05:00
|
|
|
const testTerraformPlanModuleInputComputedStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.bar
|
|
|
|
foo: "" => "<computed>"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
CREATE: aws_instance.foo
|
|
|
|
foo: "" => "<computed>"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-09-23 18:55:19 -05:00
|
|
|
const testTerraformPlanModuleInputVarStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.bar
|
|
|
|
foo: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
CREATE: aws_instance.foo
|
|
|
|
foo: "" => "52"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-11-28 13:16:33 -06:00
|
|
|
const testTerraformPlanModuleMultiVarStr = `
|
|
|
|
DIFF:
|
|
|
|
|
2014-12-02 13:53:09 -06:00
|
|
|
CREATE: aws_instance.parent.0
|
|
|
|
CREATE: aws_instance.parent.1
|
|
|
|
|
2014-11-28 13:16:33 -06:00
|
|
|
module.child:
|
|
|
|
CREATE: aws_instance.bar.0
|
|
|
|
baz: "" => "baz"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
CREATE: aws_instance.bar.1
|
|
|
|
baz: "" => "baz"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
CREATE: aws_instance.foo
|
|
|
|
foo: "" => "baz,baz"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-09-23 16:57:17 -05:00
|
|
|
const testTerraformPlanModuleOrphansStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.foo
|
|
|
|
num: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
DESTROY: aws_instance.foo
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = baz
|
|
|
|
`
|
|
|
|
|
2016-12-13 23:22:21 -06:00
|
|
|
const testTerraformPlanModuleProviderVarStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
CREATE: aws_instance.test
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
value: "" => "hello"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-09-23 18:07:41 -05:00
|
|
|
const testTerraformPlanModuleVarStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.bar
|
|
|
|
foo: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
CREATE: aws_instance.foo
|
|
|
|
num: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-09-23 18:27:38 -05:00
|
|
|
const testTerraformPlanModuleVarComputedStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.bar
|
|
|
|
foo: "" => "<computed>"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
CREATE: aws_instance.foo
|
|
|
|
foo: "" => "<computed>"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-12-16 00:10:16 -06:00
|
|
|
const testTerraformPlanModuleVarIntStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
module.child:
|
|
|
|
CREATE: aws_instance.foo
|
|
|
|
num: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
|
|
|
|
2014-06-25 23:58:33 -05:00
|
|
|
const testTerraformPlanOrphanStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
DESTROY: aws_instance.baz
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.foo
|
2014-06-25 23:58:33 -05:00
|
|
|
num: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
aws_instance.baz:
|
|
|
|
ID = bar
|
|
|
|
`
|
|
|
|
|
2014-06-25 20:22:42 -05:00
|
|
|
const testTerraformPlanStateStr = `
|
|
|
|
DIFF:
|
|
|
|
|
2014-07-08 18:58:31 -05:00
|
|
|
CREATE: aws_instance.bar
|
2014-06-25 20:22:42 -05:00
|
|
|
foo: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
UPDATE: aws_instance.foo
|
|
|
|
num: "" => "2"
|
2014-09-20 00:01:51 -05:00
|
|
|
type: "" => "aws_instance"
|
2014-06-25 20:22:42 -05:00
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = bar
|
2014-06-05 22:17:03 -05:00
|
|
|
`
|
2014-07-22 12:30:42 -05:00
|
|
|
|
|
|
|
const testTerraformPlanTaintStr = `
|
|
|
|
DIFF:
|
|
|
|
|
2014-09-17 20:03:19 -05:00
|
|
|
DESTROY/CREATE: aws_instance.bar
|
2014-07-22 12:30:42 -05:00
|
|
|
foo: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
2016-04-21 14:59:10 -05:00
|
|
|
aws_instance.bar: (tainted)
|
|
|
|
ID = baz
|
2014-09-19 17:04:21 -05:00
|
|
|
aws_instance.foo:
|
|
|
|
ID = bar
|
|
|
|
num = 2
|
|
|
|
`
|
|
|
|
|
2016-10-27 07:44:59 -05:00
|
|
|
const testTerraformPlanTaintIgnoreChangesStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
DESTROY/CREATE: aws_instance.foo
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
vars: "" => "foo"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
aws_instance.foo: (tainted)
|
|
|
|
ID = foo
|
|
|
|
type = aws_instance
|
|
|
|
vars = foo
|
|
|
|
`
|
|
|
|
|
2014-09-19 17:04:21 -05:00
|
|
|
const testTerraformPlanMultipleTaintStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
DESTROY/CREATE: aws_instance.bar
|
|
|
|
foo: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
aws_instance.bar: (2 tainted)
|
|
|
|
ID = <not created>
|
|
|
|
Tainted ID 1 = baz
|
|
|
|
Tainted ID 2 = zip
|
2014-07-22 12:30:42 -05:00
|
|
|
aws_instance.foo:
|
|
|
|
ID = bar
|
|
|
|
num = 2
|
|
|
|
`
|
2014-08-05 12:12:35 -05:00
|
|
|
|
|
|
|
const testTerraformPlanVarMultiCountOneStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.bar
|
|
|
|
foo: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
CREATE: aws_instance.foo
|
|
|
|
num: "" => "2"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
2014-10-07 22:09:30 -05:00
|
|
|
|
|
|
|
const testTerraformPlanPathVarStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_instance.foo
|
|
|
|
cwd: "" => "%s/barpath"
|
|
|
|
module: "" => "%s/foopath"
|
|
|
|
root: "" => "%s/barpath"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
2015-08-09 03:02:28 -05:00
|
|
|
|
|
|
|
const testTerraformPlanIgnoreChangesStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
UPDATE: aws_instance.foo
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = bar
|
|
|
|
ami = ami-abcd1234
|
|
|
|
`
|
2016-07-07 13:14:33 -05:00
|
|
|
|
2016-09-02 08:44:35 -05:00
|
|
|
const testTerraformPlanIgnoreChangesWildcardStr = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
aws_instance.foo:
|
|
|
|
ID = bar
|
|
|
|
ami = ami-abcd1234
|
|
|
|
instance_type = t2.micro
|
|
|
|
`
|
|
|
|
|
2016-07-07 13:14:33 -05:00
|
|
|
const testTerraformPlanComputedValueInMap = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
CREATE: aws_computed_source.intermediates
|
|
|
|
computed_read_only: "" => "<computed>"
|
|
|
|
|
|
|
|
module.test_mod:
|
|
|
|
CREATE: aws_instance.inner2
|
|
|
|
looked_up: "" => "<computed>"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>
|
|
|
|
`
|
2016-07-13 12:23:56 -05:00
|
|
|
|
|
|
|
const testTerraformPlanModuleVariableFromSplat = `
|
|
|
|
DIFF:
|
|
|
|
|
|
|
|
module.mod1:
|
|
|
|
CREATE: aws_instance.test.0
|
|
|
|
thing: "" => "doesnt"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
CREATE: aws_instance.test.1
|
|
|
|
thing: "" => "doesnt"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
module.mod2:
|
|
|
|
CREATE: aws_instance.test.0
|
|
|
|
thing: "" => "doesnt"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
CREATE: aws_instance.test.1
|
|
|
|
thing: "" => "doesnt"
|
|
|
|
type: "" => "aws_instance"
|
|
|
|
|
|
|
|
STATE:
|
|
|
|
|
|
|
|
<no state>`
|
2016-08-09 15:14:40 -05:00
|
|
|
|
|
|
|
const testTerraformInputHCL = `
|
|
|
|
hcl_instance.hcltest:
|
|
|
|
ID = foo
|
|
|
|
bar.w = z
|
|
|
|
bar.x = y
|
|
|
|
foo.# = 2
|
|
|
|
foo.0 = a
|
|
|
|
foo.1 = b
|
|
|
|
type = hcl_instance
|
|
|
|
`
|
2016-10-23 20:53:00 -05:00
|
|
|
|
|
|
|
const testTerraformRefreshDataRefDataStr = `
|
|
|
|
data.null_data_source.bar:
|
|
|
|
ID = foo
|
|
|
|
bar = yes
|
|
|
|
type = null_data_source
|
|
|
|
|
|
|
|
Dependencies:
|
|
|
|
data.null_data_source.foo
|
|
|
|
data.null_data_source.foo:
|
|
|
|
ID = foo
|
|
|
|
foo = yes
|
|
|
|
type = null_data_source
|
|
|
|
`
|