Mitchell Hashimoto
70cee9c1c6
terraform: clean up any final TODOs with comments and placeholders
2016-10-12 19:03:41 +08:00
Mitchell Hashimoto
9a876f65ba
terraform: compare diffs on shadow Apply
2016-10-12 19:01:02 +08:00
Mitchell Hashimoto
7f04b33d3d
terraform: enable shadow walking on Refresh and Validate
2016-10-12 18:57:52 +08:00
Mitchell Hashimoto
98fa7d92a4
terraform: support data source apply for shadows
2016-10-12 18:56:57 +08:00
Mitchell Hashimoto
4c951428d7
terraform: enable shadow on destroy and Plan
2016-10-12 18:50:41 +08:00
Mitchell Hashimoto
a9f1166583
terraform: use KeyedValue.Init to avoid initialization race
...
There were races with ValidateResource in the provider initializing the
data which resulting in lost data for the shadow. A new "Init" function
has been added to the shadow structs to support safe concurrent
initialization.
2016-10-12 18:47:52 +08:00
Mitchell Hashimoto
10bcdd04d4
helper/shadow: KeyedValue.Init
2016-10-12 18:45:40 +08:00
Mitchell Hashimoto
b0801bf125
terraform: ResourceProvider.ReadDataDiff (shadow)
2016-10-11 22:17:31 +08:00
Mitchell Hashimoto
31f8d13678
terraform: Diff.Equal and tests
2016-10-11 22:17:31 +08:00
Mitchell Hashimoto
30596ca371
terraform: sanity test (passes, always passed)
2016-10-11 22:17:31 +08:00
Mitchell Hashimoto
c2dd9a7338
terraform: Provier.Diff (shadow) deep copy the config before call
2016-10-11 22:17:31 +08:00
Mitchell Hashimoto
817979c56d
terraform: ResourceProvider.ValidateResource (shadow) config deep copy
2016-10-11 22:17:31 +08:00
Mitchell Hashimoto
d7a5cc5b35
terraform: InstanceInfo.uniqueId
...
This adds a new function to get a unique identifier scoped to the graph
walk in order to identify operations against the same instance. This is
used by the shadow to namespace provider function calls.
2016-10-11 22:17:30 +08:00
Mitchell Hashimoto
e2fc0b518f
terraform: ShadowError returns errors, not the close operation
2016-10-11 22:17:30 +08:00
Mitchell Hashimoto
d30cfef4d2
terraform: remove shadow eval context since we're not shadowing that
...
We allow the built in context to work as expected and shadow just the
components now. This is better since it allows us to use much more of
the REAL structures.
2016-10-11 22:17:30 +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
fdeb4656c9
terraform: deep copy shadow arguments to avoid state modifications
...
The arguments passed into Apply, Refresh, Diff could be modified which
caused the shadow comparison later to cause errors. Also, the result
should be deep copied so that it isn't modified.
2016-10-11 22:17:30 +08:00
Mitchell Hashimoto
4de803622d
terraform: ResourceProvisioner shadow
2016-10-11 22:17:30 +08:00
Mitchell Hashimoto
50e0647c53
helper/shadow: ComparedValue
2016-10-11 22:17:30 +08:00
Mitchell Hashimoto
548a585762
terraform: unique ID for destroying resources
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
61c789aace
terraform: shadow graph runs in sequence after the real graph
2016-10-11 22:17:30 +08:00
Mitchell Hashimoto
a355d4ad55
terraform: deposed should have a unique ID for instance info
2016-10-11 22:17:30 +08:00
Mitchell Hashimoto
24456c042a
terraform: ResourceProvider (shadow) ValidateResource
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
c92ee5a8bd
helper/shadow: KeyedValue.WaitForChange returns immediately if closed
2016-10-11 22:17:29 +08:00
Mitchell Hashimoto
0408c2dfb2
helper/shadow: KeyedValue.WaitForChange
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
62162427f4
terraform: ResourceProvider (shadow) CloseShadow closes all shadow
...
values
2016-10-11 22:17:29 +08:00
Mitchell Hashimoto
47f4343bf5
helper/shadow: KeyedValue add test case to avoid panic
2016-10-11 22:17:29 +08:00
Mitchell Hashimoto
136ac4728d
helper/shadow: KeyedValue.Close
2016-10-11 22:17:29 +08:00
Mitchell Hashimoto
d2fb630df8
helper/shadow: Value.Close
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
8ef35d7561
terraform: simplify the shadow component factory
...
This unifies shadow/real under one since it was really just a basic
switch of what to return.
2016-10-11 22:17:29 +08:00
Mitchell Hashimoto
89e8656c6b
terraform: component uid includes the path
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
5053872e82
terraform: Diff.DeepCopy test to catch a bug that in copystructure
...
This was fixed upstream but keeping the test around to prevent
regressions.
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
f7134d95e4
terraform: Diff.DeepCopy
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
Mitchell Hashimoto
3504054b1e
terraform: EvalContext.CloseProvider (shadow) works if never init
2016-10-11 22:17:28 +08:00
Mitchell Hashimoto
d6168edc50
helper/shadow: KeyedValue.ValueOk
2016-10-11 22:17:28 +08:00
Mitchell Hashimoto
17b909a59b
terraform: EvalContext.CloseProvider (shadow)
2016-10-11 22:17:28 +08:00
Mitchell Hashimoto
ea8e7659e2
terraform: EvalContext.Provider (shadow)
2016-10-11 22:17:28 +08:00
Mitchell Hashimoto
ce56712473
terraform: EvalContext.InitProvider(shadow) test double init
2016-10-11 22:17:28 +08:00
Mitchell Hashimoto
792a9f1de4
terraform: EvalContext.InitProvider (shadow) tests
2016-10-11 22:17:28 +08:00
Mitchell Hashimoto
fb96b0c422
terraform: EvalContext.initProvider shadow
2016-10-11 22:17:28 +08:00
Mitchell Hashimoto
51ac3c5969
terraform: ResourceProvider.Refresh (shadow)
2016-10-11 22:17:28 +08:00
Mitchell Hashimoto
82a1158f55
terraform: ResourceProvider.Diff shadow
2016-10-11 22:17:28 +08:00