Commit Graph

9 Commits

Author SHA1 Message Date
Martin Atkins ba894ee05c addrs: More string parsing helpers for addresses
Our main "parse" methods in this package work with hcl.Traversals, but
we're gradually adding helpers to parse these directly froms strings since
the visual noise of doing the traversal parse first is inconvenient in
situations where addresses are coming from non-config locations where
no source information is available anyway.
2018-10-16 18:49:20 -07:00
Martin Atkins c036613ed3 addrs: Helper function for parsing absolute provider config strings 2018-10-16 18:49:20 -07:00
Martin Atkins f107a4bc33 addrs: Generate special string for invalid ProviderConfig
The zero value of ProviderConfig is not a valid provider config address,
so we'll generate a special string for that in order to make that clear
in case one sneaks in somewhere. This can happen, for example, in the
core flow of resolving provider inheritance during the ProviderTransformer
if a caller attempts to access the resolved provider before that
transformer has run.
2018-10-16 18:48:28 -07:00
Martin Atkins 119c80d5e2 addrs: ModuleInstance methods for building AbsProviderConfig
These helpers, similar to other such methods on ModuleInstance, are useful
for programmatically constructing provider config addresses, particularly
in tests where this is more straightforward than parsing from strings.
2018-10-16 18:46:46 -07:00
Martin Atkins 072322336e addrs: AbsProviderConfig.Inherited method
This helper deals with the address wrangling required to find the address
that a provider configuration might inherit from if no explicit
configuration is given and instead configuration is taken from the
parent module.

This method is not generally useful, and is here mainly just to help the
provider-related graph transformations in the main terraform package.
2018-10-16 18:44:26 -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 c6598a3f86 addrs: ParseAbsProviderConfig function
This is for parsing the type of provider configuration address we write
into state in order to remember which provider configuration is
responsible for each resource.
2018-10-16 18:44:26 -07:00
Martin Atkins fca07d1a61 addrs: AbsProviderConfig type
Fitting with the usual naming scheme, this is the combination of a
module instance address and a provider config.
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