Commit Graph

10 Commits

Author SHA1 Message Date
James Bardin e6bac359ed Missing ConfigResource checks in TargetContains
Adding some missing checks for ConfigResource, and check all
combinations of Resource types for consistency.
2020-03-13 19:01:23 -04:00
James Bardin bf91bff2c8 TargetContains improvements
Simplify Module.TargetContains

Handle the case of a keyed instance address in
ModuleInstance.TargetContains.
2020-03-13 09:08:42 -04:00
Pam Selle 7407fee9c2 Make modules targetable 2020-03-13 09:08:42 -04:00
James Bardin 6ae9013c3f add addrs.Module.Equal
Mirror the addrs.ModuleInstance.Equal method
2020-03-10 17:25:11 -04:00
James Bardin b1df763541 remove UnkeyedInstanceShim from ref transformer
Since references are always within the scope of a single module, and we
can connect all module instance outputs for proper ordering, the
existing transformer works directly with only module paths as opposed to
module instances.

TODO: TransformApplyReferences for more precise module instance
targeting?
2020-03-10 17:25:11 -04:00
Pam Selle c249943360
Module Expansion: Part 2 (#24154)
* WIP: dynamic expand

* WIP: add variable and local support

* WIP: outputs

* WIP: Add referencer

* String representation, fixing tests it impacts

* Fixes TestContext2Apply_outputOrphanModule

* Fix TestContext2Apply_plannedDestroyInterpolatedCount

* Update DestroyOutputTransformer and associated types to reflect PlannableOutputs

* Remove comment about locals

* Remove module count enablement

* Removes allowing count for modules, and reverts the test,
while adding a Skip()'d test that works when you re-enable
the config

* update TargetDownstream signature to match master

* remove unnecessary method

Co-authored-by: James Bardin <j.bardin@gmail.com>
2020-02-24 17:42:32 -05:00
Martin Atkins c97dd145b9 addrs: Module.Call method
This is a helper for splitting a non-root module path into a callee and
call pair, similar to the method of the same name on ModuleInstance.
2018-10-16 18:46:46 -07:00
Martin Atkins 02b25e7057 addrs: flesh out functionality ready to replace terraform.ResourceAddress
This "kitchen sink" commit is mainly focused on supporting "targets" as
a new sub-category of addresses, for use-case like the -target CLI option,
but also includes some other functionality to get closer to replacing
terraform.ResourceAddress and fill out some missing parts for representing
various other address types that are currently represented as strings
in the "terraform" package.
2018-10-16 18:44:26 -07:00
Martin Atkins cd51864d84 configs: Start using the new "addrs" package types for modules
We initially just mimicked our old practice of using []string for module
paths here, but the addrs package now gives us a pair of types that better
capture the two different kinds of module addresses we are dealing with:
static addresses (nodes in the configuration tree) and dynamic/instance
addresses (which can represent the situation where multiple instances are
created from a single module call).

This distinction still remains rather artificial since we don't yet have
support for count or for_each on module calls, but this is intended to lay
the foundations for that to be added later, and in the mean time just
gives us some handy helper functions for parsing and formatting these
address types.
2018-10-16 18:44:26 -07:00
Martin Atkins b9d84f2944 addrs: new package for representing addresses
This package is intended to contain all the functionality for parsing,
representing, and formatting addresses of objects within Terraform.

It will eventually subsume the responsibilities of both the
InterpolatedVariable and ResourceAddress types in the "terraform" package,
but for the moment is just a set of types for representing these things,
lacking any way to parse or format them. The remaining functionality
will follow in subsequent commits.
2018-10-16 18:44:26 -07:00