Commit Graph

27862 Commits

Author SHA1 Message Date
Jessica Stenning 24e7a5596b Fix sentence in v0.14 upgrade guide 2021-02-18 14:34:04 +00:00
Kristin Laemmert 2b4e389839
Mildwonkey/nested type format (#27793)
* command/format: check for sensitive NestedTypes

Eventually, the diff formatter will need to be updated to properly
handle NestedTypes, but for now we can let the existing function deal
with them as regular cty.Object-type attributes.

To avoid printing sensitive nested attributes, we will treat any
attribute with at least one sensitive nested attribute as an entirely
sensitive attribute.

* bugfix for Object ImpliedType()

ImpliedType() was returning too early when the given object had optional
attributes, therefore skipping the incredibly important step of
accounting for the nesting mode when returning said type.
2021-02-18 08:48:52 -05:00
Alisdair McDiarmid 1d0414a63a
Merge pull request #27813 from hashicorp/paddy_empty_diags
Test empty diagnostics.
2021-02-18 08:22:10 -05:00
Paddy Carver 6c57395ef3 Test empty diagnostics.
Add a test for a diagnostic with no steps to make sure it still gets
associated with the resource in the config. Follow up to #27710 using
@alisdair's suggested testing.
2021-02-18 02:08:10 -08:00
Matthew Frahry 31387d2a0b
Update changelog for #26561 2021-02-17 15:15:55 -08:00
Matthew Frahry 85b9bdea96
backend/azure: azure state refreshes outside of grabbing the lock #26561 2021-02-17 15:14:47 -08:00
Pam Selle 48bfde2e28
Merge pull request #27798 from hashicorp/pselle/upgrade_command_removal
Remove removed `upgrade` commands
2021-02-17 14:42:33 -05:00
Pam Selle 08b649b6f9 Remove removed upgrade commands
Delete commands that are no longer in Terraform and have been
removed for a full release cycle.
2021-02-17 14:34:58 -05:00
James Bardin 04b5c7d452
Merge pull request #27800 from amslezak/patch-1
sentence refactor - consistently -> consistency
2021-02-17 09:02:20 -05:00
James Bardin 2b1dc1ef0d
Merge pull request #27517 from njuCZ/fix_functions_tc
fix test case on windows
2021-02-17 09:00:07 -05:00
James Bardin b0094dbf36
Merge pull request #27678 from GreenHedgehog/master
Fix possible nil pointer dereference in azure sdk
2021-02-17 08:49:49 -05:00
Matthew Frahry d89c8f5dcf
Update changelog for #26721 2021-02-16 23:27:09 -08:00
Matthew Frahry 81dc028689
backend/azurerm: updating the dependencies for the Azure Backend #26721 2021-02-16 23:24:56 -08:00
Andy Slezak 0639054683
sentence refactor - consistently -> consistency 2021-02-16 18:29:31 -05:00
Pam Selle d390fad487
Merge pull request #27799 from hashicorp/pselle/fix_test
[tests] Remove duplicate declaration
2021-02-16 18:17:11 -05:00
Pam Selle b582b19359 Remove duplicate declaration 2021-02-16 18:08:36 -05:00
Alisdair McDiarmid 6375c6ce6b
Merge pull request #27787 from hashicorp/alisdair/command-views-state-locker
clistate: Update clistate.Locker for command views
2021-02-16 17:37:18 -05:00
James Bardin 5b36b37b82
Merge pull request #27758 from hashicorp/jbardin/configuration_aliases-docs
update docs for configuration_aliases
2021-02-16 17:35:24 -05:00
Alisdair McDiarmid bfe791d074
Update CHANGELOG.md 2021-02-16 17:28:20 -05:00
Alisdair McDiarmid f7dbb1ab33
Merge pull request #27796 from hashicorp/alisdair/fix-missing-deposed-key-preapply
terraform: Fix missing deposed key for PreApply
2021-02-16 17:26:24 -05:00
Alisdair McDiarmid 8fb319bc79
Merge pull request #27790 from hashicorp/alisdair/ui-hook-miscolored
cli: Fix misapplied terminal colors on run logs
2021-02-16 17:15:53 -05:00
Alisdair McDiarmid f1a292652d terraform: Fix missing deposed key for PreApply
The PreApply hook was always being called with a nil generation
argument, instead of the deposed key of the resource (if present). This
commit passes the deposed key from the change to the PreApply hook, and
adds a context test to cover this.
2021-02-16 17:14:52 -05:00
James Bardin 0d63b3ec24
Merge pull request #27791 from hashicorp/jbardin/test-conformance-dynamic
reverse call to TestConformance in objchange
2021-02-16 15:42:12 -05:00
Alisdair McDiarmid 0aa227e0e3 cli: Fix misapplied terminal colors on run logs
Due to calling the Colorize function with the full string instead of the
format string, plan/apply logs which include resource instance keys or
IDs which happen to match color formatting would be rendered
incorrectly.

This commit fixes this by only colorizing the known-safe format string.
We also add full test coverage for the UI hook, although only one of the
hooks is tested for this color bugfix due to verbosity of the test.

We also add the bold coloring to the provisioner output prefix, which
seems to have been an oversight.
2021-02-16 15:05:22 -05:00
Kristin Laemmert 7943312ebd
Merge pull request #27699 from hashicorp/mildwonkey/protocolv6
Mildwonkey/protocolv6
2021-02-16 14:51:53 -05:00
Alisdair McDiarmid 1bda146676
Remove changelog entry for backported PR
This is now shipping in 0.14.7
2021-02-16 14:42:11 -05:00
James Bardin 22f21db229 reverse call to TestConformance in objchange
The call to TestConformance needs to be reversed, since we want to
verify that the actual value returned conforms to the planned type.
While the inverse (checking that the planned value conforms to the
applied type) works for everything terraform has been exposed to up
until now, this fails when the planned type has dynamic attributes which
are allowed to become concrete types.
2021-02-16 12:55:02 -05:00
Alisdair McDiarmid 1ae3d30383
Merge pull request #27760 from hashicorp/alisdair/command-views-ui-hook
cli: Migrate Terraform UI hook to command views
2021-02-16 09:36:47 -05:00
Alisdair McDiarmid 20cb28b25f
Merge pull request #27788 from hashicorp/alisdair/command-views-output-tests
views: Expand test coverage for views.Output
2021-02-16 09:07:18 -05:00
Alisdair McDiarmid 1301e38caa
Merge pull request #27786 from hashicorp/alisdair/refresh-empty-diag
backend/local: Return diag for refresh empty state
2021-02-16 09:05:50 -05:00
Alisdair McDiarmid bb3f59b016
Merge pull request #27697 from hashicorp/alisdair/json-plan-provider-required-versions
cli: Fix for missing provider requirements in JSON plan
2021-02-16 09:05:14 -05:00
Alisdair McDiarmid 96cf29111d views: Expand test coverage for views.Output
Now that the view code is separated, we can increase test coverage in
unit tests. This commit moves some tests from the command package which
were testing only view code, and adds more new test cases.
2021-02-16 08:48:31 -05:00
Alisdair McDiarmid 3257f31aa7 backend/local: Return diag for refresh empty state
The warning diag added when refreshing an empty state file was never
rendered, and instead a custom (and incorrect) warning was output to the
UI. This commit fixes the dropped diag and removes the custom warning.
2021-02-16 07:23:31 -05:00
Alisdair McDiarmid 2d1976bbda clistate: Update clistate.Locker for command views
The clistate package includes a Locker interface which provides a simple
way for the local backend to lock and unlock state, while providing
feedback to the user if there is a delay while waiting for the lock.
Prior to this commit, the backend was responsible for initializing the
Locker, passing through direct access to the cli.Ui instance.

This structure prevented commands from implementing different
implementations of the state locker UI. In this commit, we:

- Move the responsibility of creating the appropriate Locker to the
  source of the Operation;
- Add the ability to set the context for a Locker via a WithContext
  method;
- Replace the Locker's cli.Ui and Colorize members with a StateLocker
  view;
- Implement views.StateLocker for human-readable UI;
- Update the Locker interface to return detailed diagnostics instead of
  errors, reducing its direct interactions with UI;
- Add a Timeout() method on Locker to allow the remote backend to
  continue to misuse the -lock-timeout flag to cancel pending runs.

When an Operation is created, the StateLocker field must now be
populated with an implementation of Locker. For situations where locking
is disabled, this can be a no-op locker.

This change has no significant effect on the operation of Terraform,
with the exception of slightly different formatting of errors when state
locking or unlocking fails.
2021-02-16 07:19:22 -05:00
Alisdair McDiarmid a7b7cd29fc cli: Migrate Terraform UI hook to command views
Move the code which renders Terraform hook callbacks as UI into the
views package, backed by a views.View instead of a cli.Ui. Update test
setup accordingly.

To allow commands to control this hook, we add a hooks member on the
backend Operation struct. This supersedes the hooks in the Terraform
context, which is not directly controlled by the command logic.

This commit should not change how Terraform works, and is refactoring in
preparation for more changes which move UI code out of the backend.
2021-02-16 07:18:22 -05:00
Alisdair McDiarmid fa774dafc0
Merge pull request #27761 from hashicorp/alisdair/command-views-operation-diagnostics
backend: Add per-operation diagnostic rendering
2021-02-16 07:17:31 -05:00
Matthew Frahry cb041053e9 Merge with master 2021-02-15 14:37:40 -08:00
Matthew Frahry 2b42445454
Update client.go 2021-02-15 12:09:31 -08:00
Matthew Frahry f52a18b134
Update backend/remote-state/azure/client.go
Co-authored-by: Tom Harvey <tombuildsstuff@users.noreply.github.com>
2021-02-15 12:04:07 -08:00
Alisdair McDiarmid a351053a2b
Merge pull request #27762 from hashicorp/alisdair/command-views-helpers
views: Use new streams helper functions
2021-02-12 16:19:54 -05:00
James Bardin 6e72b04cbc
Merge pull request #27710 from hashicorp/paddy_empty_diags
Fix empty diags not getting associated with source.
2021-02-12 16:14:14 -05:00
Alisdair McDiarmid 3cd086f46c views: Use new streams helper functions 2021-02-12 15:37:02 -05:00
James Bardin d54a9b176b
Update website/docs/language/providers/configuration.html.md
Co-authored-by: Kristin Laemmert <mildwonkey@users.noreply.github.com>
2021-02-12 14:57:51 -05:00
James Bardin e40727076f
Update website/docs/language/modules/develop/providers.html.md
Co-authored-by: Kristin Laemmert <mildwonkey@users.noreply.github.com>
2021-02-12 14:57:26 -05:00
James Bardin 9859d4e70b
Update website/docs/language/modules/develop/providers.html.md
Co-authored-by: Kristin Laemmert <mildwonkey@users.noreply.github.com>
2021-02-12 14:55:57 -05:00
James Bardin dfd8424392 link configuration aliases between pages 2021-02-12 14:54:55 -05:00
Alisdair McDiarmid 536c80da23 backend: Add per-operation diagnostic rendering
The enhanced backends (local and remote) need to be able to render
diagnostics during operations. Prior to this commit, this functionality
was supported with a per-backend `ShowDiagnostics` function pointer.

In order to allow users of these backends to control how diagnostics are
rendered, this commit moves that function pointer to the `Operation`
type. This means that a diagnostic renderer is configured for each
operation, rather than once per backend initialization.

Some secondary consequences of this change:

- The `ReportResult` method on the backend is now moved to the
  `Operation` type, as it needs to access the `ShowDiagnostics` callback
  (and nothing else from the backend);
- Tests which assumed that diagnostics would be written to the backend's
  `cli.Ui` instance are migrated to using a new record/playback diags
  helper function;
- Apply, plan, and refresh commands now pass a pointer to the `Meta`
  struct's `showDiagnostics` method.

This commit should not change how Terraform works, and is refactoring in
preparation for more changes which move UI code out of the backend.
2021-02-12 14:30:35 -05:00
Martin Atkins f91a3b87c1 terminal: Helpers for doing fmt-ish operations on the streams
It's pretty common to want to apply the various fmt.Fprint... functions
to our two output streams, and so to make that much less noisy at the
callsite here we have a small number of very thin wrappers around the
underlying fmt package functionality.

Although we're aiming to not have too much abstraction in this "terminal"
package, this seems justified in that it is only a very thin wrapper
around functionality that most Go programmers are already familiar with,
and so the risk of this causing any surprises is low and the improvement
to readability of callers seems worth it.
2021-02-12 11:24:13 -08:00
Kristin Laemmert 8c2abbc0f0 return the properly-typed nulls, instead of empty containers, in proposedNewNestedType 2021-02-12 13:37:45 -05:00
Kristin Laemmert 1cf4909b28 configschema: fix various issues with NestedTypes
A handful of bugs popped up while extending the testing in
plans/objchange. The main themes were failing to recurse through deeply
nested NestedType attributes and improperly building up the ImpliedType.
This commit fixes those issues and extends the test coverage to match.
2021-02-12 13:34:25 -05:00