Commit Graph

27494 Commits

Author SHA1 Message Date
James Bardin 627a2121b8
Merge pull request #27174 from hashicorp/jbardin/ignore-unknown
ignore_changes can ignore unknowns too
2020-12-07 17:40:21 -05:00
Pam Selle 1db33b7ec7
Merge pull request #27169 from hashicorp/pselle/get-plugins
Update docs and add warning for -get-plugins
2020-12-07 14:22:04 -05:00
Pam Selle b963ea8594 Update docs and add warning for -get-plugins
As of Terraform 0.13+, the get-plugins command has been
superceded by new provider installation mechanisms, and
general philosophy (providers are always installed, but
the sources may be customized). Updat the init command
to give users a warning if they are setting this flag,
to encourage them to remove it from their workflow, and
update relevant docs and docstrings as well
2020-12-07 14:13:52 -05:00
James Bardin ee52f26647 ignore_changes can ignore unknowns too
The logic for handling unknown equality was incorrect, and would miss
changes where the configuration is still not known during plan.
2020-12-07 14:01:44 -05:00
Kristin Laemmert bedc08f5eb
terraform: refactor EvalWriteStateDeposed (#27149)
* terraform: refactor EvalWriteStateDeposed

EvalWriteStateDeposed is now
NodeDestroyDeposedResourceInstanceObject.writeResourceInstanceState.
Since that's the only caller I considered putting the logic directly
inline, but things are clunky enough right now that I think this is good
enough for this refactor.
2020-12-07 08:39:20 -05:00
Pam Selle ae025248cc
Merge pull request #27131 from hashicorp/pselle/double-marks
Avoid double-marking variables
2020-12-04 13:21:54 -05:00
Pam Selle 12b5d437da Avoid double-marking variables
It is possible, say with multiple layers of
sensitive variables, to "double-mark" a variable.
Add a check to ensure this does not happen.
2020-12-04 13:10:02 -05:00
James Bardin 3b4079d451
Merge pull request #27141 from hashicorp/jbardin/ignore_changes
Fixes for ignore_changes with unintended provider behavior
2020-12-04 12:55:26 -05:00
Kristin Laemmert 29d89c4a15
Eval(): refactor EvalWriteState() (#27145)
* fix inaccurate log

* terraform: refactor EvalWriteState

EvalWriteState is refactored into a method on
NodeAbstractResourceInstance and renamed writeResourceInstanceState.

Import, my nemesis, gave me pause. I did not expect to find
EvalWriteState in an transform node, and so I decided to copy the
function inline rather than rethink my entire refactor for one function
that's likely to be (heavily) refactored in the future.
2020-12-04 12:44:40 -05:00
Pam Selle 0c0ea09546
Merge pull request #27134 from tillepille/patch-1
documentation: fix small typo
2020-12-04 11:15:14 -05:00
James Bardin b831039cf8 update CHANGELOG.md 2020-12-04 10:14:49 -05:00
Kristin Laemmert 7370a98ab7
Eval() Refactor (#27087)
* terraform: refactor EvalPreApply and EvalPostApply

EvalPreApply and EvalPostApply have been refactored as methods on
NodeAbstractResourceInstance.

* terraform: remove EvalReadState and EvalReadStateDeposed

These two functions had already been re-implemented as functions on
NodeAbstractResource, so this commit finished the process of removing
the Evals and refactoring the tests.

* terraform: remove EvalRefreshLifecycle

EvalRefreshLifecycle was only used in one node,
NodePlannableResourceInstance, so the functionality has been moved
directly inline.

* terraform: remove EvalDeposeState

EvalDeposeState was only used in one function, so it has been removed
and the logic placed in-line in
NodeApplyableResourceInstance.managedResourceExecute.

* terraform: remove EvalMaybeRestoreDeposedObject

EvalMaybeRestoreDeposedObject was only used in one place, so I've
removed it in favor of in-line code.
2020-12-04 09:16:26 -05:00
James Bardin 4f4e8c17e0 validate the configuration before ignore_changes
The ignore_changes option `all` can cause computed attributes to show up
in the validation configuration, which will be rejected by the provider
SDK. Validate the config before applying the ignore_changes options.

In the future it we should probably have a way for processIgnoreChanges
to skip computed values based on the schema. Since we also want a way to
more easily query the schema for "computed-ness" to validate the
ignore_changes arguments for computed values, we can fix these at the
same time with a future change to configschema. This will most likely
require some sort of method to retrieve info from the configschema.Block
via cty.Path, which we cannot easily do right now.
2020-12-03 17:59:03 -05:00
James Bardin 02e7efab9e re-apply ignore_changes after plan for legacy
Because we allow legacy providers to depart from the contract and return
changes to non-computed values, the plan response may have altered
values that were already suppressed with ignore_changes. A prime example
of this is where providers attempt to obfuscate config data by turning
the config value into a hash and storing the hash value in the state.
There are enough cases of this in existing providers that we must
accommodate the behavior for now, so for ignore_changes to work at all
on these values, we will revert the ignored values once more on the
planned state.
2020-12-03 17:44:35 -05:00
Alisdair McDiarmid 6bacc7a73c
Merge pull request #27128 from hashicorp/alisdair/sensitivity-change-permadiff
terraform: Write state if sensitivity changes
2020-12-03 16:48:09 -05:00
Dmitry Tokarev 8d1c416a53
website: Fix link to external documentation "Git URLs" 2020-12-03 13:24:56 -08:00
James Bardin aa5c8add2e fix bug in ignore_changes Transform
The cty.Transform for ignore_changes could return early when building a
map that had multiple ignored keys.

Refactor the function to try and separate the fast-path a little better,
and hopefully make it easier to follow.
2020-12-03 16:09:12 -05:00
Alisdair McDiarmid 50f4d79867 terraform: Write state if sensitivity changes
When applying, we return early if only sensitivity changed between the
before and after values of the changeset. This avoids unnecessarily
invoking the provider.

Previously, we did not write the new value for a resource to the state
when this happened. The result was a permanent diff for resource updates
which only change sensitivity, as the apply step is skipped and the
state is unchanged.

This commit adds a state write to this shortcut return path, and fixes a
test for this exact case which was accidentally relying on a value diff
caused by an incorrect manual state value.
2020-12-03 15:58:54 -05:00
Petros Kolyvas 2ce71ab43c
Upgrade guide link fix (#27124) 2020-12-03 15:21:58 -04:00
Masayuki Morita 93b6f15c9d
website: Fix typo in docs/commands/cli-config (#27038) 2020-12-03 14:30:24 -04:00
Petros Kolyvas 20a5db1c86
Website: 0.14 Upgrade guide additions (#27112)
* Update 0-14.html.markdown

Spelling again. Thanks @pselle
2020-12-03 14:21:31 -04:00
Nick Fagerlund 0c0749edcf
website: Fix several broken links (#27091) 2020-12-03 13:54:38 -04:00
Martin Atkins 323cd4364b website: Correct formatting for lists in dependency lock docs
I originally drafted these docs in a context where I was relying on
GitHub's Markdown renderer, and carelessly imported them into the
Terraform website without verifying that the website's Markdown renderer
could process it. This particular quirk has bitten us before: the website
Markdown parser expects follow-on paragraphs in a list item to be indented
at least four spaces, and with less than that it ignores the leading
whitespace altogether and just understands a normal paragraph.

This change will cause the follow-on paragraphs to now correctly render
as part of the bullet points they are intended to be attached to.
2020-12-03 09:16:58 -08:00
Mark Lewis 9935138e1c
Update for_each.html.md
minor grammar improvement.
2020-12-03 16:45:52 +00:00
Mark Lewis ffea7a4cda
Update for_each.html.md 2020-12-03 16:45:04 +00:00
Tim Schrumpf e102465e91
fix small typo 2020-12-03 16:05:19 +01:00
Connor Osborn 2c2ed53ff3
Fix apt install typo (#27074)
Apt install expects a `name=version` NOT `name==version`
2020-12-03 10:23:14 -04:00
Petros Kolyvas 5cb2d4894c
Anytrue alltrue docs clarification. (#27108)
* Anytrue alltrue docs clarification.

* Update alltrue.html.md

I can't spell.

* Update anytrue.html.md

Yes, I can't spell.
2020-12-03 10:13:20 -04:00
Nick Fagerlund 2119510669
Merge pull request #27089 from hashicorp/dec20_release_fixes_upstream_version
website: fix a few functional glitches
2020-12-02 14:19:01 -08:00
Nick Fagerlund cca1bc91c3 website: fix bad layout in defaults function page
This layout no longer exists.
2020-12-02 14:11:44 -08:00
Nick Fagerlund 5cff04b3ab website: fix malformed yaml in a few function pages 2020-12-02 14:11:32 -08:00
James Bardin b0ce552c90
Merge pull request #27088 from hashicorp/jbardin/un-legacy
don't use legacy import for the terraform.UIInput interface
2020-12-02 15:58:40 -05:00
James Bardin dd5dae27f8 don't use legacy import for the UIInput interface
The import was switch for other types which has since been removed.
Point this at the correct package.
2020-12-02 15:44:58 -05:00
James Bardin dcf0dba6f4
Merge pull request #27081 from hashicorp/jbardin/staticcheck
Fixes to pass static analysis
2020-12-02 15:43:10 -05:00
Kristin Laemmert 3fa063b8dc
command/format: concise diff is now the default (#27079)
* command/format: concise diff is no longer an experiment

Since state formatting goes through the "diff" printer, I have
repurposed the concise flag as a verbose flag, used only when printing
state. It's silly but it works!

* remove helper/experiment
With this experiment concluded, we no longer need helper/experiment. The
shadow experiment had not been touched in many years, so I removed all
references, and removed the package entirely. Any new experiments are
expected to be configuration experiments handled by our (other)
experiments package.

* check for the verbose flag consistently, in case we end up using it in plans in the future
2020-12-02 15:42:41 -05:00
James Bardin 6529659455 internal/providercache: staticcheck 2020-12-02 13:59:20 -05:00
James Bardin 313d3e5c4d builtin/provisioners/remote-exec: staticcheck 2020-12-02 13:59:20 -05:00
James Bardin 0b4c96fa92 command/jsonprovider: staticcheck 2020-12-02 13:59:20 -05:00
James Bardin 63b521b8b7 communicator/ssh: staticcheck 2020-12-02 13:59:19 -05:00
James Bardin aeb96384fd configs/configload: staticcheck 2020-12-02 13:59:19 -05:00
James Bardin 9c3ece40f7 configs/configschema: staticcheck 2020-12-02 13:59:19 -05:00
James Bardin 82305bf1c8 configs: staticcheck 2020-12-02 13:59:19 -05:00
James Bardin 8925d94387 dag: staticcheck 2020-12-02 13:59:19 -05:00
James Bardin 89a8624d8c instances: staticcheck 2020-12-02 13:59:19 -05:00
James Bardin d22e08bd32 internal/earlyconfig: staticcheck 2020-12-02 13:59:19 -05:00
James Bardin f0c3ddf5a1 internal/getproviders: staticcheck 2020-12-02 13:59:19 -05:00
James Bardin 4ad7c41ab4 unused 2020-12-02 13:59:19 -05:00
James Bardin 276dfe634f internal/providercache: staticcheck 2020-12-02 13:59:19 -05:00
James Bardin 1f359bab03 internal/typeexpr: staticcheck
diagnostics were appended to diags shadowing the intended value.
2020-12-02 13:59:19 -05:00
James Bardin e08422511e lang/funcs: staticcheck 2020-12-02 13:59:19 -05:00