Commit Graph

26273 Commits

Author SHA1 Message Date
Katy Moe 6b3d0ee64b add test for terraform version 2020-06-16 14:47:57 -04:00
Katy Moe dbe139e616 add test for terraform version -json 2020-06-16 14:47:57 -04:00
Katy Moe d8e22f1804 add terraform version -json 2020-06-16 14:47:57 -04:00
Alisdair McDiarmid a3231814c2
Merge pull request #25263 from hashicorp/alisdair/fix-test-cleanup
command: Fix test cleanup
2020-06-16 14:24:13 -04:00
Alisdair McDiarmid d2b215f4d5 command: Fix test cleanup
This test runs `init`, which causes some dangling `.terraform` state
after running tests.
2020-06-16 14:11:08 -04:00
James Bardin 435529a20f
Merge pull request #25261 from hashicorp/jbardin/validate-depends-on
Validate depends_on in modules and outputs
2020-06-16 13:56:50 -04:00
Pam Selle 199157a51a
Validation for provider blocks in expanding modules (nested) (#25248)
* Refactor provider validation into separate func & recurse

Refactors the validate provider functions into a separate function
that can recursively search above a module to check and see if
any parents of the module contain count/for_each configs to be
considered
2020-06-16 13:52:41 -04:00
James Bardin 534c82f36a module and output depends_on validation tests 2020-06-16 13:17:21 -04:00
James Bardin a26446931b validate depends_on for outputs
If depends_on is allowed for outputs, we should validate that the
expressions are valid. Since outputs are always evaluated, and
validation is just done by this evaluation, we can check the
depends_on validation during evaluation too.
2020-06-16 12:40:48 -04:00
James Bardin bdf5acd627 validate depends_on in module calls
Add depends_on validation to module calls, and accumulate diagnostics
for all calls rather than returning early.
2020-06-16 12:39:50 -04:00
James Bardin a8884b18e3 split depends_on validation into its own function
Only resources were validating depends_on. We can use this same block to
ensure all depends_on validation has the same output.
2020-06-16 12:38:05 -04:00
unki 214009e0f3
fix yamldecode()-example, missing a file() call 2020-06-16 09:56:03 +02:00
James Bardin 7154c61f0b reduce module instances refs to the module call
There aren't going to be any nodes specifically for module call
instances during plan, so we have to switch the reference subject to the
general module call.
2020-06-15 20:46:53 -04:00
James Bardin d6ca469124 module variables can't be referenced as a module 2020-06-15 20:46:03 -04:00
James Bardin 02167dcfe4 test whole module reference from module var
this reference isn't being connected properly
2020-06-15 20:45:23 -04:00
James Bardin 3506f159aa
Merge pull request #25251 from hashicorp/jbardin/dot
quote dot node names
2020-06-15 14:46:34 -04:00
James Bardin b35a56cf6e command tests looked for providers in the graphs
The quotes in provider names needs to be escaped, so these tests were
looking for the wrong output to begin with.
2020-06-15 14:40:59 -04:00
James Bardin e36d300efd quote dot node names
providers can contain quotes, so we need to ensure proper quoting in the
dot format.
2020-06-15 13:28:53 -04:00
Chris Griggs 9dc9ae7f74
Merge pull request #25158 from hashicorp/cgrigs01-wbsite-links
[Website] provider links
2020-06-15 09:23:58 -07:00
Alisdair McDiarmid bc386234d5
Update CHANGELOG.md 2020-06-12 15:53:34 -04:00
Alisdair McDiarmid 5bc721bf03
Merge pull request #25234 from hashicorp/alisdair/remove-building-md
Remove BUILDING.md docs
2020-06-12 15:52:15 -04:00
Alisdair McDiarmid 7d4cab126f
Merge pull request #25233 from hashicorp/alisdair/remove-implicit-init-then-apply
command/apply: Remove implicit init call
2020-06-12 15:52:06 -04:00
Kristin Laemmert b611bd7209 reproduction test 2020-06-12 15:39:55 -04:00
Alisdair McDiarmid 30380bde61 Remove BUILDING.md docs
This document on building release-style binaries is out of date (`make
bin` no longer works) and does not fully reflect how releases of
Terraform are built. Since release builds are not reproducible, this
information is more likely to mislead users trying to build development
binaries than it is to be useful.
2020-06-12 13:53:01 -04:00
James Bardin 27546809a2 update CHANGELOG.md 2020-06-12 13:13:15 -04:00
James Bardin 39cf911d38
Merge pull request #25208 from hashicorp/jbardin/expand-import
ensure modules are expanded during import
2020-06-12 12:45:05 -04:00
James Bardin 22680d7409
Merge pull request #25206 from hashicorp/jbardin/target-with-expansion
Targeting with module expansion
2020-06-12 12:44:49 -04:00
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