Commit Graph

28580 Commits

Author SHA1 Message Date
Martin Atkins
708003b035 configs: For Moved blocks, use addrs.MoveEndpoint instead of addrs.Target
Although addrs.Target can in principle capture the information we need to
represent move endpoints, it's semantically confusing because
addrs.Targetable uses addrs.Abs... types which are typically for absolute
addresses, but we were using them for relative addresses here.

We now have specialized address types for representing moves and probably
other things which have similar requirements later on. These types
largely communicate the same information in the end, but aim to do so in
a way that's explicit about which addresses are relative and which are
absolute, to make it less likely that we'd inadvertently misuse these
addresses.
2021-07-01 08:28:02 -07:00
Martin Atkins
4cbe6cabfc addrs: AbsMoveable, ConfigMoveable, and MoveableEndpoint
These three types represent the three different address representations we
need to represent different stages of analysis for "moved" blocks in the
configuration.

The goal here is to encapsulate all of the static address wrangling inside
these types so that users of these types elsewhere would have to work
pretty hard to use them incorrectly.

In particular, the MovableEndpoint type intentionally fully encapsulates
the weird relative addresses we use in configuration so that code
elsewhere in Terraform can never end up holding an address of a type that
suggests absolute when it's actually relative. That situation only occurs
in the internals of MoveableEndpoint where we use not-really-absolute
AbsMoveable address types to represent the not-yet-resolved relative
addresses.

This only takes care of the static address wrangling. There's lots of
other rules for what makes a "moved" block valid which will need to be
checked elsewhere because they require more context than just the content
of the address itself.
2021-07-01 08:28:02 -07:00
Martin Atkins
3212f6f367 addrs: AbsModuleCall type
Our documentation for ModuleCall originally asserted that we didn't need
AbsModuleCall because ModuleInstance captured the same information, but
when we added count and for_each for modules we introduced
ModuleCallInstance to represent a reference to an instance of a local
module call, and now _that_ is the type whose absolute equivalent is
ModuleInstance.

We previously had no absolute representation of the call itself, without
any particular instance. That's what AbsModuleCall now represents,
allowing us to be explicit about when we're talking about the module block
vs. instances it declares, which is the same distinction represented by
AbsResource vs. AbsResourceInstance.

Just like with AbsResource and AbsResourceInstance though, there is
syntactic ambiguity between a no-key call instance and a whole module call,
and so some codepaths might accept both to start and then use other
context to dynamically choose a particular interpretation, in which case
this distinction becomes meaningful in representing the result of that
decision.
2021-07-01 08:28:02 -07:00
Martin Atkins
ab350289ab addrs: Rename AbsModuleCallOutput to ModuleCallInstanceOutput
The previous name didn't fit with the naming scheme for addrs types:
The "Abs" prefix typically means that it's an addrs.ModuleInstance
combined with whatever type name appears after "Abs", but this is instead
a ModuleCallOutput combined with an InstanceKey, albeit structured the
other way around for convenience, and so the expected name for this would
be the suffix "Instance".

We don't have an "Abs" type corresponding with this one because it would
represent no additional information than AbsOutputValue.
2021-07-01 08:28:02 -07:00
Laura Pacilio
e6f1255869 Update vs Cloudformation description 2021-07-01 11:07:23 -04:00
Laura Pacilio
ab9b9a445f Update vs pages to address PR comments 2021-07-01 11:01:21 -04:00
Laura Pacilio
09c79994f5 Update use cases page for PR comments 2021-07-01 10:43:24 -04:00
Laura Pacilio
04385bb9fc
Update website/intro/use-cases.html.markdown
Co-authored-by: Judith Malnick <judith.patudith@gmail.com>
2021-07-01 10:39:15 -04:00
Laura Pacilio
a9e09a3ed9 Edit copy to address PR comments 2021-07-01 10:34:41 -04:00
Sam Salisbury
2fdf898680
Merge pull request #29064 from hashicorp/darwin-arm64
Build darwin/arm64 (RELENG-650)
2021-07-01 15:29:36 +01:00
Alisdair McDiarmid
32210db0ab documentation: Add drift to machine readable UI 2021-06-30 15:00:43 -04:00
Alisdair McDiarmid
71a067242d json-output: Add resource drift to machine readable UI 2021-06-30 14:57:55 -04:00
hc-github-team-tf-core
f2d1817a57 Cleanup after v1.1.0-alpha20210630 release 2021-06-30 16:07:59 +00:00
hc-github-team-tf-core
e291ace3eb
Release v1.1.0-alpha20210630 2021-06-30 15:52:11 +00:00
Laura Pacilio
a8d949a590 Add compatibility promises to sidebar toc 2021-06-30 10:10:25 -04:00
Laura Pacilio
577c3653f2
Merge pull request #28983 from KurtLehnardt/patch-1
fixed typo
2021-06-30 08:54:04 -04:00
Laura Pacilio
a7e24c384b
Merge pull request #28842 from iaoiui/patch-1
remove extra "be"
2021-06-30 08:52:51 -04:00
Laura Pacilio
f9ec36383d
Merge pull request #29011 from vlad-ro/patch-1
Add back missing closing quote character
2021-06-30 08:51:47 -04:00
Laura Pacilio
4f12b8d917
Merge pull request #28863 from stensonb/patch-1
typo
2021-06-30 08:50:24 -04:00
Laura Pacilio
f200c5d0ef
Merge pull request #29032 from hashicorp/izaaklauer/typo
Small comment typo
2021-06-30 08:44:11 -04:00
Laura Pacilio
de97a03528
Merge pull request #28908 from kondr57/patch-1
fix typo
2021-06-30 08:43:26 -04:00
Sam Salisbury
e17abccf2e ci: add darwin/arm64 to workflow 2021-06-30 12:45:53 +01:00
Sam Salisbury
2337334b1f ci: add darwin/arm64 build 2021-06-30 12:44:46 +01:00
Kristin Laemmert
35c19d7c9f
command/jsonstate: remove redundant remarking of resource instance (#29049)
* command/jsonstate: remove redundant remarking of resource instance

ResourceInstanceObjectSrc.Decode already handles marking values with any marks stored in ri.Current.AttrSensitivePaths, so re-applying those marks is not necessary.

We've gotten reports of panics coming from this line of code, though I have yet to reproduce the panic in a test.

* Implement test to reproduce panic on #29042

Co-authored-by: David Alger <davidmalger@gmail.com>
2021-06-29 10:59:20 -04:00
Laura Pacilio
a2cab95dac
Update copy for active voice and concision 2021-06-29 09:15:01 -04:00
Laura Pacilio
740343cfd2
Update website/intro/use-cases.html.markdown
Co-authored-by: Tu Nguyen <im2nguyen@users.noreply.github.com>
2021-06-29 09:02:02 -04:00
Laura Pacilio
2cb8bbaacd
Update website/intro/use-cases.html.markdown
Co-authored-by: Tu Nguyen <im2nguyen@users.noreply.github.com>
2021-06-29 09:01:25 -04:00
Laura Pacilio
16bea6a949
Update website/intro/use-cases.html.markdown
Co-authored-by: Tu Nguyen <im2nguyen@users.noreply.github.com>
2021-06-29 09:01:13 -04:00
Laura Pacilio
7cb7d641b7
Remove top header and add provider language 2021-06-29 08:56:04 -04:00
Laura Pacilio
46708ea4bc
Update website/intro/vs/chef-puppet.html.markdown
Co-authored-by: Tu Nguyen <im2nguyen@users.noreply.github.com>
2021-06-29 08:44:53 -04:00
Laura Pacilio
f526e6eadc Update page description metadata 2021-06-28 17:14:34 -04:00
Laura Pacilio
5e89ac590e Update page description metadata 2021-06-28 17:10:11 -04:00
Laura Pacilio
908ceec8c1 Update page description metadata 2021-06-28 17:06:50 -04:00
Laura Pacilio
fc772aec86 Update page content for clarity, concision, and flow 2021-06-28 17:03:30 -04:00
Laura Pacilio
2f67c78821 Update page description metadata 2021-06-28 16:50:37 -04:00
Laura Pacilio
4111b1298d Update page description metadata 2021-06-28 16:47:37 -04:00
Martin Atkins
512e4e7f13
Update CHANGELOG.md 2021-06-28 13:44:24 -07:00
Martin Atkins
70bc432f85 command/views/json: Never generate invalid diagnostic snippet offsets
Because our snippet generator is trying to select whole lines to include
in the snippet, it has some edge cases for odd situations where the
relevant source range starts or ends directly at a newline, which were
previously causing this logic to return out-of-bounds offsets into the
code snippet string.

Although arguably it'd be better for the original diagnostics to report
more reasonable source ranges, it's better for us to report a
slightly-inaccurate snippet than to crash altogether, and so we'll extend
our existing range checks to check both bounds of the string and thus
avoid downstreams having to deal with out-of-bounds indices.

For completeness here I also added some similar logic to the
human-oriented diagnostic formatter, which consumes the result of the
JSON diagnostic builder. That's not really needed with the additional
checks in the JSON diagnostic builder, but it's nice to reinforce that
this code can't panic (in this way, at least) even if its input isn't
valid.
2021-06-28 13:42:28 -07:00
Laura Pacilio
5344ba0fa5 Update page description metadata 2021-06-28 16:00:16 -04:00
Laura Pacilio
0ab2012d77 Update page description metadata 2021-06-28 15:59:36 -04:00
Laura Pacilio
e92f030662 Make get started bullet more concise 2021-06-28 11:38:21 -04:00
Laura Pacilio
60f240f8cf Update description and edit for concision and clarity 2021-06-28 11:33:06 -04:00
James Bardin
c687ebeaf1
Merge pull request #29039 from hashicorp/jbardin/sensitive
New marks.Sensitive type, and audit of sensitive marks usage
2021-06-25 17:11:59 -04:00
James Bardin
80ef795cbf add marks.Raw 2021-06-25 14:27:43 -04:00
James Bardin
55ebb2708c remove IsMarked and ContainsMarked calls
Make sure sensitivity checks are looking for specific marks rather than
any marks at all.
2021-06-25 14:17:06 -04:00
James Bardin
cdf7469efd marks.Has and marks.Contains 2021-06-25 14:17:03 -04:00
James Bardin
d9dfd451ea update to use typed sensitive marks 2021-06-25 12:49:07 -04:00
James Bardin
2c493e38c7 marks package
marks.Sensitive
2021-06-25 12:35:51 -04:00
Kristin Laemmert
051c5c9d50
Update CHANGELOG.md 2021-06-25 08:53:29 -04:00
Kristin Laemmert
096010600d
terraform: use hcl.MergeBodies instead of configs.MergeBodies for pro… (#29000)
* terraform: use hcl.MergeBodies instead of configs.MergeBodies for provider configuration

Previously, Terraform would return an error if the user supplied provider configuration via interactive input iff the configuration provided on the command line was missing any required attributes - even if those attributes were already set in config.

That error came from configs.MergeBody, which was designed for overriding valid configuration. It expects that the first ("base") body has all required attributes. However in the case of interactive input for provider configuration, it is perfectly valid if either or both bodies are missing required attributes, as long as the final body has all required attributes. hcl.MergeBodies works very similarly to configs.MergeBodies, with a key difference being that it only checks that all required attributes are present after the two bodies are merged.

I've updated the existing test to use interactive input vars and a schema with all required attributes. This test failed before switching from configs.MergeBodies to hcl.MergeBodies.

* add a command package test that shows that we can still have providers with dynamic configuration + required + interactive input merging

This test failed when buildProviderConfig still used configs.MergeBodies instead of hcl.MergeBodies
2021-06-25 08:48:47 -04:00