Commit Graph

27176 Commits

Author SHA1 Message Date
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
James Bardin 477111e6b6 change apply Eval methods to use diags 2020-10-27 18:16:28 -04:00
James Bardin 12c07752f2
Merge pull request #26694 from hashicorp/jbardin/plugin-panics
Handle panics in plugins
2020-10-26 10:32:10 -04:00
James Bardin 5f063ae94a make grpcErr work for either plugin type
Extract a better function name and make the errors generic for different
plugin types.
2020-10-26 09:34:03 -04:00
James Bardin 3225d9ac11 record all plugin panics, and print on main exit
Create a logger that will record any apparent crash output for later
processing.

If the cli command returns with a non-zero exit status, check for any
recorded crashes and add those to the output.
2020-10-26 09:34:03 -04:00
James Bardin b4cb64d986 convert rpc errors
Terraform does not use rpc errors for any error communication, so these
are always something that went wrong in outside of the plugin protocol.
The most common example of which is a provider crash, which would return
"rpc error: code = Unavailable desc = transport is closing". Replace
these error codes with something a little more presentable for the user,
and insert the calling method name to help correlate it to the
operation that failed.
2020-10-23 19:14:59 -04:00
Arthur Burkart d4716a69e1
lang/funcs: "anytrue" function
This is an analog to the "alltrue" function, using OR as the reduce
operator rather than AND.

This also includes some simplification of the "alltrue" implementation
to implement it similarly as a sort of reduce operation with AND
as the reduce operator, but with the same effective behavior.
2020-10-23 13:52:48 -07:00
Alisdair McDiarmid 5522a799f5
Merge pull request #26690 from hashicorp/alisdair/codecov-patch-stop-please
build: Set Codecov to informational mode again
2020-10-23 16:30:53 -04:00
Alisdair McDiarmid 6345187c84 build: Set Codecov to informational mode again
We have informational mode enabled for pull requests. This commit
enables it for individual commits, too.

Informational mode registers the result of a Codecov check without ever
failing due to low coverage. This is appropriate for Terraform because
much of the test coverage comes from cross-package tests, which Codecov
misses.
2020-10-23 15:58:33 -04:00
Petros Kolyvas b1671b2ce1
website: Fix for documentation around local-name conflicts (#26689)
* Fixes #26684

* Update provider-requirements.html.md

Removing additional/extra newlines

* Update provider-requirements.html.md

And now some trailing spaces. le sigh
2020-10-23 15:16:45 -03:00
James Bardin ff94be21c2
Merge pull request #26685 from hashicorp/jbardin/separate-loggers
Separate loggers
2020-10-23 13:11:12 -04:00
James Bardin eb2d4434c8 logging env variable docs 2020-10-23 12:46:32 -04:00
James Bardin f8893785f0 separate core and provider loggers
Now that hclog can independently set levels on related loggers, we can
separate the log levels for different subsystems in terraform.

This adds the new environment variables, `TF_LOG_CORE` and
`TF_LOG_PROVIDER`, which each take the same set of log level arguments,
and only applies to logs from that subsystem. This means that setting
`TF_LOG_CORE=level` will not show logs from providers, and
`TF_LOG_PROVIDER=level` will not show logs from core. The behavior of
`TF_LOG` alone does not change.

While it is not necessarily needed since the default is to disable logs,
there is also a new level argument of `off`, which reflects the
associated level in hclog.
2020-10-23 12:46:32 -04:00
Pam Selle c9e362bb5f
Merge pull request #26653 from hashicorp/pselle/getresource
Return marked After values in GetResource
2020-10-23 12:28:03 -04:00
James Bardin 37d57a2593
Merge pull request #26687 from hashicorp/jbardin/warning-errors
do not return warnings as errors from eval
2020-10-23 12:18:27 -04:00
James Bardin 0d4cee2309
Merge pull request #26628 from hashicorp/jbardin/backport-26613
0.14 backport of 26613
2020-10-23 12:01:00 -04:00
James Bardin 820e641b97 do not return warnings as errors from eval
Warnings alone cannot be returned from eval nodes, since are still
treated as errors.
2020-10-23 10:39:30 -04:00
James Bardin ce9e4b2ebd
Merge pull request #26674 from hashicorp/jbardin/refresh-orphan
Read orphaned instances during plan
2020-10-23 08:59:15 -04:00
James Bardin b4f9c54c4d update hclog
Added an Off level to hclog, so we can individually disable logging at
various levels.

Added IndependentLevels so that sublogger levels are not linked to their
parents.
2020-10-22 15:26:24 -04:00
Petros Kolyvas bfbdbe9bba
Tool-specific provisioner docs change to red notice box (#26681) 2020-10-22 15:50:46 -03:00
Jakson Rodrigues 818029826b
Fixed config argument on example (#26304) 2020-10-22 14:08:25 -03:00
Kerim Satirli f4790d8f61
updates `description` to reflect endpoint usage (#26278) 2020-10-22 13:56:11 -03:00
Thanonchai f3fa59f65d
Update config.html.md (#26622)
* Update config.html.md

When reading this page, I couldn't find the list of the "supported backends to the left".  They're actually on a different page, so thought I'd update it so that others wouldn't find it confusing like me.

If this is ok with you, would it be possible to label this PR with 'hacktoberfest-accepted'?  I'm still new to this.  If not, I'd be alright.  Thank you!

* Update config.html.md

Swapped the full URL in the link for a relative path

Co-authored-by: Petros Kolyvas <petros@hashicorp.com>
2020-10-22 13:49:40 -03:00
Justin Long 0ce11faffd
Clear wording that bucket must pre-exist (#26276)
Experienced similar issue as https://github.com/hashicorp/terraform/issues/18417 this updates the documentation so that it's more clear a storage bucket must exist prior to configuring the backend.
2020-10-22 13:35:02 -03:00
James Bardin bc1a841d65
Merge pull request #26665 from hashicorp/jbardin/logging
Restore "crash.log" behavior and remove prefixedio
2020-10-22 10:34:51 -04:00
James Bardin 73627e4dc3 don't read data sources that are to be removed
We can directly remove orphaned data sources from the refesh state.
2020-10-22 10:15:22 -04:00
James Bardin 72e81de0fc update tests
Some tests could not handle reading orphaned resources. It also turns
out the ReadResource mock never returned the correct state in the
default case at all.
2020-10-22 09:46:42 -04:00
James Bardin ddb2bbf4e9 Read orphaned resources during plan
This forces orphaned resources to be re-read during planning, removing
them from the state if they no longer exist.

This needs to be done for a bare `refresh` execution, since Terraform
should remove instances that don't exist and are not in the
configuration from the state. They should also be removed from state so
there is no Delete change planned, as not all providers will gracefully
handle a delete operation on a resource that does not exist.
2020-10-22 09:46:42 -04:00
James Bardin ef4fee5acb warnings are now on stderr 2020-10-21 18:24:09 -04:00
James Bardin c2af5333e8 use a log sink to capture logs for panicwrap
Use a separate log sink to always capture trace logs for the panicwrap
handler to write out in a crash log.

This requires creating a log file in the outer process and passing that
path to the child process to log to.
2020-10-21 17:29:07 -04:00
James Bardin b61488a8ba write traceback to log crash log 2020-10-21 17:29:07 -04:00
James Bardin a2dee91eba update hclog-go
We need some fixes from master.
2020-10-21 17:29:07 -04:00
James Bardin fd4f7eb0b9 remove prefixed io
The main process is now handling what output to print, so it doesn't do
any good to try and run it through prefixedio, which is only adding
extra coordination to echo the same data.
2020-10-21 17:29:07 -04:00
Jerry Chong 2f091836c9
Modified terraform get command (#26465)
-Added PATH
-Added -no-color option
2020-10-21 18:14:54 -03:00
Diod FR f0edb192b3
ADD CLI option position for force-unlock command (#26626)
* ADD CLI option position for force-unlock command

* Update force-unlock.html.markdown

Made a change to also include the missing [DIR]

Co-authored-by: Petros Kolyvas <petros@hashicorp.com>
2020-10-21 18:13:18 -03:00
Pam Selle c6be76e53c Return marked After values in GetResource
If a change exists for a resource instance,
the After value is returned, however, this value
will not have its marks as it as been encoded.
This Marks the return value so the marks follow
that resource reference.
2020-10-21 16:18:54 -04:00
Alisdair McDiarmid bc769aeb7c
Update CHANGELOG.md 2020-10-21 14:12:48 -04:00
Bishwa Shrestha c41336bc77
Exit with error if UI input scan fails (#26509) 2020-10-21 14:10:06 -04:00
Martin Atkins 70c52c778c
lang/funcs: textencodebase64 and textdecodebase64 2020-10-21 11:09:25 -07:00
Martin Atkins 1dc4950bfa lang/funcs: Rename the base64 character encoding functions
These were initially introduced as functions with "encode" and "decode"
prefixes, but that doesn't match with our existing convention of putting
the encoding format first so that the encode and decode functions will
group together in a alphabetically-ordered function list.

"text" is not really a defined serialization format, but it's a short word
that hopefully represents well enough what these functions are aiming to
encode and decode, while being consistent with existing functions like
jsonencode/jsondecode, yamlencode/yamldecode, etc.

The "base64" at the end here is less convincing because there is precedent
for that modifier to appear both at the beginning and the end in our
existing function names. I chose to put it at the end here because that
seems to be our emergent convention for situations where the base64
encoding is a sort of secondary modifier alongside the primary purpose
of the function, as we see with "filebase64". (base64gzip is an exception
here, but it seems outvoted by the others.)
2020-10-21 10:56:56 -07:00
James Bardin 1d9d82973b move panicwrap handler to logging package 2020-10-21 13:47:16 -04:00