Commit Graph

29 Commits

Author SHA1 Message Date
Mitchell Hashimoto f8c7b639c9
terraform: switch to Context for stop, Stoppable provisioners
This switches to the Go "context" package for cancellation and threads
the context through all the way to evaluation to allow behavior based on
stopping deep within graph execution.

This also adds the Stop API to provisioners so they can quickly exit
when stop is called.
2017-01-26 15:03:27 -08:00
James Bardin 6f9744292a Replace DebugGraphs with the Graph's methods
Now that the Graph can serialize itself, and log transformations,
there's no need for DebugGraph
2016-11-14 08:52:18 -05:00
James Bardin 797a1b339d DebugInfo and DebugGraph
Implement debugInfo and the DebugGraph

DebugInfo will be a global variable through which graph debug
information can we written to a compressed archive. The DebugInfo
methods are all safe for concurrent use, and noop with a nil receiver.
The API outside of the terraform package will be to call SetDebugInfo
to create the archive, and CloseDebugInfo() to properly close the file.
Each write to the archive will be flushed and sync'ed individually, so
in the event of a crash or a missing call to Close, the archive can
still be recovered.

The DebugGraph is a representation of a terraform Graph to be written to
the debug archive, currently in dot format. The DebugGraph also contains
an internal buffer with Printf and Write methods to add to this buffer.
The buffer will be written to an accompanying file in the debug archive
along with the graph.

This also adds a GraphNodeDebugger interface. Any node implementing
`NodeDebug() string` can output information to annotate the debug graph
node, and add the data to the log. This interface may change or be
removed to provide richer options for debugging graph nodes.

The new graph builders all delegate the build to the BasicGraphBuilder.
Having a Name field lets us differentiate the actual builder
implementation in the debug graphs.
2016-11-04 11:30:51 -04:00
Mitchell Hashimoto 0b00bbde4e
terraform: switch to a component factory
This is necessary so that the shadow version can actually keep track of
what provider is used for what. Before, providers for different alises
were just initialized but the factory had no idea. Arguably this is fine
but when trying to build a shadow graph this presents challenges.

With these changes, we now pass an opaque "uid" through that is used to
keep track of the providers and what real maps to what shadow.
2016-10-11 22:17:29 +08:00
James Nugent e57a399d71 core: Use native HIL maps instead of flatmaps
This changes the representation of maps in the interpolator from the
dotted flatmap form of a string variable named "var.variablename.key"
per map element to use native HIL maps instead.

This involves porting some of the interpolation functions in order to
keep the tests green, and adding support for map outputs.

There is one backwards incompatibility: as a result of an implementation
detail of maps, one could access an indexed map variable using the
syntax "${var.variablename.key}".

This is no longer possible - instead HIL native syntax -
"${var.variablename["key"]}" must be used. This was previously
documented, (though not heavily used) so it must be noted as a backward
compatibility issue for Terraform 0.7.
2016-05-10 14:49:13 -04:00
Paul Hinze 024dcc9d32 terraform: share graph walker's variables lock w/ interpolater
The ContextGraphWalker struct includes a lock that's passed down to
BuiltinEvalContext and guards access to interpolation variables as
they're written using SetVariables.

The likely problem being expressed in #5733 is that the same map
reference is also passed down to the Interpolater.Variables field, which
is used for variable lookup.

Here, we plumb the same lock we're using to guard access for writes down
and acquire it before doing variable reads as well. It's not as fine
grained as perhaps it could be, but all the context tests pass and I
believe this should address #5733.
2016-03-21 18:21:44 -05:00
Paul Hinze 8472c7d59f core: log eval tree operations 2016-02-24 09:49:11 -06:00
Paul Hinze 545aaf1864 core: demote evaltree loglevel from INFO -> TRACE
One small step in the long road to making our log levels actually
useful. :)
2016-01-21 10:20:53 -06:00
Paul Hinze 715437537d command: fix flaky parallelism tests
Thanks to @mitchellh for helping sort out concurrency stuff here.
2015-10-29 15:16:34 -05:00
Mitchell Hashimoto c207beda36 terraform: set variables in the proper location 2015-05-01 16:29:19 -07:00
Mitchell Hashimoto f2e7f505d4 terraform: subpath context setting 2015-05-01 14:19:32 -07:00
Mitchell Hashimoto fa222a44c3 terraform: limit parallelism 2015-02-19 12:08:34 -08:00
Mitchell Hashimoto ae68cf1705 terraform: slightly better validation error messages 2015-02-19 12:08:33 -08:00
Mitchell Hashimoto 7ccba588ac terraform: gofmt -w -r 'Context2 -> Context' terraform/ 2015-02-19 12:08:32 -08:00
Mitchell Hashimoto 7c78a3749e terraform: provider input 2015-02-19 12:08:08 -08:00
Mitchell Hashimoto a614f6105a terraform: apply starting 2015-02-19 12:08:04 -08:00
Mitchell Hashimoto e089e34c89 terraform: graph walk should handle eval errors properly 2015-02-19 12:08:02 -08:00
Mitchell Hashimoto 23d097ee53 terraform: module inputs are passed through to subgraphs 2015-02-19 12:08:01 -08:00
Mitchell Hashimoto aae2d4c780 terraform: starting up the plans 2015-02-19 12:08:00 -08:00
Mitchell Hashimoto 379c37dd06 terraform: refresh hooks 2015-02-19 12:08:00 -08:00
Mitchell Hashimoto 1e962b868d terraform: Refresh, Read/Write state 2015-02-19 12:08:00 -08:00
Mitchell Hashimoto 863b9a4f45 terraform: filter eval nodes on operation 2015-02-19 12:07:59 -08:00
Mitchell Hashimoto d847b2b672 terraform: provider config inheritance in modules 2015-02-19 12:07:59 -08:00
Mitchell Hashimoto d94c4392eb terraform: validate provisioners 2015-02-19 12:07:58 -08:00
Mitchell Hashimoto 31f6b7474d terraform: more tests 2015-02-19 12:07:58 -08:00
Mitchell Hashimoto b8bc3dc19b terraform: provider should be cached by path 2015-02-19 12:07:58 -08:00
Mitchell Hashimoto 28a23a45f4 terraform: dynamic subgraph expansion for count 2015-02-19 12:07:57 -08:00
Mitchell Hashimoto 81856f99ba terraform: better comments 2015-02-19 12:07:56 -08:00
Mitchell Hashimoto 58347617e8 terraform: trying this graphwalker thing 2015-02-19 12:07:56 -08:00