Commit Graph

29970 Commits

Author SHA1 Message Date
Alisdair McDiarmid
650380f3ae configs: Add default argument to optional()
The optional modifier previously accepted a single argument: the
attribute type. This commit adds an optional second argument, which
specifies a default value for the attribute.

To record the default values for a variable's type, we use a separate
parallel structure of `typeexpr.Defaults`, rather than extending
`cty.Type` to include a `cty.Value` of defaults (which may in turn
include a `cty.Type` with defaults, and so on, and so forth).

The new `typeexpr.TypeConstraintWithDefaults` returns a type constraint
and defaults value. Defaults will be `nil` unless there are default
values specified somewhere in the variable's type.
2022-05-31 12:11:15 -04:00
Alisdair McDiarmid
8f69e36e1b typeexpr: Add support for nested type defaults
In type constraints, object attributes may be marked as optional in
order to allow them to be omitted from input values. Doing so results in
filling the attribute value with a typed `null`.

This commit adds a new type `typeexpr.Defaults` which mirrors the
structure of a type constraint, storing default values for optional
attributes. This will allow specification of non-`null` default values
for attributes.

The `Defaults` type is a tree structure, each node containing a sub-tree
type, a map of children, and for object nodes, a map of defaults. The
keys in the children map depend on the type of the node:

- Object nodes have children for each attribute;
- Tuple nodes have children for each index, with indices converted to
  string values;
- Collection nodes have a single child at the empty string key.

When traversing this tree we must take this structure into account, with
special cases for map input values which may later be converted to
objects.

The traversal defined in this commit uses a pre-order transformer in
order to pre-populate descendent nodes before their defaults are
applied. This allows type nested type default values to be specified
more compactly.
2022-05-31 12:11:15 -04:00
Piggy
367a850989
Bump github.com/Netflix/go-expect (#31103) 2022-05-31 16:24:01 +01:00
kmoe
8f7e03b95b
deps: upgrade mitchellh/cli (#31160) 2022-05-31 16:12:56 +01:00
kmoe
54b837416c
command: mention plan options in refresh help text (#30892)
* command: add parallelism option to refresh help text
2022-05-31 14:27:21 +01:00
Alisdair McDiarmid
a6587970d0
Merge pull request #30552 from gbataille/29156_do_not_log_sensitive_values
Fixes #29156: Failing sensitive variables values are not logged
2022-05-30 10:40:51 -04:00
Alisdair McDiarmid
06f6a901ea
Merge pull request #30985 from hashicorp/alisdair/var-flag-spaces-error
cli: Improved error for invalid -var "foo = bar"
2022-05-30 10:40:00 -04:00
Nick Fagerlund
5bf48952fe
Edit docs for replace_triggered_by lifecycle argument (#31129)
- Note that it was added in v1.2, so users know whether they can use it yet.
- Fix nested indentation formatting, so the parent list item stays together.
- Minor copy edits.
- List all of the available lifecycle block arguments before diving into the
  docs for each argument, for ease of reading/scanning.
2022-05-26 10:39:04 -07:00
James Bardin
903ba7e94e
Merge pull request #31124 from hashicorp/jbardin/go-getter-update
update go-getter
2022-05-25 10:37:57 -04:00
James Bardin
f24eb858c8 update go-getter 2022-05-25 09:19:46 -04:00
Craig Wright
f215e6fc3e
Merge pull request #31121 from cuotos/fix-intentional-typo
Revert "Docs: Change misspelling of variable in documentation"
2022-05-24 11:33:25 -07:00
Dan Potepa
2dd5e10469 Revert "Docs: Change misspelling of variable in documentation"
This reverts commit 7756023564.
2022-05-24 17:54:31 +01:00
James Bardin
2ad3ac7d01
Merge pull request #31111 from hashicorp/jbardin/unknown-error-paths
add unknown paths to diags for debugging
2022-05-24 10:37:50 -04:00
Martin Atkins
284a38a04c build: Accept version numbers with prereleases containing dashes
Previously we'd discard everything after the second dash.
2022-05-23 16:48:34 -07:00
Martin Atkins
096f0dc0da build: Write the detected version number into the generated executable
This also sets an additional variable if it detects that this is an alpha
or development build, which currently does nothing but might eventually
turn on the ability to use experimental features, if we make that
something available only in prereleases.
2022-05-23 16:48:34 -07:00
Martin Atkins
7dd3cdfab4 build: Fetch all tags before deciding which version we're building
The actions/checkout workflow does some heroics to try to fetch exactly
the commit being built and nothing else, even if asked to fetch the
history leading up to that commit. That means we don't end up having
enough information to get an accurate answer from "git describe".

Since we're intentionally relying on the git history here, we'll fetch
all of the tags explicitly after initial checkout. Although that does add
some delay to this step, we're intentionally doing this version
calculation only once as a separate workflow job so that all of the other
jobs can still benefit from this action's quicker checkout behavior.
2022-05-23 16:48:34 -07:00
Laura Pacilio
5740659ad1
Merge pull request #31100 from hashicorp/add-version-notes-1.2
Add version notes 1.2
2022-05-23 15:00:39 -04:00
James Bardin
a6968b5b20
Merge pull request #31060 from hashicorp/alisdair/fix-configload-snapshot-panic
configs: Fix module loader nil pointer panic
2022-05-23 13:56:33 -04:00
James Bardin
48309835b7 add unknown paths to diags for debugging
When a user reports a "Configuration contains unknown value" error,
there is no information on what might have been unknown during apply.
Add unknown attribute paths to the diagnostic message to provide some
more information when a reproduction may not be possible. Sine this is
one of those "should never happen" types of errors which will be
reported to the developers directly, we can leave the format as the raw
internal representation for simplicity.
2022-05-23 13:28:30 -04:00
Craig Wright
8e84674fa6
Update CHANGELOG.md
Changelog for #29354
2022-05-20 15:02:15 -07:00
Laura Pacilio
83a700b313 Update version notes for custom conditions 2022-05-20 16:10:26 -04:00
Laura Pacilio
b2d3e594ca Remove duplicate versioning note for custom condition checks. 2022-05-20 16:07:27 -04:00
Laura Pacilio
f7c5d1b054 Add version note for env var credentials 1.2 work. 2022-05-20 16:04:37 -04:00
Laura Pacilio
54d084159f Add version note, fix typos, add link to environment variables 2022-05-20 16:00:53 -04:00
Martin Atkins
ec421fe02d configs: A test for the regression reported in #31081
5417975946 addressed a regression in the
logic for catching when the newer module meta-arguments are used in
conjunction with the legacy practice of including provider configurations
inside modules, where the check started incorrectly catching situations
where the legacy nested provider configuration was in the same module
as the child call using one of those meta-arguments.

This is a regression test to catch if a similar bug arises in the future.

Since it's testing validation rules that apply to an entire configuration
tree, it ended up in a rather idiosyncratic location under the "configload"
package, rather than directly in "configs". The "configs" package only
knows how to load one module at a time, so it's harder to write a test
like this in that context. Due to it being further removed from the code
it is testing, I included a test for the correct error too in order to
increase the chance that we'll learn if future changes in the "configs"
package invalidate this regression test.

I've verified that this new test fails without the change made in the
earlier commit.
2022-05-20 11:24:31 -07:00
Craig Wright
be7f46a1ad
Merge pull request #29354 from srdecny/main
Fix CLI help text for output. Reviewed with @apparentlymart and @kmoe.
2022-05-20 10:58:09 -07:00
James Bardin
94f68a2097
Merge pull request #31092 from nilsding/update-the-non-blockchain-kind-of-crypto
update golang.org/x/crypto again
2022-05-20 13:09:52 -04:00
kmoe
5417975946
configs: fix module for_each call bug (#31091)
This fixes a bug introduced in 1879a39 in which initialising a module will fail
if that module contains both a provider block and a module call using for_each.
2022-05-20 16:58:46 +01:00
Georg Gadinger
590a91a40f update golang.org/x/crypto again
The version that was in use previously broke my runs with a nice `ssh:
handshake failed: agent unsupported algorithm "ssh-ed25519"` error.  I
took a further look into this, and saw that the change that broke ssh
for me was fixed in https://github.com/golang/crypto/commit/46612604a.
Yay!
2022-05-20 15:25:42 +02:00
Laura Pacilio
55edc6a6af
Merge pull request #31049 from miyagawa-michiru/update-local-exec-arguments
`local-exec` documentation lacks on-destroy documentation
2022-05-19 11:02:38 -04:00
miyagawa-michiru
61271ef117 Add a missing word 2022-05-19 08:05:34 +09:00
James Bardin
f7f4a82619
Merge pull request #31063 from hashicorp/jbardin/v1.2-upgrade-guide
v1.2 upgrade guide
2022-05-18 13:59:39 -04:00
Laura Pacilio
cb181e96d0
Merge pull request #31071 from hashicorp/add-tutorial-custom-conditions
Add learn tutorial link
2022-05-18 13:50:02 -04:00
Laura Pacilio
179e108cd1
Update website/docs/language/expressions/custom-conditions.mdx 2022-05-18 13:49:44 -04:00
James Bardin
1a60b3b5be s/obsolete/outdated/ 2022-05-18 13:49:38 -04:00
James Bardin
975158a552
Update website/docs/language/upgrade-guides/1-2.mdx
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-05-18 13:48:32 -04:00
James Bardin
43c78af1c0
Update website/docs/language/upgrade-guides/1-2.mdx
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-05-18 13:48:08 -04:00
James Bardin
0855561db0 group obsolete TLS features in upgrade guide 2022-05-18 13:05:36 -04:00
James Bardin
6e70577a87 re-order upgrade sections 2022-05-18 12:46:12 -04:00
James Bardin
7566ab7c93
Update website/docs/language/upgrade-guides/1-2.mdx
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-05-18 12:45:25 -04:00
James Bardin
3633de8bf5
Update website/docs/language/upgrade-guides/1-2.mdx
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-05-18 12:41:51 -04:00
James Bardin
8166216ba6
Update website/docs/language/upgrade-guides/1-2.mdx
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-05-18 12:41:44 -04:00
James Bardin
24663fbf26
Update website/docs/language/upgrade-guides/1-2.mdx
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-05-18 12:41:39 -04:00
James Bardin
63cd25531f
Update website/docs/language/upgrade-guides/1-2.mdx
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-05-18 12:41:27 -04:00
James Bardin
c658f85552
Update website/docs/language/upgrade-guides/1-2.mdx
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-05-18 12:41:18 -04:00
James Bardin
6cb8e8bbad
Update website/docs/language/upgrade-guides/1-2.mdx
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-05-18 12:40:52 -04:00
James Bardin
0dc7a1fa63
Update website/docs/language/upgrade-guides/1-2.mdx
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-05-18 12:40:43 -04:00
James Bardin
694fb75679
Update website/docs/language/upgrade-guides/1-2.mdx
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-05-18 12:40:12 -04:00
James Bardin
d07621944f
Update website/docs/language/upgrade-guides/1-2.mdx
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-05-18 12:39:49 -04:00
James Bardin
797e592416
Update website/docs/language/upgrade-guides/1-2.mdx
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-05-18 12:39:16 -04:00