Commit Graph

30112 Commits

Author SHA1 Message Date
Liam Cervante
d876e68e2d
Fail global required_version check if it contains any prerelease fields (#31331)
* Fail global required_version check if it contains any prerelease fields

* go mod tidy

* Improve required_version prerelease not supported error string

* Add prerelease version constraint unit tests

* Fix side-effects by populating global diags too soon
2022-06-30 09:58:28 +01:00
James Bardin
73c4a4c3b0
Merge pull request #31326 from hashicorp/jbardin/remove-etcd-backend
remove unmaintained etcd backend to update grpc packages
2022-06-29 16:57:27 -04:00
Laura Pacilio
f83c8e1d18
Merge pull request #31011 from dleser/patch-1
Added example with function argument expansion
2022-06-28 16:50:09 -04:00
James Bardin
953c448f9a add simple error indicating backend removal
There are no good options for inserting diagnostics into the backend
lookup, or creating a backend which reports it's removal because none of
the init or GetSchema functions return any errors.

Keep a registry of the removed backend so that we can at least notify
users that a backend was removed vs an invalid name.
2022-06-28 13:58:22 -04:00
Laura Pacilio
d175076e76
Merge pull request #29865 from hashicorp/laura-update-docs-readme
Update READMEs to help folks figure out how to successfully make docs
2022-06-27 15:48:11 -04:00
Laura Pacilio
4153dac8df
Update README.md
Co-authored-by: Kevin Wang <kwangsan@gmail.com>
2022-06-27 15:40:37 -04:00
Laura Pacilio
5cb3dc9447
Merge pull request #31197 from hashicorp/update-plan-page
Update apply page for style, concision, and clarity
2022-06-27 15:40:11 -04:00
Laura Pacilio
997c851671
Update website/docs/cli/commands/apply.mdx
Co-authored-by: Nick Fagerlund <nick.fagerlund@gmail.com>
2022-06-27 15:22:53 -04:00
Laura Pacilio
af9c53e3ad
Update website/docs/cli/commands/apply.mdx
Co-authored-by: Nick Fagerlund <nick.fagerlund@gmail.com>
2022-06-27 15:22:36 -04:00
Laura Pacilio
08a14994d1
Update website/docs/cli/commands/apply.mdx
Co-authored-by: Nick Fagerlund <nick.fagerlund@gmail.com>
2022-06-27 15:22:26 -04:00
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
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