diff --git a/.travis.yml b/.travis.yml index 2b1501a62..b0c3641ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ install: - bash scripts/gogetcookie.sh script: - make test vet +- make test TEST=./terraform TESTARGS=-Xnew-apply branches: only: - master diff --git a/command/meta.go b/command/meta.go index f18b910d4..aaeb151ea 100644 --- a/command/meta.go +++ b/command/meta.go @@ -328,6 +328,9 @@ func (m *Meta) flagSet(n string) *flag.FlagSet { f.Var((*FlagKVFile)(&m.autoVariables), m.autoKey, "variable file") } + // Experimental features + f.BoolVar(&terraform.X_newApply, "Xnew-apply", false, "experiment: new apply") + // Create an io.Writer that writes to our Ui properly for errors. // This is kind of a hack, but it does the job. Basically: create // a pipe, use a scanner to break it into lines, and output each line diff --git a/terraform/context.go b/terraform/context.go index 49054ffff..b8788ad86 100644 --- a/terraform/context.go +++ b/terraform/context.go @@ -17,9 +17,14 @@ import ( // is called on Context. type InputMode byte +// Variables prefixed with X_ are experimental features. They can be enabled +// by setting them to true. This should be done before any API is called. +// These should be expected to be removed at some point in the future; each +// option should mention a schedule. var ( - // NOTE: Internal only to toggle between the new and old apply graph - newApplyGraph = true + // X_newApply will enable the new apply graph. This will be removed + // and be on by default in 0.8.0. + X_newApply = false ) const ( @@ -363,7 +368,7 @@ func (c *Context) Apply() (*State, error) { // our new graph builder. var graph *Graph var err error - if c.destroy || !newApplyGraph { + if c.destroy || !X_newApply { graph, err = c.Graph(&ContextGraphOpts{Validate: true}) } else { graph, err = (&ApplyGraphBuilder{ diff --git a/terraform/terraform_test.go b/terraform/terraform_test.go index dd6185613..d81e2f1cb 100644 --- a/terraform/terraform_test.go +++ b/terraform/terraform_test.go @@ -22,8 +22,17 @@ import ( const fixtureDir = "./test-fixtures" func TestMain(m *testing.M) { + // Experimental features + xNewApply := flag.Bool("Xnew-apply", false, "Experiment: new apply graph") + flag.Parse() + // Setup experimental features + X_newApply = *xNewApply + if X_newApply { + println("Xnew-apply enabled") + } + if testing.Verbose() { // if we're verbose, use the logging requested by TF_LOG logging.SetOutput()