Commit Graph

30254 Commits

Author SHA1 Message Date
Laura Pacilio
352c55bf0b
Update website/docs/cli/commands/apply.mdx
Co-authored-by: Nick Fagerlund <nick.fagerlund@gmail.com>
2022-06-27 15:22:18 -04:00
James Bardin
799ab6c951 remove deprecated etcd backend
This allows us to remove the manual replace directives
github.com/dgrijalva/jwt-go and google.golang.org/grpc, so that we can
remove the CVE warnings and update the grpc packages.

While the etcdv3 backend is also marked as deprecated, the changes here
are done in a manner to keep that backend working for the time being.
2022-06-27 15:01:21 -04:00
Laura Pacilio
e76ad76c5b
Update README.md 2022-06-27 11:19:30 -04:00
Laura Pacilio
fd2c8fe764
Update README.md 2022-06-27 11:18:57 -04:00
Laura Pacilio
809be0b0d9
Update README.md 2022-06-27 11:18:28 -04:00
Laura Pacilio
9cb3a6a56b
Update README.md 2022-06-27 11:17:35 -04:00
Laura Pacilio
24afacdada
Update README.md 2022-06-27 11:16:53 -04:00
Laura Pacilio
24c29fa6bb
Update website/README.md 2022-06-27 11:16:30 -04:00
Laura Pacilio
5338ad82d5
Update website/README.md 2022-06-27 11:15:36 -04:00
Laura Pacilio
238fe49cb5
Update website/README.md 2022-06-27 11:15:03 -04:00
Alan Szlosek Jr
ec4935ba5d
Clarify how the ~> version constraint operator works (#31298)
* Clarify how the ~> version contraint operator works

* add comma, clarify the actor

* verbiage tweak

* language cleanup from PR review

Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>

* fix line length

Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-06-27 11:13:14 -04:00
Martin Atkins
126e493818
Update CHANGELOG.md 2022-06-23 14:01:04 -07:00
Martin Atkins
90ea7b0bc5 tfdiags: Treat unknown-related or sensitive-related messages differently
By observing the sorts of questions people ask in the community, and the
ways they ask them, we've inferred that various different people have been
confused by Terraform reporting that a value won't be known until apply
or that a value is sensitive as part of an error message when that message
doesn't actually relate to the known-ness and sensitivity of any value.

Quite reasonably, someone who sees Terraform discussing an unfamiliar
concept like unknown values can assume that it must be somehow relevant to
the problem being discussed, and so in that sense Terraform's current
error messages are giving "too much information": information that isn't
actually helpful in understanding the problem being described, and in the
worst case is a distraction from understanding the problem being described.

With that in mind then, here we introduce an explicit annotation on
diagnostic objects that are directly talking about unknown values or
sensitive values, and then the diagnostic renderer will react to that to
avoid using the terminology "known only after apply" or "sensitive" in the
generated diagnostic annotations unless we're rendering a message that is
explicitly related to one of those topics.

This ends up being a bit of a cross-cutting concern because the code that
generates these diagnostics and the code that renders them are in separate
packages and are not directly aware of each other. With that in mind, the
logic for actually deciding for a particular diagnostic whether it's
flagged in one of these special ways lives inside the tfdiags package as
an intermediation point, which both the diagnostic generator (in the core
package) and the diagnostic renderer can both depend on.
2022-06-23 13:52:23 -07:00
Martin Atkins
31aee9650e command/format: Include function call information in diagnostics
When an error occurs in a function call, the error message text often
includes references to particular parameters in the function signature.

This commit improves that reporting by also including a summary of the
full function signature as part of the diagnostic context in that case,
so a reader can see which parameter is which given that function
arguments are always assigned positionally and so the parameter names
do not appear in the caller's source code.
2022-06-23 13:52:23 -07:00
Martin Atkins
8405f46bc5 tfdiags: Expose the "extra information" concept from HCL
HCL's diagnostic model now includes the idea of "extra information" which
works by attaching an initially-opaque interface value to each diagnostic
and then asking callers to type-assert against that value to sniff for
particular interfaces in order to discover additional machine-readable
context about a certain diagnostic message.

This commit echoes that idea into our tfdiags API, for now only for
diagnostics that are backed by an hcl.Diagnostic. All other implementations
of the diagnostic interface just always return nil, which means they never
carry any "extra information".

As is typical for our wrapping abstraction, we have here also a modified
copy of HCL's helper function for conveniently probing a diagnostic for
information of a particular type, designed to work with our diagnostic
interface instead of HCL's concrete diagnostic type.
2022-06-23 13:52:23 -07:00
Martin Atkins
4927d51224 go.mod: Upgrade to HCL v2.13.0 2022-06-23 13:52:23 -07:00
ianmrose-cm
35da1618ed Add shell explanation to remote-exec inline argument documentation.
The current implementation does not use the default shell for
the ssh user to execute inline commands, which can be somewhat
confusing to debug. Provide explicit documentation to explain this,
and documentation can be removed if ssh user default shell is supported.
2022-06-23 12:30:34 -07:00
James Bardin
77e6b622f8
Merge pull request #31283 from hashicorp/jbardin/plan-import
Use plan graph for importing resources
2022-06-23 13:26:59 -04:00
James Bardin
142ce15ed6 remove unused field and extra assignment 2022-06-23 11:47:01 -04:00
Alisdair McDiarmid
a5f307b5e4
Merge pull request #31293 from dennygursky/main
Performance: string builder speedup for Module.String()
2022-06-23 10:58:35 -04:00
Alisdair McDiarmid
ad52076025 addrs: Add tests for Module.String 2022-06-23 10:42:07 -04:00
hc-github-team-tf-core
1dcfabdba9 Cleanup after v1.3.0-alpha20220622 release 2022-06-22 19:34:49 +00:00
hc-github-team-tf-core
093abf5677
Release v1.3.0-alpha20220622 2022-06-22 19:17:51 +00:00
James Bardin
c43df009db add required attr to import test
Missing required attributes should not prevent importing
2022-06-22 13:30:44 -04:00
Alisdair McDiarmid
5df6bac2f7
Merge pull request #31290 from hashicorp/alisdair/check-block-missing-condition
configs: Fix check block configuration diagnostics
2022-06-22 11:51:46 -04:00
Dennis Gursky
2c1b1f3aa1
Update module.go
making code more similar to https://github.com/hashicorp/terraform/blob/main/internal/addrs/module_instance.go
2022-06-22 06:29:57 -07:00
Denny Gursky
8a694e81ff string builder speed up for Module.String() 2022-06-21 21:49:30 -07:00
Alisdair McDiarmid
64cf53bd7e configs: Fix check block configuration diagnostics
When validating self-references for resource and data source
preconditions and postconditions, we previously did not nil-check the
block's condition field, which caused a panic when the block had no
condition.

While fixing this I noticed that we were not validating that there are
no self-references in the error message, so fixed that.
2022-06-21 12:13:45 -04:00
James Bardin
4981942191 remove -allow-missing-config from import 2022-06-21 11:43:04 -04:00
James Bardin
03fc2b09df remove errant fmt.Println 2022-06-21 11:32:07 -04:00
James Bardin
77cca0af7c remove import transformer 2022-06-20 16:11:02 -04:00
James Bardin
c002bab730 update test fixtures for better imports 2022-06-20 15:40:49 -04:00
James Bardin
e97ae28441 Combine all plan graphs, including import
Combine all plan-time graphs into a single graph builder, because
_everything is a plan_!

Convert the import graph to a plan graph. This should resolve a few edge
cases about things not being properly evaluated during import, and takes
a step towards being able to _plan_ an import.
2022-06-20 15:40:49 -04:00
Martin Atkins
fd45fb969c
Update CHANGELOG.md 2022-06-17 15:11:55 -07:00
Martin Atkins
fda0579537 Experiments supported only in alpha/dev builds
We originally introduced the idea of language experiments as a way to get
early feedback on not-yet-proven feature ideas, ideally as part of the
initial exploration of the solution space rather than only after a
solution has become relatively clear.

Unfortunately, our tradeoff of making them available in normal releases
behind an explicit opt-in in order to make it easier to participate in the
feedback process had the unintended side-effect of making it feel okay
to use experiments in production and endure the warnings they generate.
This in turn has made us reluctant to make use of the experiments feature
lest experiments become de-facto production features which we then feel
compelled to preserve even though we aren't yet ready to graduate them
to stable features.

In an attempt to tweak that compromise, here we make the availability of
experiments _at all_ a build-time flag which will not be set by default,
and therefore experiments will not be available in most release builds.

The intent (not yet implemented in this PR) is for our release process to
set this flag only when it knows it's building an alpha release or a
development snapshot not destined for release at all, which will therefore
allow us to still use the alpha releases as a vehicle for giving feedback
participants access to a feature (without needing to install a Go
toolchain) but will not encourage pretending that these features are
production-ready before they graduate from experimental.

Only language experiments have an explicit framework for dealing with them
which outlives any particular experiment, so most of the changes here are
to that generalized mechanism. However, the intent is that non-language
experiments, such as experimental CLI commands, would also in future
check Meta.AllowExperimentalFeatures and gate the use of those experiments
too, so that we can be consistent that experimental features will never
be available unless you explicitly choose to use an alpha release or
a custom build from source code.

Since there are already some experiments active at the time of this commit
which were not previously subject to this restriction, we'll pragmatically
leave those as exceptions that will remain generally available for now,
and so this new approach will apply only to new experiments started in the
future. Once those experiments have all concluded, we will be left with
no more exceptions unless we explicitly choose to make an exception for
some reason we've not imagined yet.

It's important that we be able to write tests that rely on experiments
either being available or not being available, so here we're using our
typical approach of making "package main" deal with the global setting
that applies to Terraform CLI executables while making the layers below
all support fine-grain selection of this behavior so that tests with
different needs can run concurrently without trampling on one another.

As a compromise, the integration tests in the terraform package will
run with experiments enabled _by default_ since we commonly need to
exercise experiments in those tests, but they can selectively opt-out
if they need to by overriding the loader setting back to false again.
2022-06-17 14:46:07 -07:00
Alisdair McDiarmid
479c71f93d
Merge pull request #31210 from hashicorp/update-optional-type-attributes
Edit type constraints docs for style and flow
2022-06-17 15:47:57 -04:00
Alisdair McDiarmid
0f39ead096
Merge pull request #31263 from hashicorp/alisdair/backend-remote-locks-helper-lockerror-test
states/remote: Check for LockError error type
2022-06-17 11:58:03 -04:00
Alisdair McDiarmid
31758c3661
Update CHANGELOG.md 2022-06-17 11:57:12 -04:00
Alisdair McDiarmid
c7bc82bd87
Merge pull request #31235 from hashicorp/alisdair/json-plan-unknown-outputs
json-output: Extended detail for unknown outputs
2022-06-17 11:50:21 -04:00
Alisdair McDiarmid
7fcf9734ef
Merge pull request #31236 from hashicorp/alisdair/json-plan-fix-tuple-set-unknown
json-output: Fix unknowns for tuples and sets
2022-06-17 11:48:00 -04:00
Alisdair McDiarmid
8db2552b5f
Remove experiment from optional attrs example 2022-06-17 11:38:12 -04:00
Alisdair McDiarmid
d2087fa98b states/remote: Check for LockError error type
When attempting to lock a remote state backend, failure due to an
existing lock should return an instance of LockError. This allows the
wrapping code to retry until the specified timeout, instead of
immediately exiting.

This commit adds a test for this in the TestRemoteLocks test helper,
which is used in many of the remote state backend test suites.
2022-06-17 10:51:00 -04:00
Alisdair McDiarmid
b0b69d3fad
Merge pull request #31256 from nvanheuverzwijn/vanheu/http-patch
http-backend: http backend lock error return LockError instead of generic error
2022-06-17 10:48:57 -04:00
Laura Pacilio
a864bf6b9e
Merge pull request #31105 from nvanthao/nvanthao/update-docs-implicit-provider
Add link to default provider configuration definition
2022-06-17 09:08:11 -04:00
Dirk Leser
ab93ef09ec
Readded the new example below the description 2022-06-17 14:42:52 +02:00
Dirk Leser
37d18f4229
functions/merge: Added expanation for example
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-06-17 14:32:02 +02:00
Laura Pacilio
66f6bb50ac
Merge pull request #30275 from Mukesh05/patch-1
Update purpose.mdx
2022-06-16 13:34:46 -04:00
Nicolas Vanheuverzwijn
bb1c134b94 http-backend: http backend lock error return LockError instead of generic error 2022-06-16 11:01:01 -04:00
Martin Atkins
dc5964f8a3 refactoring: Use addrs.Map for maps with addresses as keys
We introduced the addrs.UniqueKey and addrs.UniqueKeyer mechanics as part
of implementing the ValidateMoves and ApplyMoves functions, as a way to
better encapsulate the solution to the problem that lots of our address
types aren't comparable and so cannot be used directly as map keys.

However, exposing addrs.UniqueKey handling directly in the logic adds
various noise to the algorithms and, in particular, obscures the fact that
MoveResults.Changes and MoveResult.Blocked both have different map key
types.

Here then we'll use the new addrs.Map helper type, which encapsulates the
idea of a map from an addrs.UniqueKeyer type to an arbitrary value type,
using the unique keys as the map keys internally. This does unfortunately
mean that we lose the conventional Go map access syntax and have to use
a method-based API instead, but I (subjectively) think that's an okay
compromise in return for avoiding the need to keep track inline of which
addrs.UniqueKey values correspond with which real addresses.

This is intended as an entirely-mechanical change, with equivalent
behavior to what it replaced. If anything here is doing something
materially different than what it replaced then that's a mistake.
2022-06-16 07:03:36 -07:00
Martin Atkins
eb2374070f addrs: Generic types for maps and sets of addresses
The addrs.Set type previously snuck in accidentally as part of the work
to add addrs.UniqueKey and addrs.UniqueKeyer, because without support for
generic types the addrs.Set type was a bit of a safety hazard due to not
being able to enforce particular address types at compile time.

However, with Go 1.18 adding support for type parameters we can now turn
addrs.Set into a generic type over any specific addrs.UniqueKeyer type,
and complement it with an addrs.Map type which supports addrs.UniqueKeyer
keys as a way to encapsulate the handling of maps with UniqueKey keys that
we currently do inline in various other parts of Terraform.

This doesn't yet introduce any callers of these types, but we'll convert
existing users of addrs.UniqueKeyer gradually in subsequent commits.
2022-06-16 07:03:36 -07:00