Commit Graph

26296 Commits

Author SHA1 Message Date
Alisdair McDiarmid 0d614a8d01 command/apply: Remove implicit init call
The positional argument passed to apply was once used to specify a
source for a Terraform module to fetch and initialize (#337). This
functionality was removed from the init command later (#15032) but not
completely removed from apply.

This code was non-functional but largely not harmful, except for a very
specific case: when passing an absolute path to a plan file as the
positional argument on Windows, the getter.Detect code would incorrectly
interpret the path as a URL. This caused init to fail and the apply
command would exit with code 1 but without diagnostics.

This commit removes this codepath, which fixes this bug, and should
otherwise have no effect on the supported behaviour of apply.
2020-06-12 12:39:15 -04:00
Alisdair McDiarmid 08b735984a
Merge pull request #25191 from hashicorp/alisdair/better-provider-upgrade-hints-on-init
command/init: Improve diags for legacy providers
2020-06-12 12:31:33 -04:00
Martin Atkins 4b5fff2718
Update CHANGELOG.md 2020-06-12 08:46:17 -07:00
Martin Atkins 17feb2abfc vendor: go get github.com/apparentlymart/go-versions@v1.0.0
This new version permits omitting the space between the operator and the
boundary in a ruby-style version constraint, like ">1.0.0" instead of
"> 1.0.0".
2020-06-12 08:45:14 -07:00
Martin Atkins 7ab914491b configs: Don't panic if new version constraint parser raises an error
The new provider installer code is using a new version constraint parser
because it produces better error messages than the one we were using
before. However, it has some cases where it returns errors that the old
parser (which was entirely regex-match-based) didn't catch.

In the long run we should consistently use the new parser everywhere, but
until then we'll avoid panicking then the two disagree, by returning
diagnostic messages instead of using MustParseVersionConstraints.

For now, we only hit these error cases if the user enters something that
the old parser allows but the new parser does not.
2020-06-12 08:45:14 -07:00
Alisdair McDiarmid 9263b28e99 command/init: Improve diags for legacy providers
When initializing a configuration which refers to re-namespaced legacy
providers, we attempt to detect this and display a diagnostic message.
Previously this message would direct the user to run the 0.13upgrade
command, but without specifying in which directories.

This commit detects which modules are using the providers in question,
and for local modules displays a list of upgrade commands which specify
the source directories of these modules.

For remote modules, we display a separate list noting that they need to
be upgraded elsewhere, providing both the local module call name and the
module source address.
2020-06-12 09:57:01 -04:00
James Bardin 83d3e3518b
Merge pull request #25213 from hashicorp/jbardin/up-down-edges
Do not walk all descendants for root outputs
2020-06-11 17:28:08 -04:00
Martin Atkins 71515130db
Update CHANGELOG.md 2020-06-11 14:23:52 -07:00
James Bardin 9d6cabadfc
Merge pull request #25204 from hashicorp/fix-kubernetes-backend-docs
Fix errors in kubernetes backend documentation
2020-06-11 14:50:51 -04:00
Kristin Laemmert a42ffb46db
Update CHANGELOG.md 2020-06-11 14:12:08 -04:00
Kristin Laemmert 5450e8515d
command/013upgrade: detect builtin terraform provider (#25215)
* command/013upgrade: detect builtin terraform provider
2020-06-11 14:10:47 -04:00
Alisdair McDiarmid 9303b9f8fc
Merge pull request #25216 from hashicorp/alisdair/upgrade-deps
Upgrade hcl and go-cty
2020-06-11 13:41:34 -04:00
Alisdair McDiarmid 3fe8a7f76a vendor: go get github.com/hashicorp/hcl/v2@v2.6.0 2020-06-11 12:39:35 -04:00
Alisdair McDiarmid 9ef84801a8 vendor: go get github.com/zclconf/go-cty@v1.5.0 2020-06-11 12:39:11 -04:00
Martin Atkins 80a4bfbf27 website: New navigation items for the module and provider registry specs 2020-06-11 09:32:39 -07:00
Martin Atkins 63639defe9 website: Separate docs for the module registry protocol
We previously had the module registry protocol documented only as an
undefined subset of the full API of the official registry implementation.
However, the vast majority of endpoints documented in the official API
docs are not needed for a headless third-party module registry that only
intends to make modules available to Terraform CLI.

To make this clearer to potential third-party implementors, and also for
consistency with how the provider registry protocol is now documented,
here we create a new page to describe the subset required for all
registries, and then explain in the docs for the offical API that
potential third-party implementors should refer to the new page instead.

The longer page describing the full API of the official implementations
remains for those who wish to write clients for that API, because it is
part of the API surface area for Terraform Cloud and Terraform Enterprise.

I also took this opportunity to address the fact that module addresses
don't really contain "provider names" at all, but rather than the fourth
field in the address is _conventionally_ an official provider name but
can really be any string that serves to differentiate multiple
implementations of the same abstraction. The new docs therefore refer to
this field as "system" rather than "provider".
2020-06-11 09:32:39 -07:00
Martin Atkins deb8257fa5 website: Specification for the provider registry protocol 2020-06-11 09:32:39 -07:00
Kristin Laemmert e5bfa1930a
Update CHANGELOG.md 2020-06-11 11:36:04 -04:00
Kristin Laemmert 8673c197aa init: fix issue loading local plugin directory 2020-06-11 11:30:44 -04:00
Alisdair McDiarmid 06344e4540
Merge pull request #25207 from hashicorp/alisdair/remove-dead-code-source-addr-helpers
configs/configload: Remove unused SourceAddr funcs
2020-06-11 11:02:25 -04:00
James Bardin c0a5214aec do not look for all descendants from root outputs
The output destroy node only needs to connect to each of the output's
up-edges in order to be connected transitively to all of the outputs
dependencies. In large, highly-connected graphs, this may save
considerable time for each output.
2020-06-11 09:53:09 -04:00
James Bardin 8e4bd669e8 test Set.Copy, Graph.UpEdges, Graph.DownEdges 2020-06-11 09:53:09 -04:00
James Bardin 268959f4be make UpEdges and DownEdges return a copy
The public functions for the graph UpEdges and DownEdges is returning
the internal Set from the graph, meaning that callers could
inadvertently corrupt the graph structure by editing the returned Sets.

Make UpEdges and DownEdges return a copy of the set, while retaining the
efficient no-copy behavior for internal callers.
2020-06-11 09:53:09 -04:00
Petros Kolyvas 831fd2b842
Merge pull request #25212 from Redeux/kubernetes-backened-doc
backend/kubernetes: Kubernetes supports multiple workspaces
2020-06-11 09:49:50 -04:00
Phil Sautter fa3fe37684 backend/kubernetes: Kubernetes supports multiple workspaces 2020-06-11 08:35:22 -04:00
James Bardin 8f4395a1e9 ensure modules are expanded during import
In order to import into a module, we have to make sure that module has
registered the expansion data.
2020-06-10 17:02:41 -04:00
Alisdair McDiarmid 9204498fe5 configs/configload: Remove unused SourceAddr funcs
isLocalSourceAddr and isRegistrySourceAddr are also present in
internal/initwd/getter.go, and they are unused in this package.
2020-06-10 16:26:04 -04:00
Alisdair McDiarmid abedfd3a0f
Update CHANGELOG.md 2020-06-10 16:23:15 -04:00
Alisdair McDiarmid 652d4e40f4
Merge pull request #25190 from hashicorp/alisdair/providers-tree
command/providers: Show provider requirements tree
2020-06-10 16:21:49 -04:00
James Bardin 13c6b83e29 expanded module targeting test 2020-06-10 16:11:05 -04:00
James Bardin 98b323d815 ignore module indices in pre-expansion targeting
The TargetsTransformer ignored resource indices before expansion could
happen, but was not handling module indices. Ensure that we collapse all
pre-expansion addresses to "configuration" addresses, with no module or
resource keys.
2020-06-10 15:39:29 -04:00
James Bardin a2d8376eeb TransformTargets cannot depends on knowing Destroy
There is no reliable way to know if `destroy` was called from the cli.
2020-06-10 15:38:35 -04:00
James Bardin aa7e6f8d86 nodeCloseModule needs to be kept for downstream 2020-06-10 15:37:55 -04:00
James Bardin 7022345b8f Targets was being dropped in data source nodes 2020-06-10 15:36:44 -04:00
John Houston ec3612c3d0
Fix errors in kubernetes backend documentation 2020-06-10 14:00:01 -04:00
James Bardin b861f5a4d7 unkeyed target ModulesInstance can be Modules
If the last step in a module target is an unkeyed instance, and it's
being compared against keyed instances, we have to assume it was
intended to be used as a Module rather than a ModuleInstance.
2020-06-09 21:58:58 -04:00
Alisdair McDiarmid 1c1e4a4de0 command/providers: Show provider requirements tree
Providers can be required from multiple sources. The previous
implementation of the providers sub-command displayed only a flat list
of provider requirements, which made it difficult to see which modules
required each provider.

This commit reintroduces the tree display of provider requirements, and
adds a separate output block for providers required by existing state.
2020-06-09 14:21:53 -04:00
James Bardin 299aa31b43 update CHANGELOG.md 2020-06-08 21:20:58 -04:00
James Bardin 7800ef63d4
Merge pull request #19525 from dramich/k8sback
backend/kubernetes: Add Kubernetes as a backend
2020-06-08 15:59:32 -04:00
Masayuki Morita ee913a1c87
command/0.13upgrade: make confirmation more user-friendly (#25142)
I feel the current confirmation prompt for 0.13upgrade command is
ambiguous what is expected. Actually, when I used it for the first time,
I cancelled it by typing `y` instead of `yes`.

I believe it would be great if the 0.13upgrade command tell us the
expected value for confirmation like 0.12upgrade.
2020-06-08 13:36:19 -04:00
Alisdair McDiarmid f2beafd348
Update CHANGELOG.md 2020-06-08 10:45:16 -04:00
Alisdair McDiarmid b18d35e258
Merge pull request #25156 from hashicorp/alisdair/fix-empty-overlap-diagnostic-format
command/format: Fix empty overlap diagnostics
2020-06-08 10:44:02 -04:00
James Bardin b829de086f update CHANGELOG.md 2020-06-08 10:24:23 -04:00
James Bardin ea0b4df96f
Merge pull request #25144 from sharkyze/configs/fix-looksLikeSentences-index-out-of-range
config/name_values: fix index out of range in looksLikeSentences
2020-06-08 10:22:48 -04:00
James Bardin fdfe7e5cb7 update CHANGELOG.md 2020-06-08 10:21:18 -04:00
James Bardin 0b5746b6bb
Merge pull request #25176 from hashicorp/jbardin/module-expansion-transformer
Incorrect early return in module expansion transformer
2020-06-08 10:19:05 -04:00
Kristin Laemmert 30ab95fb55
Update CHANGELOG.md 2020-06-08 08:29:15 -04:00
Kristin Laemmert 58bcc2e9bb
addrs: detect builtin provider when parsing legacy provider string (#25154)
* addrs: detect builtin provider when parsing legacy provider string

The ParseLegacyAbsProviderConfig was not detecting builtin providers
("terraform"), which caused issues for all users with 0.12 state and
the "terraform_remote_state" data source. Since "terraform" is the only
built-in provider this adds a very simple check to the parser so it
properly returns the builtin FQN.

* add tests to the addrs package
2020-06-08 08:27:36 -04:00
Alisdair McDiarmid d741c3f917
Update CHANGELOG.md 2020-06-08 07:21:47 -04:00
Alisdair McDiarmid 3f62e4686b
Merge pull request #25146 from hashicorp/alisdair/simplify-makefile
Makefile: remove unused targets
2020-06-08 07:17:54 -04:00