Commit Graph

27219 Commits

Author SHA1 Message Date
Alisdair McDiarmid b90994deac
Merge pull request #26735 from hashicorp/alisdair/disable-terraform-state-file-version-check
states: Disable Terraform version check
2020-10-29 15:22:06 -04:00
Martin Atkins ced68fc446
Update CHANGELOG.md 2020-10-29 09:09:44 -07:00
Martin Atkins d03a774def core: Fix typo in for_each sensitive error message
Co-authored-by: Alisdair McDiarmid <alisdair@users.noreply.github.com>
2020-10-29 09:07:48 -07:00
Martin Atkins d24fdce5b8 command/format: Include unknown values in diagnostics
Previously when printing the relevant variables involved in a failed
expression evaluation we would just skip over unknown values entirely.

There are some errors, though, which are _caused by_ a value being
unknown, in which case it's helpful to show which of the inputs to that
expression were known vs. unknown so that the user can limit their further
investigation only to the unknown ones.

While here I also added a special case for sensitive values that overrides
all other display, because we don't know what about a value is sensitive
and so better to give nothing away at the expense of a slightly less
helpful error message.
2020-10-29 09:07:48 -07:00
Martin Atkins e2c64bc255 core: Annotate for_each errors with expression info
Our diagnostics model allows for optionally annotating an error or warning
with information about the expression and eval context it was generated
from, which the diagnostic renderer for the UI will then use to give the
user some additional hints about what values may have contributed to the
error.

We previously didn't have those annotations on the results of evaluating
for_each expressions though, because in that case we were using the helper
function to evaluate an expression in one shot and thus we didn't ever
have a reference to the EvalContext in order to include it in the
diagnostic values.

Now, at the expense of having to handle the evaluation at a slightly lower
level of abstraction, we'll annotate all of the for_each error messages
with source expression information. This is valuable because we see users
often confused as to how their complex for_each expressions ended up being
invalid, and hopefully giving some information about what the inputs were
will allow more users to self-solve.
2020-10-29 09:07:48 -07:00
Paul Thrasher 1e601dc7c2
Merge pull request #26744 from hashicorp/pault/tfce-remove-error-messaging
Stop printing tfce error message log
2020-10-28 16:30:47 -07:00
Paul Thrasher fc8a76a2a3
Stop printing tfce error message log 2020-10-28 16:03:55 -07:00
James Bardin c7dd310988
Merge pull request #26743 from hashicorp/jbardin/fix-diags-tests
fix the rpc diags tests
2020-10-28 17:45:22 -04:00
James Bardin 73474327a0 fix the rpc diags tests
These weren't quite done, but got lost in the huge PR.
2020-10-28 17:40:36 -04:00
James Bardin 35dfac799e update CHANGELOG.md 2020-10-28 17:22:38 -04:00
James Bardin d1ac382ec9
Merge pull request #26738 from hashicorp/jbardin/eval-diagnostics
Eval diagnostics
2020-10-28 17:21:18 -04:00
Alisdair McDiarmid dc2e7520e5 states: Disable Terraform version check
For this version of Terraform and forward, we no longer refuse to read
compatible state files written by future versions of Terraform. This is
a commitment that any changes to the semantics or format of the state
file after this commit will require a new state file version 5.

The result of this is that users of this Terraform version will be able
to share remote state with users of future versions, and all users will
be able to read and write state. This will be true until the next major
state file version is required.

This does not affect users of previous versions of Terraform, which will
continue to refuse to read state written by later versions.
2020-10-28 16:52:35 -04:00
Pam Selle 92a8d2061c
Merge pull request #26739 from hashicorp/pselle/show-json
Unmark values before showing in JSON
2020-10-28 16:49:56 -04:00
Alisdair McDiarmid 61b38f3ada
Another action regex fix attempt
This time I actually tested the regex
2020-10-28 16:46:28 -04:00
Alisdair McDiarmid e65f427927
Try to fix backport action
I made a mistake editing the regex. Here's hoping this works!
2020-10-28 16:43:38 -04:00
Pam Selle 2a222985f9
Merge pull request #26740 from hashicorp/pselle/show-output-sensitive
Hide sensitive outputs in terraform show
2020-10-28 16:38:17 -04:00
Pam Selle f61a342311 Hide sensitive outputs in terraform show 2020-10-28 15:46:09 -04:00
Pam Selle 66091ae36c Unmark values before showing in JSON
This prevents "sensitive" values from unintentionally
showing as nil when running terraform show -json
2020-10-28 15:30:04 -04:00
James Bardin b8bed97ef4 test for RPC warnings with no errors 2020-10-28 14:51:04 -04:00
James Bardin f987b69777 interrupted execution now exits with an error 2020-10-28 14:40:30 -04:00
James Bardin 95f30451d9 get rid of EvalEarlyExitError
This was mostly unused now, since we no longer needed to interrupt a
series of eval node executions.

The exception was the stopHook, which is still used to halt execution
when there's an interrupt. Since interrupting execution should not
complete successfully, we use a normal opaque error to halt everything,
and return it to the UI.

We can work on coalescing or hiding these if necessary in a separate PR.
2020-10-28 14:40:30 -04:00
James Bardin 988059d533 make GraphNodeExecutable return diagnostics 2020-10-28 13:47:04 -04:00
James Bardin 77cabe187d last Evals without diagnostics 2020-10-28 12:32:49 -04:00
James Bardin 786a7291bf remove unused EvalValidateCount 2020-10-28 12:26:37 -04:00
James Bardin c81fd833bb add diags to eval_state 2020-10-28 12:23:03 -04:00
James Bardin 524505830f add diags to eval_refresh 2020-10-28 12:03:00 -04:00
James Bardin 64491df856 add diags to data eval 2020-10-28 11:57:45 -04:00
James Bardin b42aad5856 add diags to eval_diff 2020-10-28 11:46:07 -04:00
James Bardin fe9c93b9f9 handle wrapped EvalEarlyExitErrors 2020-10-28 10:59:32 -04:00
Martin Atkins e6e0b6ee46 providercache: verify locked hashes for local package dirs
Previously we were only verifying locked hashes for local archive zip
files, but if we have non-ziphash hashes available then we can and should
also verify that a local directory matches at least one of them.

This does mean that folks using filesystem mirrors but yet also running
Terraform across multiple platforms will need to take some extra care to
ensure the hashes pass on all relevant platforms, which could mean using
"terraform providers lock" to pre-seed their lock files with hashes across
all platforms, or could mean using the "packed" directory layout for the
filesystem mirror so that Terraform will end up in the install-from-archive
codepath instead of this install-from-directory codepath, and can thus
verify ziphash too.

(There's no additional documentation about the above here because there's
already general information about this in the lock file documentation
due to some similar -- though not identical -- situations with network
mirrors.)
2020-10-28 07:46:45 -07:00
Martin Atkins 24d32e9ca2 providercache: More exhaustive testing of the main installer
We previously had some tests for some happy paths and a few specific
failures into an empty directory with no existing locks, but we didn't
have tests for the installer respecting existing lock file entries.

This is a start on a more exhaustive set of tests for the installer,
aiming to visit as many of the possible codepaths as we can reasonably
test using this mocking strategy. (Some other codepaths require different
underlying source implementations, etc, so we'll have to visit those in
other tests separately.)
2020-10-28 07:46:45 -07:00
Martin Atkins fc5a41b5e5 depsfile: Allow loading locks from a byte array in memory
This won't be a typical usage pattern for normal code, but will be useful
for tests that need to work with locks as input so that they don't need to
write out a temporary file on disk just to read it back in immediately.
2020-10-28 07:46:45 -07:00
Alisdair McDiarmid 1e32354e3e
Fix label regexp
We only use two components for versions, e.g. `0.13-backport` -> `v0.13`
2020-10-28 10:23:43 -04:00
Alisdair McDiarmid fd14b237e5
Add backport assistant
Based on documentation in https://github.com/hashicorp/backport-assistant, using a
token from the teamterraform user.
2020-10-28 10:22:01 -04:00
alevinetx 66393bb62e
website: Update module-registry-protocol.html.md (#26639)
* Update module-registry-protocol.html.md

1: There is a mismatch in the segment labels for the version query URL (system vs provider)
2: There is a discrepancy between the documentation and the actual generated request for retrieving module source code (URL segments 4 vs 3)
 - There is no segment for "provider"

* Update module-registry-protocol.html.md

Changed ```:system``` to ```:provider``` for versions and source API URLs
2020-10-28 09:09:52 -04:00
James Bardin 477111e6b6 change apply Eval methods to use diags 2020-10-27 18:16:28 -04:00
Kristin Laemmert da1d3cb2d3 remove unmaintained shell completion
These are unmaintained and their existence was a surprise to many of us.
Let's not keep them around to further languish.
2020-10-27 14:42:10 -04:00
Martin Atkins 430318e262 getproviders: Consistent ordering of terms in VersionConstraintsString
An earlier commit made this remove duplicates, which set the precedent
that this function is trying to canonically represent the _meaning_ of
the version constraints rather than exactly how they were expressed in
the configuration.

Continuing in that vein, now we'll also apply a consistent (though perhaps
often rather arbitrary) ordering to the terms, so that it doesn't change
due to irrelevant details like declarations being written in a different
order in the configuration.

The ordering here is intended to be reasonably intuitive for simple cases,
but constraint strings with many different constraints are hard to
interpret no matter how we order them so the main goal is consistency,
so those watching how the constraints change over time (e.g. in logs of
Terraform output, or in the dependency log file) will see fewer noisy
changes that don't actually mean anything.
2020-10-26 12:44:15 -07:00
Pam Selle 5f065c76aa
Merge pull request #26710 from aazon/patch-1
Small spelling improvement
2020-10-26 15:32:27 -04:00
Pam Selle bc14a1c885
Merge pull request #26706 from hashicorp/pselle/provider-sens-experiment
Add provider sensitivity propagation experiment
2020-10-26 15:11:54 -04:00
Pam Selle bd70bc63eb Add provider sensitivity propagation experiment
Rolls back marking attributes providers mark as sensitive
to an `experiment` and adds associated docs and adjustments
to the upgrade guide.
2020-10-26 15:05:22 -04:00
Alex Litvinenko 1a371c3c49
Small spelling improvement
It seems that the word `with` is redundant in the following sentence:

> For a module with without count or for_each, the address will not...
2020-10-26 19:50:21 +01:00
Kristin Laemmert 2b73a2c080
Update CHANGELOG.md 2020-10-26 14:06:57 -04:00
Kristin Laemmert b8e3b8036a backend: remove deprecated atlas backend 2020-10-26 14:05:18 -04:00
Martin Atkins ddf9635af6 website: Don't claim that things are "very easy"
We typically try to avoid making subjective, boasty claims in our
documentation in recent times, but there remained both some older
documentation that we've not recently revised and also some newer examples
that are, in retrospect, also perhaps more "boasty" than they need to be.

We prefer not to use this sort of boasty language because not everyone
using Terraform has the same background and experience, and so what is
"easy" or "intuitive" to one person may not be so to another person, and
that should not suggest that the second person is in any way wrong or
inadequate.

In reviewing some of our use of the word "easy" here I tried as much as
possible to surgically revise the existing content without getting drawn
into a big rewrite, but in some cases the content was either pretty
unsalvageable (due to talking about obsolete features that were removed
long ago) or required some broader changes to make the result hopefully
still get the same facts across. In those cases I've both removed some
content entirely or adjusted larger paragraphs.

This was not an exhaustive review and so I'm sure there's still plenty of
room for similar improvements elsewhere. I also resisted the urge to
update some pages that contain outdated information about currently-active
features.
2020-10-26 10:02:38 -07:00
Martin Atkins d203401318
Update CHANGELOG.md 2020-10-26 09:58:02 -07:00
Martin Atkins 6a44586a8f website: Update the CLI commands index page for latest help output
My initial motivation here was to update the example output from
Terraform's top-level help list to match recent updates in the layout
and language used.

However, while here I took the opportunity to update some dated language
that was not consistent with our modern documentation writing style,
in particular including a totally unnecessary and potentially-alienating
claim that Terraform is "very easy to use". Our modern writing style
discourages this sort of "boastful" language and encourages us to focus on
the facts at hand.
2020-10-26 09:55:21 -07:00
Martin Atkins 248cf7f13a main: A slightly more compact presentation of the main help text
This just reduces the amount of space between different elements on in the
main help output from four columns to two. The main motivation here was
to give some of the longer command descriptions a little more horizontal
breathing room, but subjectively I also find the tighter column gutters
easier to scan. Others may disagree, of course.
2020-10-26 09:55:21 -07:00
Martin Atkins c94a6102df command: Improve consistency of the command short descriptions
The short description of our commands (as shown in the main help output
from "terraform") was previously very inconsistent, using different
tense/mood for different commands. Some of the commands were also using
some terminology choices inconsistent with how we currently talk about
the related ideas in our documentation.

Here I've tried to add some consistency by first rewriting them all in
the imperative mood (except the ones that just are just subcommand
groupings), and tweaking some of the terminology to hopefully gel better
with how we present similar ideas in our recently-updated docs.

While working on this I inevitably spotted some similar inconsistencies
in the longer-form help output of some of the commands. I've not reviewed
all of these for consistency, but I did update some where the wording
was either left inconsstent with the short form changes I'd made or
where the prose stood out to me as particularly inconsistent with our
current usual documentation language style.

All of this is subjective, so I expect we'll continue to tweak these over
time as we continue to develop our documentation writing style based on
user questions and feedback.
2020-10-26 09:55:21 -07:00
Martin Atkins 9665901e8e main: Emphasize only the primary workflow commands in our help
A long time ago we introduced this separation between "common commands"
and "all other commands", but over the intervening years we've not really
done a good job of classifying new commands we've added and so by default
most of them ended up being classified as "common".

In the interests of making this output more useful for those getting
started, this switches the two categories so that "Main commands" is now
the curated list, and "all other commands" is the bucket for everything
else.

The intent here is that the "main commands" are the ones users are likely
to try as part of their initial learning of Terraform, while the other
commands are for less common situations where the user is more likely to
learn about a specific command in some other context, like a tutorial
about a special situation.

The "main commands" are also now ordered by the sequence users will
typically run them in, rather than alphabetical order. That's a subjective
readability tradeoff, but I think as long as the list stays relatively
short (which it should) it's still relatively easy to scan and find a
particular command in the shortlist.
2020-10-26 09:55:21 -07:00