Commit Graph

27461 Commits

Author SHA1 Message Date
Pam Selle fd52bf21e8 Mark variables as sensitive (if relevant) in validate
Ensure that variables are marked in the validate walk
so that appropriate diags will surface at validate
rather than surprising users at apply
2020-11-05 16:09:10 -05:00
Pam Selle 61c4e49b11
Merge pull request #26827 from hashicorp/pselle/cty-mod
Update zclconf/go-cty dependency
2020-11-05 14:18:22 -05:00
Pam Selle 5ed4af0290 Update zclconf/go-cty dependency 2020-11-05 11:46:36 -05:00
James Bardin 1d6fdff999
Merge pull request #26826 from hashicorp/jbardin/plugin-crash-filter
hide provider crashes from panicwrap when logging
2020-11-05 11:04:24 -05:00
James Bardin d52e17e111 hide provider crashes from panicwrap when logging
When logging is turned on, panicwrap will still see provider crashes and
falsely report them as core crashes, hiding the formatted provider
error. We can trick panicwrap by slightly obfuscating the error line.
2020-11-05 10:54:21 -05:00
James Bardin cb541be377
Merge pull request #26810 from hashicorp/jbardin/validate-ignore-changes
Allow null attributes to be referenced in ignore_changes
2020-11-05 08:29:26 -05:00
Martin Atkins 7e212cd02f
Update CHANGELOG.md 2020-11-04 17:07:53 -08:00
Martin Atkins ae3c0c6a4a lang/funcs: Remove the deprecated "list" and "map" functions
Prior to Terraform 0.12 these two functions were the only way to construct
literal lists and maps (respectively) in HIL expressions. Terraform 0.12,
by switching to HCL 2, introduced first-class syntax for constructing
tuple and object values, which can then be converted into list and map
values using the tolist and tomap type conversion functions.

We marked both of these functions as deprecated in the Terraform v0.12
release and have since then mentioned in the docs that they will be
removed in a future Terraform version. The "terraform 0.12upgrade" tool
from Terraform v0.12 also included a rule to automatically rewrite uses
of these functions into equivalent new syntax.

The main motivation for removing these now is just to get this change made
prior to Terraform 1.0. as we'll be doing with various other deprecations.
However, a specific reason for these two functions in particular is that
their existence is what caused us to invent the idea of a "type expression"
as a distinct kind of expression in Terraform v0.12, and so removing them
now would allow potentially  unifying type expressions with value
expressions in a future release.

We do not have any current specific plans to make that change, but one
potential motivation for doing so would be to take another attempt at a
generalized "convert" function which takes a type as one of its arguments.
Our previous attempt to implement such a function was foiled by the fact
that Terraform's expression validator doesn't have any way to know to
treat one argument of a particular function as special, and so it was
generating incorrect error messages. We won't necessarily do that, but
having these "list" and "map" functions out of the way leaves the option
open.
2020-11-04 17:05:59 -08:00
James Bardin c5b4ccfe8c
Merge pull request #26816 from hashicorp/jbardin/provider-config
Validate final provider configuration
2020-11-04 16:57:02 -05:00
James Bardin 99db18388a return diagnostics from resource validation
Return diagnostics rather than an error, since the EvalNodes have been
removed and the caller has been updated.

IgnoreWarnings was no longer used.
2020-11-04 16:56:17 -05:00
James Bardin 73680546a8 udpate PrepareProviderConfig docs
Indicate that the PreparedConfig is not used by core.
2020-11-04 13:02:04 -05:00
James Bardin e7b2d98ca3 Use prepared config in provider.Configure
Core is only using the PrepareProviderConfig call for the validation
part of the method, but we should be re-validating the final config
immediately before Configure.

This change elects to not start using the PreparedConfig here, since
there is no useful reason for it at this point, and it would
introduce a functional difference between terraform releases that can be
avoided.
2020-11-04 12:53:00 -05:00
James Bardin 96b099cf35 allow nil config attributes in ignore_changes
The validation for ignore_changes was too broad, and makes it difficult
to ignore changes in an attribute that the user does not want to set.
While the goal of ignore_changes is to prevent changes in the
configuration alone, we don't intend to break the use-case of ignoring
drift from the provider. Since we cannot easily narrow the validation to
only detect computed attributes at the moment, we can drop this error
altogether for now.
2020-11-04 11:03:12 -05:00
Alisdair McDiarmid fd43bc7847
Merge pull request #26783 from hashicorp/alisdair/normalize-version-constraints-before-deduplication
getproviders: Normalize versions before dedupe
2020-11-04 09:42:19 -05:00
Alisdair McDiarmid 4da3e01b82
Merge pull request #26762 from hashicorp/alisdair/upgrade-go-getter
Upgrade go-getter to v1.5.0
2020-11-04 09:11:57 -05:00
Radek Simko eddcc4d80c
docs: Fix typo (provider arg in data source) (#26802) 2020-11-04 09:55:15 -04:00
Jacob Tomaw 3f9abbc30d
Remove redundant Local Named Values section
The second Local Named Values has a subset of the information the first one has and adds nothing to the documentation other than confusion.
2020-11-03 08:09:12 -05:00
James Bardin 6bb79b7714
Merge pull request #26788 from hashicorp/jbardin/eval-self-block
allow path and terraform in self-block eval
2020-11-02 15:09:39 -05:00
Tej-Singh-Rana 832918c65b
website: fixed spelling error (#26758) 2020-11-02 11:15:44 -08:00
timvandamme fbf267fbfd
website: for_each doesn't implicitly convert to set (#26450)
The documentation states that an explicit type conversion to set is needed, but it does not say why implicit type conversion does not work. 

Co-authored-by: Nick Fagerlund <nick@hashicorp.com>
2020-11-02 11:13:51 -08:00
James Bardin 7c4d00c04c allow path and terraform in self-block eval
We can insert the terraform and path values into EvalSelfBlock, since
these are static and always known during evaluation.
2020-11-02 14:00:58 -05:00
Alisdair McDiarmid 90c4f11b61 go get github.com/hashicorp/go-getter@v1.5.0
Includes fix for breaking upstream API change.
2020-11-02 10:46:24 -05:00
Alisdair McDiarmid b1bc0e5d92 getproviders: Normalize versions before dedupe
When rendering a set of version constraints to a string, we normalize
partially-constrained versions. This means converting a version
like 2.68.* to 2.68.0.

Prior to this commit, this normalization was done after deduplication.
This could result in a version constraints string with duplicate
entries, if multiple partially-constrained versions are equivalent. This
commit fixes this by normalizing before deduplicating and sorting.
2020-11-02 10:45:45 -05:00
Alisdair McDiarmid 3ed08e3566 Remove backport review teams for now
This requires more GitHub token permissions than we have, and it's
inessential. The backport PRs should have reviews assigned to the
original PR author anyway.
2020-11-02 10:43:22 -05:00
Alisdair McDiarmid 7ec85a7588
Merge pull request #26784 from hashicorp/alisdair/only-show-root-module-output-changes
backend: Only show root module output changes
2020-11-02 10:34:59 -05:00
Alisdair McDiarmid b335918c3c backend: Only show root module output changes
When rendering planned output changes, we need to filter the plan's
output changes to ensure that only root module outputs which have
changed are rendered. Otherwise we will render changes for submodule
outputs, and (with concise diff disabled) render unchanged outputs also.
2020-11-02 10:24:22 -05:00
Radek Simko a413fa7425
Merge pull request #26763 from hashicorp/radeksimko-patch-1
docs: fix typo in provider local name
2020-10-31 08:37:33 +00:00
tuathail 33ee8a410c
website: Add note re: private_key configuration to intro (#24463) 2020-10-30 18:09:21 -07:00
Repon Kumar Roy 34549b402b website: clarify version constraint syntax 2020-10-30 17:44:48 -07:00
Nick Fagerlund a058b64eb5
website: Index for `element` must be a non-negative integer (#26679)
* The index must be non-negative integer

and added instructions on how to get the last value in the list.

* Typo fix

Co-authored-by: Nick Fagerlund <nick@hashicorp.com>
2020-10-30 17:43:35 -07:00
Nick Fagerlund 5a4957f141
Typo fix 2020-10-30 17:42:40 -07:00
Nick Fagerlund a0fee4c380 website: one more provider name typo 2020-10-30 17:35:23 -07:00
Radek Simko 8476c3f13e
docs: fix typo in provider local name 2020-10-30 21:59:19 +00:00
Alvin Huang 70a8be60b9 switch to hashicorp docker mirror 2020-10-29 22:37:11 -04:00
Alisdair McDiarmid 13d70844d7
Upgrade backport-assistant 2020-10-29 15:29:14 -04:00
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