Commit Graph

25527 Commits

Author SHA1 Message Date
Kristin Laemmert 5b427ec648
addrs: Provider.IsLegacy and IsDefault functions
* add IsLegacy and IsDefault funcs to addrs.Provider
* add some test coverage
2020-03-23 09:50:35 -04:00
Adam Leskis 4f85a1a6ba
website: fix simple typo (#24415) 2020-03-23 08:55:08 -04:00
Kristin Laemmert 4f141ae365
rename provider-specific functions (#24417)
missingPlugins was hard-coded to work only with provider plugins, so I
renamed it to clarify the usage.

Also renamed a test provider from greater_than to greater-than as the
underscore is an invalid provider name character and this will become a
hard error in the near future.
2020-03-20 13:59:59 -04:00
Kristin Laemmert c8d64846ad
Mildwonkey/ps import (#24412)
* import: remove Config from ImportOpts

`Config` in ImportOpts was any provider configuration provided by the
user on the command line. This option has already been removed in favor
of only taking the provider from the configuration loaded in the current
context.

* terrafrom: add Config to ImportStateTransformer and refactor Transform
to get the resource provider FQN from the Config
2020-03-20 08:15:29 -04:00
Alisdair McDiarmid 9d0c8c5970
Remove changelog entry for fix already in 0.12.24 2020-03-19 10:40:58 -04:00
Alisdair McDiarmid 51ea5d6b2f
Merge pull request #24411 from hashicorp/alisdair/registry-retry-panic
registry: Fix panic when server is unreachable
2020-03-19 10:37:30 -04:00
Alisdair McDiarmid 1c1df6dc50 registry: Fix panic when server is unreachable
Non-HTTP errors previously resulted in a panic due to dereferencing the
resp pointer while it was nil, as part of rendering the error message.
This commit changes the error message formatting to cope with a nil
response, and extends test coverage.

Fixes #24384
2020-03-19 10:20:10 -04:00
Kristin Laemmert 7d6d653b4f
Update CHANGELOG.md 2020-03-19 08:04:12 -04:00
Kristin Laemmert 5f313a65ad
command: remove 0.12upgrade (#24403)
* command: remove 0.12upgrade and related `configupgrade` library
* leave deprecation warning for 0.12upgrade to point users to v0.12
2020-03-19 08:01:16 -04:00
Nick Fagerlund 109c4bf6ef website: Remove links to the getting started guide's old location
Since these links were in the soon-to-be-deprecated 0.11 language section, I
think we can just remove them without needing to find an equivalent link.
2020-03-18 14:20:03 -07:00
Alisdair McDiarmid 420e22ece4 Update CHANGELOG.md 2020-03-18 09:11:44 -04:00
Alisdair McDiarmid 8c7a44355b command: Fix bug when using terraform login on Windows 2020-03-18 09:08:40 -04:00
Alisdair McDiarmid fb7035ac3e
Merge pull request #24364 from hashicorp/alisdair/013upgrade
command: Add scaffold for 0.13upgrade command
2020-03-18 09:07:58 -04:00
Kristin Laemmert ed1aebbeda
terraform: large refactor to use Provider from configs.Resource (#24396)
* terraform: large refactor to use Provider from configs.Resource

configs.Resource.ImpliedProvider() now returns a string; it is the
callers' responsibility to turn that into an addrs.Provider if needed.

GraphNodeProviderConsumer ProvidedBy() no longer returns nil (reverting
to earlier, pre-provider-fqn behavior): it will return either the
provider set in config, provider set in state, or the default provider.
2020-03-18 08:58:20 -04:00
aqche 3578a5d80a
state: update local unlock err (#24320) 2020-03-17 14:01:51 -04:00
Martin Atkins a3529cb455
vendor: Fix checksum for github.com/coreos/etcd (#24343)
It seems that the checksum for v3.3.10+incompatible has changed at some
point, causing "go mod vendor" to fail now.

We can see by the fact that no files within "vendor" have changed that the
change in checksum is not the result of any material change in the module
code, and therefore presumably resulted from some change in metadata or
a change in the Go module hashing algorithm since Go 1.12.
2020-03-17 13:56:58 -04:00
James Bardin 8116b9c493
Merge pull request #24389 from hashicorp/jbardin/module-expansion-getting-there
more module expansion foundation
2020-03-17 09:43:02 -04:00
James Bardin a8b9547e0d fixup states.Resource change throughout packages 2020-03-16 16:50:48 -04:00
Kristin Laemmert ef19fb6203
configs: attach provider fqn to Resource (#24382)
* configs: attach provider fqn to Resource
2020-03-16 14:36:16 -04:00
Alisdair McDiarmid 3b0b29ef52 command: Add scaffold for 0.13upgrade command 2020-03-16 12:50:24 -04:00
James Bardin d905b990a5 s/GraphNodeResource/GraphNodeConfigResource/
Make the interface name reflect the new return type of the method.
Remove the confusingly named and unused ResourceAddress method from the
resource nodes as well.
2020-03-16 11:16:23 -04:00
James Bardin a7de3d07b8 cleanup from resource state mods 2020-03-16 11:16:23 -04:00
James Bardin ea51b790bc states.Resource needs to record its module too
The ModuleInstance is known while building the state resource, but it's
not recorded. Since a resource may be retrieved via a ConfigResource
address, we need to know from which module instance it was loaded.
2020-03-16 11:16:23 -04:00
James Bardin 3729e6a705 update MaybeFixUpResourceInstanceAddressForCount
We need to fixup count by config path, not by absolute path, so update
MaybeFixUpResourceInstanceAddressForCount to work with
addrs.ConfigResource.
2020-03-16 11:16:23 -04:00
James Bardin f0e175a835 add AbsResource.Config() ConfigResource 2020-03-16 11:16:23 -04:00
James Bardin 42f7beff31
Merge pull request #24296 from hashicorp/pselle/module-targetable
Make modules targetable
2020-03-16 11:16:05 -04:00
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 e3ad9ffb77 added module targetting tests 2020-03-13 09:19:27 -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 076c540076 Add a test for whole module targeting 2020-03-13 09:08:42 -04:00
Pam Selle 7407fee9c2 Make modules targetable 2020-03-13 09:08:42 -04:00
James Bardin 50077eabe9
Merge pull request #24362 from hashicorp/jbardin/module-expansion-some-more
implement addrs.ConfigResource
2020-03-13 09:08:26 -04:00
James Bardin d65bd64955 incorporate addrs.ConfigResource 2020-03-12 15:58:25 -04:00
James Bardin 9054716caf implement addrs.ConfigResource
Core needs a way to address resources through unexpanded modules, as
they are present in the configuration. There are already some cases of
paring `addrs.Module` with `addrs.Resource` for this purpose, but it is
going to be helpful to have a single type to describe that pair, as
well as have the ability to use TargetContains.
2020-03-12 15:58:25 -04:00
James Bardin 482ae66e18 minor cleanup
Remove unused variables, sync.Once, and init in BuiltinEvalContext.
Replace some shim calls.
GraphNodeAttachProvider doesn't need to be a NodeModuleInstance.
2020-03-12 14:54:47 -04:00
Martin Atkins 946eda3f3c configs: Return diagnostics (almost) directly from ParseProviderSourceString
This function can already produce suitable diagnostic messages which we'd
like to preserve, but it cannot produce source location information, and
so we'll amend the diagnostics to include that on the way out while
retaining all of the other values in the diagnostics.
2020-03-12 11:11:29 -07:00
Martin Atkins a851566c56 tfdiags: Diagnostics.ToHCL
Most of the time we're converting from HCL diagnostics to tfdiags as we
expose diagnostics directly from HCL, but occasionally we need to to the
reverse.

For example, our configs package uses hcl.Diagnostics by convention
because it's primarily working with HCL, but sometimes it interacts with
functions elsewhere (like in the "addrs" package) that return
tfdiags.Diagnostics, where they need to be adapted to return in an HCL
shape.

This should be used with some care because, similar to Diagnostics.ForRPC,
it forces immediate flattening of all of the diagnostics to a single
type and so can potentially lose internal tracking information that
appears in other tfdiags.Diagnostic information, such as the additional
metadata tracked in the ConsolidateWarnings result to allow later
appending to existing groups.
2020-03-12 11:11:29 -07:00
Kristin Laemmert 1c78b26012
terraform: provider source test (#24342)
* configs: parse provider source string during module merge

This was the smallest unit of work needed to start writing provider
source tests!

* Update configs/parser_test.go

Co-Authored-By: Alisdair McDiarmid <alisdair@users.noreply.github.com>
2020-03-12 12:00:00 -04:00
James Bardin 4a1ec05092 comment fixes 2020-03-11 14:52:15 -04:00
James Bardin 33464568e8
Merge pull request #24346 from hashicorp/jbardin/module-expansion-another-part
Continue pushing the Path calls out of the Resource and Provider types
2020-03-11 14:32:23 -04:00
James Bardin e13eecbc5b finish provider ModuleInstance replacement 2020-03-11 14:19:52 -04:00
James Bardin 98cfb51f27 convert /terraform to use new provider config
Change all ModuleInstances in provider types to plain Modules
2020-03-11 11:21:45 -04:00
James Bardin 856791ec7e
Merge pull request #24331 from hashicorp/jbardin/module-expansion-in-part
More module expansion groundwork
2020-03-11 11:10:02 -04:00
James Bardin 1252726cda update CHANGELOG.md 2020-03-11 10:31:41 -04:00
James Bardin f6221100ee
Merge pull request #24149 from mlafeldt/fix-oss-state-locking
Fix & improve state locking of OSS backend
2020-03-11 10:28:12 -04:00
James Bardin 8497adcb6e AbsProviderConfig to use addrs.Module
Change ModuleInstance to Module in AbsProviderConfig, because providers
need to be handled before module expansion, and should not be used
defined inside an expanded module at all.

Renaming of the addrs type can happen later, when there's less work
in-flight around provider configuration.
2020-03-10 20:25:44 -04:00
James Bardin fae5f9958d remove GraphNodeModuleInstance from Resource types
Remove the requirement for most *Resource types to be a
GraphNodeModuleInstance, ensuring that they never call ctx.Path while
being evaluated. This gets rid of most of the direct need for the Path
method currently implemented by NodeResourceAbstract, leaving the
provider and schema related calls for a subsequent PR.
2020-03-10 20:22:22 -04:00
James Bardin 68b500c5c7 remove abs addrs from NodeAbstractResource
This adds more shimming into that node itself, but allows us to pull it
out of the config transformer, and ensure we can create the resources
correctly from the config. The shimmed address usage can then be raised
out of the abstract resource, into the expanded node types.
2020-03-10 17:25:11 -04:00
James Bardin 245296850b fix reference transformer comments
GraphNodeSubPath/GraphNodeModuleInstance is not required for references
2020-03-10 17:25:11 -04:00
James Bardin ab9a2935ce implement NodePlannableLocal
Using this in the same manner as NodePlannableOutput, which expands the
local values within modules. All thee output and local types are used in
both plan and apply, we may rename these to better reflect their usage
in expanding. That wait until we are certain that apply won't need any
extra machinery for handling values that aren't stored in the plan.
2020-03-10 17:25:11 -04:00