Commit Graph

16 Commits

Author SHA1 Message Date
Mitchell Hashimoto
9900bd752a
terraform: string through the context meta 2017-03-13 16:21:09 -07:00
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
Mitchell Hashimoto
aa5d16be79
terraform: shadow errors with UUID() must be ignored
People with `uuid()` usage in their configurations would receive shadow
errors every time on plan because the UUID would change.

This is hacky fix but I also believe correct: if a shadow error contains
uuid() then we ignore the shadow error completely. This feels wrong but
I'll explain why it is likely right:

The "right" feeling solution is to create deterministic random output
across graph runs. This would require using math/rand and seeding it
with the same value each run. However, this alone probably won't work
due to Terraform's parallelism and potential to call uuid() in different
orders. In addition to this, you can't seed crypto/rand and its unlikely
that we'll NEVER use crypto/rand in the future even if we switched
uuid() to use math/rand.

Therefore, the solution is simple: if there is no shadow error, no
problem. If there is a shadow error and it contains uuid(), then ignore
it.
2016-11-14 10:20:26 -08:00
Mitchell Hashimoto
d27c8fbbbc
terraform: compared states from shadow graph must be pruned 2016-10-19 15:01:54 -07:00
Mitchell Hashimoto
baa59ff75d
terraform: fix go vet issues by not using *c to copy 2016-10-12 19:47:21 +08:00
Mitchell Hashimoto
70cee9c1c6
terraform: clean up any final TODOs with comments and placeholders 2016-10-12 19:03:41 +08:00
Mitchell Hashimoto
b0801bf125
terraform: ResourceProvider.ReadDataDiff (shadow) 2016-10-11 22:17:31 +08:00
Mitchell Hashimoto
a014b098b0
terraform: copy the provider input configs for the shadow context 2016-10-11 22:17:30 +08:00
Mitchell Hashimoto
5c1af55711
terraform: don't run the shadow graph on interrupt 2016-10-11 22:17:30 +08:00
Mitchell Hashimoto
3edb8599b1
terraform: Shadow interface, properly string through errors at the right
time
2016-10-11 22:17:29 +08:00
Mitchell Hashimoto
184b4a8b09
terraform: context verifies real and shadow state/diff match 2016-10-11 22:17:29 +08:00
Mitchell Hashimoto
3e7665db09
terraform: shadow component factory supports closing 2016-10-11 22:17:29 +08: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
Mitchell Hashimoto
742af8752b
terraform: run the shadow graph for Apply operations (everything fails) 2016-10-11 22:17:28 +08:00
Mitchell Hashimoto
02e93f5920
terraform: shadowResourceProviderFactory
This helper helps create the factory maps for the context.
2016-10-11 22:17:28 +08:00
Mitchell Hashimoto
9ae9f208d1
terraform: Context knows how to walk a shadow graph and report errors 2016-10-11 22:17:28 +08:00