Commit Graph

34 Commits

Author SHA1 Message Date
Sander van Harmelen
8560f50cbc
Change taint behaviour to act as a normal resource
This means it’s shown correctly in a plan and takes into account any
actions that are dependant on the tainted resource and, vice verse, any
actions that the tainted resource depends on.

So this changes the behaviour from saying this resource is tainted so
just forget about it and make sure it gets deleted in the background,
to saying I want that resource to be recreated (taking into account the
existing resource and it’s place in the graph).
2016-05-26 19:55:26 -05:00
Martin Atkins
61ab8bf39a core: ResourceAddress supports data resources
The ResourceAddress struct grows a new "Mode" field to match with
Resource, and its parser learns to recognize the "data." prefix so it
can set that field.

Allows -target to be applied to data sources, although that is arguably
not a very useful thing to do. Other future uses of resource addressing,
like the state plumbing commands, may be better uses of this.
2016-05-14 08:26:36 -07:00
Martin Atkins
4d50f22a23 core: separate lifecycle for data resource "orphans"
The handling of data "orphans" is simpler than for managed resources
because the only thing we need to deal with is our own state, and the
validation pass guarantees that by the time we get to refresh or apply
the instance state is no longer needed by any other resources and so
we can safely drop it with no fanfare.
2016-05-14 08:26:36 -07:00
Paul Hinze
a0d3245ee3 core: Orphan addressing / targeting
Instead of trying to skip non-targeted orphans as they are added to
the graph in OrphanTransformer, remove knowledge of targeting from
OrphanTransformer and instead make the orphan resource nodes properly
addressable.

That allows us to use existing logic in TargetTransformer to filter out
the nodes appropriately. This does require adding TargetTransformer to the
list of transforms that run during DynamicExpand so that targeting can
be applied to nodes with expanded counts.

Fixes #4515
Fixes #2538
Fixes #4462
2016-01-19 17:48:44 -06:00
James Nugent
38bb9f2416 Allow targeting of orphan nodes
Fixes #3852. We now run the OrphanTransformer even when targeting, and
pass it the list of targets following resource expansion.
2015-11-13 14:33:58 -06:00
Radek Simko
40b04154fe Add operation walkDestroy 2015-10-03 14:16:40 -07:00
Mitchell Hashimoto
61d275f475 terraform: get nested oprhans in the transform 2015-07-19 13:53:31 -07:00
Mitchell Hashimoto
8ebdc1e786 terraform: orphans should call post-apply hook [GH-1938] 2015-06-25 20:11:29 -07:00
Mitchell Hashimoto
7031cb145c terraform: orphan dependencies should be inverted 2015-06-23 20:41:02 -07:00
Paul Hinze
0273732dec core: make orphans flattenable
Got this while playing around in a module:

> * unflattenable node: aws_security_group.internal (orphan)
> *terraform.graphNodeOrphanResource

Basically just copied implementation from
d503cc2d82
2015-05-11 22:24:11 -05:00
Matt Good
21b0a03d70 Support for multiple providers of the same type
Adds an "alias" field to the provider which allows creating multiple instances
of a provider under different names. This provides support for configurations
such as multiple AWS providers for different regions. In each resource, the
provider can be set with the "provider" field.

(thanks to Cisco Cloud for their support)
2015-04-20 14:14:34 -07:00
Paul Hinze
c6300d511c core: formalize resource addressing
Only used in targets for now. The plan is to use this for interpolation
as well.

This allows us to target:

 * individual resources expanded by `count` using bracket / index notation.
 * deposed / tainted resources with an `InstanceType` field after name

Docs to follow.
2015-03-31 15:04:10 -05:00
Mitchell Hashimoto
821536b1e9 terraform: call the EvalUpdateStateHook strategically 2015-02-23 19:14:16 -08:00
Mitchell Hashimoto
b52881d232 terraform: clean up EvalNodes 2015-02-19 12:08:32 -08:00
Mitchell Hashimoto
691db58478 terraform: apply for orphans 2015-02-19 12:08:05 -08:00
Mitchell Hashimoto
93f3050dbd terraform: make things more linear 2015-02-19 12:08:04 -08:00
Mitchell Hashimoto
e185769271 terraform: plan destroy 2015-02-19 12:08:04 -08:00
Mitchell Hashimoto
4ccb12508a terraform: decreasing counts works 2015-02-19 12:08:03 -08:00
Mitchell Hashimoto
2b917054da terraform: orphan transform should work if state is nil 2015-02-19 12:08:01 -08:00
Mitchell Hashimoto
e45308fa6d terraform: module orphans are properly expanded and planned for destroy 2015-02-19 12:08:01 -08:00
Mitchell Hashimoto
ce37165c06 terraform: orphan transform was not picking up modules without parent in
state
2015-02-19 12:08:01 -08:00
Mitchell Hashimoto
d847b2b672 terraform: provider config inheritance in modules 2015-02-19 12:07:59 -08:00
Mitchell Hashimoto
c308405b53 terraform: validation in progress 2015-02-19 12:07:55 -08:00
Mitchell Hashimoto
a8364dd0fc terraform: more eval stuff 2015-02-19 12:07:54 -08:00
Mitchell Hashimoto
02bedd6850 terraform: transformers operate on root structures 2015-02-19 12:07:54 -08:00
Mitchell Hashimoto
c0695b0657 terraform: tests that some other graph nodes implement the interfaces 2015-02-19 12:07:53 -08:00
Mitchell Hashimoto
8bf725e746 terraform: GraphNodeDependent 2015-02-19 12:07:53 -08:00
Mitchell Hashimoto
6d46b02fa5 terraform: test orphan-to-orphan dependencies 2015-02-19 12:07:53 -08:00
Mitchell Hashimoto
98683b44b8 terraform: move resource orphan deps out of loop 2015-02-19 12:07:53 -08:00
Mitchell Hashimoto
7025c48165 terraform: module orphan dependencies 2015-02-19 12:07:52 -08:00
Mitchell Hashimoto
922bdc92db terraform: module orphans 2015-02-19 12:07:52 -08:00
Mitchell Hashimoto
4f8152c28a terraform: the orphan transform uses the graph path 2015-02-19 12:07:52 -08:00
Mitchell Hashimoto
3820aea513 terraform: make adding config nodes a transformer 2015-02-19 12:07:52 -08:00
Mitchell Hashimoto
6eb379fa75 terraform: start the transforms, adding orphans 2015-02-19 12:07:52 -08:00