Commit Graph

1402 Commits

Author SHA1 Message Date
Mitchell Hashimoto 2e8a419fd8
terraform: starting work on destroy 2016-10-19 13:38:51 -07:00
Mitchell Hashimoto dfa02e4412
terraform: rename attach config to only attach provider config 2016-10-19 13:38:51 -07:00
Mitchell Hashimoto 0e666aa575
terraform: get tests to not panic on failures 2016-10-19 13:38:51 -07:00
Mitchell Hashimoto 0463ad74a8
terraform: RootVariableTransform 2016-10-19 13:38:51 -07:00
Mitchell Hashimoto 993c29f34a
terraform: move ModuleVariableTransformer to its own file 2016-10-19 13:38:51 -07:00
Mitchell Hashimoto 0d815872e1
terraform: tests for module variable node 2016-10-19 13:38:51 -07:00
Mitchell Hashimoto 3fb83f013e
terraform: depend on parent items 2016-10-19 13:38:51 -07:00
Mitchell Hashimoto ad03a21040
terraform: rename to ModuleVariable 2016-10-19 13:38:51 -07:00
Mitchell Hashimoto 4dfdc52ba0
terraform: first stap at module variables, going to redo some things 2016-10-19 13:38:51 -07:00
Mitchell Hashimoto 6376c4ca9b
terraform: update comment 2016-10-19 13:38:51 -07:00
Mitchell Hashimoto f2aa880625
terraform: proper prefix for output connects 2016-10-19 13:38:50 -07:00
Mitchell Hashimoto 7d07f20893
terraform: fix references to module outputs 2016-10-19 13:38:50 -07:00
Mitchell Hashimoto 0d7674b079
terraform: apply builder adds outputs to graphs 2016-10-19 13:38:50 -07:00
Mitchell Hashimoto ba51295267
terraform: ReferenceTransform test 2016-10-19 13:38:50 -07:00
Mitchell Hashimoto 21888b1227
terraform: test for referencetransform for modules 2016-10-19 13:38:50 -07:00
Mitchell Hashimoto 994f5ce773
terraform: ReferenceTransform to connect references 2016-10-19 13:38:50 -07:00
Mitchell Hashimoto e9e8304e95
terraform: new output transform that isn't used yet 2016-10-19 13:38:50 -07:00
Mitchell Hashimoto 7dd4813730
terraform: rename test to be more easily targetable 2016-10-19 13:38:50 -07:00
Mitchell Hashimoto 5220cba77c
terraform: enable provisioners to execute 2016-10-19 13:38:50 -07:00
Mitchell Hashimoto 0f0eecfee7
terraform: add provisioner nodes to the apply graph 2016-10-19 13:38:50 -07:00
Mitchell Hashimoto 4033e90474
terraform: clarify commment 2016-10-19 13:38:50 -07:00
Mitchell Hashimoto 39abec4970
terraform: NodeApplyableProvider evals with config 2016-10-19 13:38:50 -07:00
Mitchell Hashimoto 79a742c1ae
terraform: new provider graph node for flattened world 2016-10-19 13:38:49 -07:00
Mitchell Hashimoto b2ef4e9ac0
terraform: add way to toggle the graphs to use for apply 2016-10-19 13:38:49 -07:00
Mitchell Hashimoto 11578f0792
terraform: tests for ParentProviderTransformer 2016-10-19 13:38:49 -07:00
Mitchell Hashimoto 87bff933ef
terraform: ParentProviderTransform to connect parent providers 2016-10-19 13:38:49 -07:00
Mitchell Hashimoto ba751c4e3b
terraform: comment to avoid panic 2016-10-19 13:38:49 -07:00
Mitchell Hashimoto e784e4a434
terraform: remove more nil panics (doesn't change test logic) 2016-10-19 13:38:49 -07:00
Mitchell Hashimoto 9ea9e52185
terraform: rename Config to Module, tests for diff transform 2016-10-19 13:38:49 -07:00
Mitchell Hashimoto dcc3eb3011
terraform: test for ResourceAddress.stateId() 2016-10-19 13:38:49 -07:00
Mitchell Hashimoto 5828a0a9ac
terraform: minimal applies work! 2016-10-19 13:38:49 -07:00
Mitchell Hashimoto dc9b9eee44
terraform: connect providers in the apply graph 2016-10-19 13:38:49 -07:00
Mitchell Hashimoto 77b9177bd5
terraform: an incredible number of failing tests! 2016-10-19 13:38:49 -07:00
Mitchell Hashimoto 3f090df26e
terraform: start apply-based graph builder, basic diff transform 2016-10-19 13:38:01 -07:00
Mitchell Hashimoto 361bc5a8df
terraform: parse internal resource addresses used in state/diff 2016-10-19 13:38:01 -07:00
Mitchell Hashimoto 50afee2a30
terraform: Diff.Empty should be true for nil Diff 2016-10-19 13:38:01 -07:00
Mitchell Hashimoto 0fe51b334c Merge pull request #9334 from hashicorp/f-shadow-graph
terraform: Shadow Graph
2016-10-19 13:36:10 -07:00
Mitchell Hashimoto 35d1868618
terraform: remove ModuleDiff.GoString
To address comments by @jbardin re: if we had a mutex this will fail
vet.
2016-10-19 10:07:47 -07:00
James Nugent 9e02431ed8 release: clean up after v0.7.7 2016-10-18 13:46:02 +00:00
James Nugent fa6a83ebdc
v0.7.7 2016-10-18 13:36:31 +00:00
Mitchell Hashimoto e2c415a87e
terraform: resource provider must never return pointers to same data
This is a requirement for the parallelism of Terraform to work sanely.
We could deep copy every result but I think this would be unrealistic
and impose a performance cost when it isn't necessary in most cases.
2016-10-17 20:55:20 -07:00
Mitchell Hashimoto 4baed414e7 Merge pull request #9361 from hashicorp/b-interp-multi
terraform: multi-var interpolation should use state for count
2016-10-14 11:13:33 -07:00
clint d9542be43f release: clean up after v0.7.6 2016-10-14 16:43:48 +00:00
clint 754bdda8a7
v0.7.6 2016-10-14 16:32:43 +00:00
James Nugent afe2d7b65b Merge pull request #7320 from dtolnay/conflict
core: Allow refresh of local state with no resources
2016-10-14 11:00:46 -05:00
Mitchell Hashimoto 728a1e5448
terraform: multi-var interpolation should use state for count
Related to #5254

If the count of a resource is interpolated (i.e. `${var.c}`), then it
must be interpolated before any splat variable using that resource can
be used (i.e. `type.name.*.attr`). The original fix for #5254 is to
always ensure that this is the case.

While working on a new apply builder based on the diff in
`f-apply-builder`, this truth no longer always holds. Rather than always
include such a resource, I believe the correct behavior instead is to
use the state as a source of truth during `walkApply` operations.

This change specifically is scoped to `walkApply` operation
interpolations since we know the state of any multi-variable should be
available. The behavior is less clear for other operations so I left the
logic unchanged from prior versions.
2016-10-13 17:57:11 -07:00
James Bardin c5f85f9a91 Merge pull request #9356 from hashicorp/jbardin/TF-9337
Filter nil Deposed values during State init
2016-10-13 16:03:23 -04:00
Clint 46ee2ef51a Merge pull request #6819 from hashicorp/f-aws-vpc-data-sources
provider/aws: data sources for AWS network planning
2016-10-13 14:17:55 -05:00
James Bardin 4f91507d05 Merge pull request #9268 from hashicorp/jbardin/hcl-maps
Get rid of the list when parsing HCL maps for vars
2016-10-13 14:18:29 -04:00
James Bardin 816c04309c Filter nil Deposed values during State init
The Deposed slice wasn't being normalized and nil values could be read
in from a state file. Filter out the nils during init. There is
still a bug in copystructure, but that will be addressed separately.
2016-10-13 13:46:40 -04:00
James Bardin fe4799bd68 Add failing test for nil IsntanceState in State
A nil InstanceState within State/Modules/Resources/Deposed will panic
during a deep copy. The panic needs to be fixed in copystructure, but
the nil probably should have been normalized out before we got here too.
2016-10-13 11:16:03 -04: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 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 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 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 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