Commit Graph

1275 Commits

Author SHA1 Message Date
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
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
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
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
Mitchell Hashimoto
cbbd492bce
terraform: shadow resource provider Apply 2016-10-11 22:17:27 +08:00
Mitchell Hashimoto
3522b07b75
terraform: Shadow resource provider Configure 2016-10-11 22:17:27 +08:00
Mitchell Hashimoto
23204d2414
terraform: ResourceProvider.Validate for shadow 2016-10-11 22:17:27 +08:00
Mitchell Hashimoto
bb5f116cec
terraform: shadow resource provider tests begin 2016-10-11 22:17:27 +08:00
Mitchell Hashimoto
d37bb87bf2
terraform: ResourceConfig.DeepCopy should handle the nil case 2016-10-11 22:17:27 +08:00
Mitchell Hashimoto
37f5c6ae26
terraform: ResourceConfig.Equal handles nil case 2016-10-11 22:17:27 +08:00
Mitchell Hashimoto
f73dc844c7
wip 2016-10-11 22:17:27 +08:00
Mitchell Hashimoto
1df3bbdc37
terraform: working on the resource provider shadow, not working yet 2016-10-11 22:17:27 +08:00
Mitchell Hashimoto
35f13f9c52
terraform: wip on shadow graph, compiles 2016-10-11 22:17:27 +08:00
Mitchell Hashimoto
8c9097f454
terraform: orphaned grandchild module inherits provider config
This fixes an issue where orphaned grandchild modules don't properly
inherit their provider configurations from grandparents. I found this
while working on shadow graphs (the shadow graph actually caught an
inconsistency between runs and exposed this bug!), so I'm unsure if this
affects any issue.

To better explain the issue, I'll diagram things.

Here is a hierarchy that _works_ (w/o this PR):

```
root
|-- child1 (orphan)
|-- child2
    |-- grandchild
```

All modules in this case will successfully inherit provider
configurations from "root".

Here is a hierarchy that _doesn't work without this PR_:

```
root
|-- child1 (orphan)
    |-- grandchild (orphan)
```

In this case, `child1` does successfully inherit the provider from root,
but `grandchild` _will not_ unless `child1` had resources. If `child1`
has no resources, it wouldn't inherit anything. This PR fixes that.
2016-10-11 15:51:27 +08:00
clint
3e3854ed65 release: clean up after v0.7.5 2016-10-06 17:57:23 +00:00
clint
f7fa785925
v0.7.5 2016-10-06 17:41:22 +00:00
James Bardin
828aa7cfb4 Merge pull request #9062 from hashicorp/jbardin/race-fix
Fix race on Provisioner.RawConfig
2016-10-04 12:23:31 -04:00
James Bardin
77a64e7cb3 Merge pull request #9079 from hashicorp/jbardin/json-map
Allow map variables from json
2016-10-04 12:22:57 -04:00
Mitchell Hashimoto
ea342b793b
Update reflectwalk vendor to fix State.DeepCopy
The real reasoning for this can be found in #9, #10, and #11. All
these vendor updates aim to fix that issue, with minor adjustments
2016-09-27 19:52:12 -07:00
Mitchell Hashimoto
f897fa4701
terraform: ResourceConfig.Equal and tests 2016-09-27 18:52:32 -07:00
Mitchell Hashimoto
56901e5cfd
terraform: ResourceConfig.DeepCopy
This implements DeepCopy, still need to implement Equals to make this
more useful. Coming in the next commit but this still has its own full
functionality + tests.
2016-09-27 16:09:32 -07:00
James Bardin
3297a460c7 Allow map variables from json
A JSON object will be decoded as a list with a single map value. This
will be properly coerced later, so let it through the initial config
semantic checks.
2016-09-27 13:29:14 -04:00
James Bardin
475e0f1e6b Fix race on Provisioner.RawConfig
A race when accessing Provisioner.RawConfig can cause unexpected output
for provisioners that interpolate variables. Use RawConfig.Copy which
needs to acquire the RawConfig mutex to get the values.

Fixes #8890
2016-09-26 14:34:05 -04:00
Kyle Havlovitz
3a2819de25 core: Fixed variables not being in scope for destroy -target on modules 2016-09-23 19:05:40 -04:00
James Bardin
e58c6cf7da release: clean up after v0.7.4 2016-09-19 19:37:54 +00:00
James Bardin
84592f5967
v0.7.4 2016-09-19 19:13:49 +00:00
James Bardin
e5ff4d5bd4 create some unlocked methods for State
State.Init() needs to be called externally, so make sure it only calls
unlocked internal methods once a lock is acquired.
2016-09-16 09:59:04 -04:00
James Bardin
90aab0105d Add locks to InstanceState
Rename receivers for consistency
2016-09-16 09:59:04 -04:00
James Bardin
8d5080fe72 Lock all ResourceState methods
Also rename receivers so they are consistent.
2016-09-16 09:59:04 -04:00
James Bardin
469e71a488 add locks to all exported ModuleState methods 2016-09-16 09:59:04 -04:00
James Bardin
f1b44e36b4 add lock to OutputState.Equal 2016-09-16 09:59:04 -04:00
James Bardin
1235623fad Add locks to exported RemoteState methods 2016-09-16 09:59:04 -04:00
James Bardin
0be90c8994 Add locks to all exported State methods
move implementation into private methods when needed
2016-09-16 09:59:04 -04:00