Commit graph

32680 commits

Author SHA1 Message Date
Sebastian Rivera
015f795ff0 Rebrand Terraform Cloud to HCP Terraform 2024-04-23 16:12:59 -04:00
rita
d1f9d3b13f
Merge pull request #35033 from hashicorp/RK/fix-links
docs: Fix links and headers
2024-04-22 08:46:30 -04:00
Rose M Koron
a344e83a39
Apply suggestions from code review
Co-authored-by: rita <8647768+ritsok@users.noreply.github.com>
2024-04-19 14:54:38 -07:00
Rose
b772867a74 remove unneccessary redirect file 2024-04-19 14:31:16 -07:00
Rose
471dd391a6 Add license to redirects 2024-04-19 12:58:56 -07:00
Rose
644910d24b Fix nav 2024-04-19 12:35:23 -07:00
Martin Atkins
5868f99413 backend/gcs: Stop using legacy helper/schema
As part of our efforts to remove the large snapshot of the legacy SDK that
we've been using, this replaces the uses of that package with our new
lightweight "backendbase" package, which is a collection of helpers that
can substitute for most of the parts of the legacy SDK that backends tend
to use.

For this backend for now we'll use the "SDK like" helpers which aim to
retain some of the legacy-SDK-specific assumptions that aren't technically
true anymore, such as the idea that null and empty string are equivalent.
Hopefully one day we'll be able to wean this backend off of that more
completely, but this is a pragmatic way to get away from the legacy SDK
without a large rewrite.

This also drew attention to the fact that this backend was previously
relying on the weird context.Context value that the SDK was passing in
to the configure method, even though that context isn't connected up to
anything particularly useful. In the long run we should change the backend
APIs to pass context.Context to each method that might make network
requests, but for now we're using context.TODO so that we can more easily
find these cases and update them later once there's a real context to use.
2024-04-19 08:33:27 -07:00
Rose
9babc8a1ee Fix grammar 2024-04-19 07:02:32 -07:00
Rose
1b5966dd50 Small TFC fixes in md files 2024-04-19 06:58:43 -07:00
Rose
1fd45d83d8 Rename cloud file and add redirects 2024-04-19 06:56:11 -07:00
Rose
a0276a4e90 One more link 2024-04-19 06:56:11 -07:00
Rose
0eac58dcab Change the header names 2024-04-19 06:56:11 -07:00
Liam Cervante
2b6af4a722
Update CHANGELOG.md 2024-04-18 18:59:28 +02:00
Liam Cervante
6963c54bec
terraform test: don't remove sensitive marks from inputs (#35021) 2024-04-18 18:58:19 +02:00
Martin Atkins
30e2fd6525 Handle marks a little more consistently
In the very first implementation of "sensitive values" we were
unfortunately not disciplined about separating the idea of "marked value"
from the idea of "sensitive value" (where the latter is a subset of the
former). The first implementation just assumed that any marking whatsoever
meant "sensitive".

We later improved that by adding the marks package and the marks.Sensitive
value to standardize on the representation of "sensitive value" as being
a value marked with _that specific mark_.

However, we did not perform a thorough review of all of the mark-handling
codepaths to make sure they all agreed on that definition. In particular,
the state and plan models were both designed as if they supported arbitrary
marks but then in practice marks other than marks.Sensitive would be
handled in various inconsistent ways: dropped entirely, or interpreted as
if marks.Sensitive, and possibly do so inconsistently when a value is
used only in memory vs. round-tripped through a wire/file format.

The goal of this commit is to resolve those oddities so that there are now
two possible situations:
 - General mark handling: some codepaths genuinely handle marks
   generically, by transporting them from input value to output value in
   a way consistent with how cty itself deals with marks. This is the
   ideal case because it means we can add new marks in future and assume
   these codepaths will handle them correctly without any further
   modifications.
 - Sensitive-only mark preservation: the codepaths that interact with our
   wire protocols and file formats typically have only specialized support
   for sensitive values in particular, and lack support for any other
   marks. Those codepaths are now subject to a new rule where they must
   return an error if asked to deal with any other mark, so that if we
   introduce new marks in future we'll be forced either to define how we'll
   avoid those markings reaching the file/wire formats or extend the
   file/wire formats to support the new marks.

Some new helper functions in package marks are intended to standardize how
we deal with the "sensitive values only" situations, in the hope that
this will make it easier to keep things consistent as the codebase evolves
in future.

In practice the modules runtime only ever uses marks.Sensitive as a mark
today, so all of these checks are effectively covering "should never
happen" cases. The only other mark Terraform uses is an implementation
detail of "terraform console" and does not interact with any of the
codepaths that only support sensitive values in particular.
2024-04-18 07:32:52 -07:00
Martin Atkins
b5a4860a36 lang/marks: MarkPaths helper function
This helper is a slightly more convenient wrapper around cty's own
"MarkWithPaths" function that applies a single given mark at zero or more
paths in a given value.

In several parts of Terraform we preserve sensitive marks in particular
for serialization and cannot preserve anything else, and so this helper
is useful for reapplying the saved sensitive paths back to the stored
value during decoding.
2024-04-18 07:32:52 -07:00
Martin Atkins
2334fc867c lang/marks: PathsWithMark helper function
This helper deals with the somewhat-common situation where a particular
codepath can handle only one kind of marking, such as in our various wire
and file format serializers which have special support for serializing
sensitive value paths but cannot preserve any other marks.

The assumption here is that the caller will probably return some sort of
error if the second return value is non-empty, but we leave thec caller to
decide exactly what to do because different situations might warrant
different treatment of the problem, such as whether it's considered to be
a Terraform language authoring error or to be a bug in Terraform.
2024-04-18 07:32:52 -07:00
Martin Atkins
5e7d0f0854 go.mod: Update to latest github.com/zclconf/go-cty-debug
This extends the "CmpOptions" to include a comparer for cty.Path values,
so that we don't have to hand-write that in each case where we're
comparing data structures containing those.
2024-04-18 07:32:52 -07:00
Martin Atkins
5a944133e6 command/jsonstate: Reject unsupported marks
Our JSON state format has support for sensitive marks in particular but
lacks generalized support and so cannot deal with any other marks.

Previously it just assumed that any mark must be the sensitive mark, but
now we'll reject other marks to ensure that if any new marks are added we
must consider whether and how the JSON state format should handle them.
2024-04-18 07:32:52 -07:00
Martin Atkins
ea60ca7d70 plans/planfile: Don't use deprecated "io/ioutil" package
Everything from ioutil has been moved into other locations in modern Go.
This particular package only used ioutil.ReadAll and ioutil.ReadFile,
which have been replaced by io.ReadAll and os.ReadFile respectively.
2024-04-18 07:32:52 -07:00
Martin Atkins
6be3ddf9e7 planfile: Reject value marks that we cannot serialize
The plan file format can only preserve the "sensitive" mark, but previously
it was just silently treating any other mark as if it were the sensitive
mark.

Now we'll reject any other marks at serialization time. There are not
currently any other marks used by the modules runtime and so in practice
this cannot fail yet, but this is here to guard against misbehavior if we
introduce new marks in future without considering whether and how they
are to be serialized. (For any mark we choose not to serialize, it'll be
the caller's responsibility to replace the values using unsupported marks
with suitable unmarked placeholders.)
2024-04-18 07:32:52 -07:00
Martin Atkins
8e437daec8 states: Reject attempts to save values with non-sensitive marks
The state serialization only knows how to save and restore the
marks.Sensitive mark in particular, but previously it was just assuming
that any mark it found was sensitive without actually checking.

Now we'll return an error if we're asked to save a mark we don't support.
In practice there are no other marks currently used by the modules runtime
and so this cannot fail, but this is to help notice problems sooner if we
introduce any new marks later.
2024-04-18 07:32:52 -07:00
Craig Wright
d5907fc612
Merge pull request #35015 from lkysow/patch-1 2024-04-17 10:51:54 -07:00
UKEME BASSEY
d956ed4c42
Merge pull request #34886 from hashicorp/tf-init-json
terraform init -json
2024-04-17 13:34:46 -04:00
UKEME BASSEY
f1fb26e480 update changelog 2024-04-17 13:25:59 -04:00
UKEME BASSEY
a4415c030a making json data more useful for client consumption 2024-04-17 12:26:23 -04:00
UKEME BASSEY
7fb13b8868 fixing tests 2024-04-17 12:26:23 -04:00
UKEME BASSEY
c7bbc09631 move all command args from command/init to args/init 2024-04-17 12:26:23 -04:00
UKEME BASSEY
ce7824f905 add interrupt error to the diags so each component becomes responsible for rendering the errors 2024-04-17 12:26:23 -04:00
UKEME BASSEY
0ea25e3b40 fixing tests internal/command/init, view and argumento 2024-04-17 12:26:23 -04:00
UKEME BASSEY
ba8386b8a2 json does not support interactive prompt so dont allow setting of both -migrate-state and -json options 2024-04-17 12:26:23 -04:00
UKEME BASSEY
ea8d0869d8 convert all logs to be view type exclusive for human or json format 2024-04-17 12:26:23 -04:00
UKEME BASSEY
370a471ecb fix json -help display and failing tests 2024-04-17 12:26:23 -04:00
UKEME BASSEY
26f01d699a add test for -json support 2024-04-17 12:26:23 -04:00
UKEME BASSEY
a3f3b64e4c add -json to tf init 2024-04-17 12:26:23 -04:00
UKEME BASSEY
7709db45dc add init view test 2024-04-17 12:26:23 -04:00
UKEME BASSEY
14c53f74f2 add init view for json and human type view 2024-04-17 12:26:23 -04:00
Luke Kysow
c9fd354d68
Fix typo in docs 2024-04-17 09:24:38 -07:00
Liam Cervante
3d211eb42f
Fix crash when importing a resource with complex sensitive attributes (#34996) 2024-04-16 16:59:02 +02:00
Daniel Schmidt
f76a621de2
Merge pull request #34967 from hashicorp/TF-13960
stacks: add deferrals to PlanResourceChange
2024-04-16 14:02:17 +02:00
Daniel Schmidt
18c465d139
stacks: document planned object in test 2024-04-16 13:33:58 +02:00
Daniel Schmidt
ea9162235d
stacks: remove extra checks from mock provider 2024-04-16 10:18:48 +02:00
Daniel Schmidt
2c94390434
stacks: refactor to use fully computed change instead of minimal one for deferring in plan 2024-04-16 10:18:48 +02:00
Daniel Schmidt
eaf7eb0771
stacks: use already computed change 2024-04-16 10:18:48 +02:00
Daniel Schmidt
53cee3b2d5
stacks: use marked values for change 2024-04-16 10:18:48 +02:00
Daniel Schmidt
0289806f40
stacks: use existing unmarked values 2024-04-16 10:18:48 +02:00
Daniel Schmidt
c2fe241570
stacks: move destroy deferred handling outside of destroy method 2024-04-16 10:18:48 +02:00
Daniel Schmidt
a26fd2e81f
stacks: add deferrals to PlanResourceChange
Co-authored-by: Mutahhir Hayat <mutahhir.hayat@hashicorp.com>
2024-04-16 10:18:44 +02:00
Daniel Schmidt
32bf1fed39
stacks: test deferred changeset action 2024-04-16 10:14:15 +02:00
Daniel Schmidt
ddabb6a2ee
refactor replace path logic out of plan method 2024-04-16 10:14:15 +02:00