Commit Graph

29170 Commits

Author SHA1 Message Date
Laura Pacilio 19101df1d4
Merge pull request #29887 from strugee/patch-1
Fix typo in 0.13 upgrade guide
2021-11-05 11:08:05 -04:00
AJ Jordan 8367c049c8
Fix typo in 0.13 upgrade guide 2021-11-04 16:19:35 -04:00
Chris Arcand 4f66479506
Merge pull request #29881 from hashicorp/chrisarcand/streamline-remote-migration
cloud: Add streamlined 'remote' backend state migration path
2021-11-03 15:30:12 -05:00
Chris Arcand 779c958fbf cloud: Add streamlined 'remote' backend state migration path
For Terraform Cloud users using the 'remote' backend, the existing
'pattern' prompt should work just fine - but because their workspaces
are already present in TFC, the 'migration' here is really just
realigning their local workspaces with Terraform Cloud. Instead of
forcing users to do the mental gymnastics of what it means to migrate
from 'prefix' - and because their remote workspaces probably already exist and
already conform to Terraform Cloud's naming concerns - streamline the
process for them and calculate the necessary pattern to migrate as-is,
without any user intervention necessary.
2021-11-03 15:07:33 -05:00
Chris Arcand 2690f738aa
Merge pull request #29878 from hashicorp/tweak-multi-to-multi-migration-tfc
cloud: Autoselect migrated current workspace + migrate UX adjustments
2021-11-03 12:12:24 -05:00
Chris Arcand 6f25ad3e17 cloud: Display the newly renamed workspaces after a migration 2021-11-03 11:27:35 -05:00
Chris Arcand c3bf5d4512 cloud: Automatically select renamed current workspace
After migrating to TFC with renamed workspaces, automatically select
what was the previous current workspace on behalf of the user. We don't
need to make the user reselect.
2021-11-03 11:27:35 -05:00
Chris Arcand f80b2177c8 cloud: Tweak multi-to-multi migration UX
Note these change do break the internal/cloud/e2e tests; they are in a
sad state that needs adjusting anyway, so I'm not updating them for
these changes at this time.
2021-11-03 11:26:52 -05:00
James Bardin 5a8021f03d
Merge pull request #29868 from xiaozhu36/xiaozhu
backend/oss: Removes the ConflictWith tag which on the attributes assume_role* to fix the incompatible error
2021-11-03 09:14:12 -04:00
James Bardin 913f9cc44a
Merge pull request #29862 from hashicorp/jbardin/validate-resource-values
generate precise resource types during validate
2021-11-03 08:59:09 -04:00
James Bardin 5e943ecc3d
Merge pull request #29864 from hashicorp/jbardin/update-cty
update go-cty to v1.10.0
2021-11-03 08:57:40 -04:00
xiaozhu36 e0a2716601 backend/oss: Removes the ConflictWith tag which on the attributes assume_role* to fix the incompatible error 2021-11-03 11:17:35 +08:00
Chris Arcand 858dc96859
Merge pull request #29853 from hashicorp/cloud-tags-workspace
Cloud: Update Workspace during Tags strategy
2021-11-02 20:33:08 -05:00
James Bardin ca6d3cf50f update go-cty
cty: The documented definition and comparison logic of cty.Number is now
refined to acknowledge that its true range is limited only to values
that have both a binary floating point and decimal representation,
because cty values are primarily designed to traverse JSON serialization
where numbers are always defined as decimal strings.

In particular, that means that two cty.Number values now always compare
as equal if their representation in JSON (under cty's own JSON encoder)
would be equal, even though the decimal approximation we use for that
conversion is slightly lossy. This pragmatic compromise avoids confusing
situations where a round-trip through JSON serialization (or other
serializations that use the same number format) may produce a value that
doesn't compare equal to the original.

This new definition of equals should not cause any significant behavior
change for any integer in our in-memory storage range, but may cause
some fractional values to compare equal where they didn't before if they
differ only by a small fraction.
2021-11-02 17:30:26 -04:00
Martin Atkins 938c0aeee9
Update CHANGELOG.md 2021-11-02 14:20:16 -07:00
Omar Ismail 1da7031855 cloud: Add tags to workspace if necessary when fetching state 2021-11-02 16:18:17 -05:00
Chris Arcand ece80c0fc2 Update CHANGELOG.md 2021-11-02 15:34:49 -05:00
Chris Arcand f04ea2bd3d
Merge pull request #29860 from hashicorp/fix-init-after-error-take-two
command: Update backend hash value only after a successful migration
2021-11-02 15:28:58 -05:00
Chris Arcand 7c0c2e952f command: Don't always update backend hash when fetching the saved backend
The Meta.backend_C_r_S_unchanged() method was sadly a bit of a mess.

It seems to have originally been used as a method to be called
when the backend is not changing, with an extra assumption that if the
configured backend's hash doesn't match the one in state, surely the
hash should just be updated as an option might have been moved to
command line flags.

However, this function was used throughout this file as 'the method to
load the initialized (but not necessarily configured) backend',
regardless of whether or not it is the same (unchanged). This is in
addition to Meta.backendFromState(), which is used to load the same
thing except in the main codepath of 'init -backend=false'.

These changes separate the concerns of backend_C_r_S_unchanged() by

1) Fetching the saved backend (savedBackend())
2) Updating the hash value in the backend cache when appropriate (either
   by leaving it to the caller to do themselves or by calling
   updateSavedupdateSavedBackendHash())

This allows migration codepaths to *not* update the hash value until
after a migration has successfully taken place.
2021-11-02 15:23:58 -05:00
James Bardin 647d36062c we don't need an abs provider address
We only lookup providers by provider type to get the schema, so there's
no reason to generate anything more specific.
2021-11-02 15:38:53 -04:00
James Bardin 6b8b0617bb generate precise resource types during validate
Allow `GetResource` to return correct types values during validation,
rather than relying on `cty.DynamicVal` as a placeholder. This allows
other dependent expressions to be more correctly evaluated.
2021-11-02 15:38:36 -04:00
Alisdair McDiarmid f019fb112e
Update CHANGELOG.md 2021-11-02 11:29:48 -04:00
Łukasz Sierant 19cce931a8 Test case for changing backend hash during aborted state migration
Pulled and updated from
https://github.com/hashicorp/terraform/pull/26260
2021-11-02 10:20:37 -05:00
Billy Keyes 52ca30273f
command/format: improve list nested attribute rendering (#29827)
* command/format: fix list nested attr diff rendering

Previously, diffs only rendered correctly if all changed elements
appeared before all unchanged elements. Once an unchanged element was
found, all remaining elements were skipped. This usually led to the
output being an empty list with a weird amount of space between the
brackets.

* command/format: improve list nested attr rendering

This makes several changes that make diffs for lists clearer and more
consistent:

  * Separate items with brackets instead of only new lines. This better
    matches the input syntax and avoids confusion from the first and
    last brackets implying there is a single item.
  * Render an action symbol for each element of the list
  * Use the correct action symbol for new and deleted items
  * Fix the alignment of opening and closing brackets

I also refactored the structure so it is similar to the set and map
cases to minimize duplication of the new prints.

* Fix re-use of blockBodyDiffResult struct
2021-11-02 11:13:56 -04:00
kmoe 12651c0a81
update CHANGELOG.md 2021-11-01 20:09:16 +00:00
kmoe ba4b6652fa
Merge pull request #29849 from hashicorp/kmoe/ignore_changes-override
configs: fix ignore_changes config override bug
2021-11-01 19:54:04 +00:00
James Bardin 744a231d4c update CHANGELOG.md 2021-11-01 15:43:25 -04:00
Barrett Clark 13ec9b539c
Merge pull request #29846 from hashicorp/barrettclark/parrelize-cloud-e2e-tests
cloud: Allow cloud tests to be run in parallel
2021-11-01 14:39:25 -05:00
James Bardin 834f61cd54
Merge pull request #29841 from xiaozhu36/xiaozhu
backend/oss: Supports the new attribute sts_endpoint
2021-11-01 15:31:51 -04:00
James Bardin 6183394f60
Merge pull request #29845 from hashicorp/jbardin/nullable-variable-docs
nullable variable docs
2021-11-01 15:30:33 -04:00
James Bardin 8b53637230
Update website/docs/language/values/variables.html.md
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2021-11-01 15:17:51 -04:00
James Bardin 4f88445d05
Update website/docs/language/values/variables.html.md
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2021-11-01 15:17:43 -04:00
James Bardin 2195d7a45f
Update website/docs/language/values/variables.html.md
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2021-11-01 15:17:32 -04:00
James Bardin 46bbe66cd0
Update website/docs/language/values/variables.html.md
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2021-11-01 15:17:21 -04:00
Katy Moe 8e640ae151
fix typo 2021-11-01 19:09:14 +00:00
Katy Moe 257c24ff75
IgnoreAllChanges should override during merge 2021-11-01 19:08:30 +00:00
Katy Moe df6dad5070
add failing test for IgnoreAllChanges override 2021-11-01 19:00:54 +00:00
Barrett Clark 9c13521d76 Allow cloud tests to be run in parallel
Add the `-parallel N` switch to tell the tests to run in N processes:

```
TFE_TOKEN=$TFE_TOKEN TFE_HOSTNAME=$TFE_HOSTNAME TF_ACC=1 go test -v \
  -tags=e2e ./internal/cloud/e2e/... -parallel 4
```
2021-11-01 13:58:29 -05:00
James Bardin 03ed766454 nullable doc update 2021-11-01 14:30:25 -04:00
James Bardin 6a1afd2dc3 nullable variable docs
Add `nullable` to the variable documentation.
Remove "module" from the "null means omission" part of the null type
documentation.
2021-11-01 13:25:25 -04:00
Nick Fagerlund 02e62c9851
Cloud: Init without erroring when no workspaces match the `tags` (#29835)
Previously, `terraform init` was throwing an error if you configured the cloud
block with `tags` and there weren't any tagged workspaces yet. Confusing and
alienating, since that that's a fairly normal situation! Basically TFC was
handling an empty list of workspaces worse than other backends, because it
doesn't support an unnamed default workspace.

This commit catches that condition during `Meta.selectBackend()` and asks the
user to pick a name for their first tagged workspace. If they cancel out, we
still error, but if we know what name they want, we can handle it the same way
as a nonexistent workspace specified in `name` -- just pass it to
`Meta.SetWorkspace()`, and let the workspace get implicitly created when
`InitCommand.Run()` eventually calls `StateMgr()`.
2021-11-01 10:20:15 -07:00
James Bardin 079aabb70e update CHANGELOG.md 2021-11-01 12:57:55 -04:00
James Bardin b91d9435ea
Merge pull request #29832 from hashicorp/jbardin/nullable-variable
configs: explicitly nullable variable values
2021-11-01 12:46:31 -04:00
James Bardin 6d050c166e udpate diagnostic message 2021-11-01 12:28:55 -04:00
Martin Atkins 021137454b
Update CHANGELOG.md 2021-11-01 08:52:37 -07:00
Martin Atkins 14a8668486 website: "Refactoring" documentation firmer advice about removing moved blocks
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2021-11-01 08:47:17 -07:00
Martin Atkins 86e5aacacd website: Documentation about "moved" blocks
This is documentation for the first set of refactoring-related features,
all based on the new "moved" blocks in the Terraform language.

I've named the documentation section "refactoring" because in previous
discussions with users that seems to be the term they use to describe the
underlying need.

"moved" blocks are our first language feature intended to meet that need,
although it probably won't be the last as we consider other requirements
in later releases. My intent here is that once we've published this it
should eventually end up being the first result for a web search for the
topic of Terraform refactoring.
2021-11-01 08:47:17 -07:00
Martin Atkins 94cbc8fb5d experiments: config_driven_move has concluded
Based on feedback during earlier alpha releases, we've decided to move
forward with the current design for the first phase of config-driven
refactoring.

Therefore here we've marked the experiment as concluded with no changes
to the most recent incarnation of the functionality. The other changes
here are all just updating test fixtures to no longer declare that they
are using experimental features.
2021-11-01 08:46:15 -07:00
Alisdair McDiarmid 51bf9fd19c
Merge pull request #29842 from hashicorp/alisdair/backend-remote-version-check-tweak
cloud: Fix prerelease version constraint checks
2021-11-01 11:28:25 -04:00
Alisdair McDiarmid a61bd8a96b cloud: Fix prerelease version constraint checks 2021-11-01 11:12:58 -04:00