Commit Graph

31234 Commits

Author SHA1 Message Date
Martin Atkins
9e6cc4ae6f go.mod: go get google.golang.org/grpc@v1.53.0
This is to upgrade past the vulnerability described here:
    https://github.com/advisories/GHSA-cfgp-2977-2fmm

Terraform does not seem to be significantly affected by it since our use
is primarily between Terraform Core and provider plugins where at worst
a provider could just make its own connection to Terraform malfunction.
However, this also appears to be a relatively low-risk upgrade.

This does force upgrading some of the Google Cloud Platform dependencies,
which the "gcs" (Google Cloud Storage) backend depends on, so there is
some minor risk to that backend but the upstream changes to those
dependencies do not seem to be significant.
2023-07-06 13:14:07 -07:00
James Bardin
6be6f69d61
Merge pull request #33482 from hashicorp/jbardin/schema-cache
Refactor providers.Schemas and add a global schema cache
2023-07-06 16:06:32 -04:00
James Bardin
a77baa866d additional schema handling comment 2023-07-06 15:53:08 -04:00
kmoe
d1a5dfa1ad
command: test plan -refresh= arg ordering (#33483)
* main: disambiguate arg ordering test

Make it extra clear what order of args we are asserting.

* command: fix plan -refresh=false test

The test for plan -refresh=false was not functioning, since ReadResource will not be called if the resource is not in prior state.

Add a new fixture directory with state, and also test the converse, to prevent regression.

* command: add test for refresh flag precedence

A consumer relies on the fact that running terraform plan -refresh=false -refresh true gives the same result as terraform plan -refresh=true.
2023-07-06 19:28:09 +01:00
James Bardin
76332db98d fix locking and race in test mocks 2023-07-06 11:46:17 -04:00
James Bardin
b9d8d99b04 remove fixed FIXME 2023-07-06 10:56:03 -04:00
James Bardin
68d86e81fb disable cache for now 2023-07-06 10:45:57 -04:00
James Bardin
cf5ebaf685 s/Schemas/ProviderSchema/ 2023-07-06 10:37:35 -04:00
James Bardin
36d34135ad replace remaining types in tests 2023-07-06 10:37:35 -04:00
James Bardin
4e8dd5866c update schemas type 2023-07-06 10:37:35 -04:00
James Bardin
d487ce20e1 update jsonprovider to use new schema type 2023-07-06 10:37:35 -04:00
James Bardin
ec3a38e5ed update providers.Schemas type
Use the global providers.SchemaCache and update all schema access to the
providers.Schemas, except where the provider.GetProviderSchemaResponse
type name would be expected.

Some tests that reuse provider factories needed a little more careful
handling. Change the fixed func to only reset the provider on the first
call.
2023-07-06 10:37:35 -04:00
James Bardin
9d9746560f use the same struct for all schema access
Unify the struct used for Schemes and GetProviderSchemaResponse so that
we can have a single cache which handles all schema access.
2023-07-06 10:37:35 -04:00
James Bardin
53901a7e62 Add basic global schema cache
Add a single global schema cache for providers. This allows multiple
provider instances to share a single copy of the schema, and prevents
loading the schema multiple times for a given provider type during a
single command.

This does not currently work with some provider releases, which are
using GetProviderSchema to trigger certain initializations. A new server
capability will be introduced to trigger reloading their schemas, but
not store duplicate results.
2023-07-06 10:37:35 -04:00
James Bardin
d199d427a1 remove unused factory functions 2023-07-06 10:37:35 -04:00
Liam Cervante
ea162f6ab5
[testing framework] prepare for beta phase of development (#33445) 2023-07-06 15:53:18 +02:00
Liam Cervante
3613e972c5
Plan renderer: Support users indexing integer paths with stringified numbers (#33475) 2023-07-05 11:11:02 +02:00
Alisdair McDiarmid
ad2298b114
Merge pull request #33108 from unRob/patch-1
Return debuggable CAS errors on consul state put
2023-06-30 09:50:11 -04:00
rita
76290e897e
Merge pull request #33441 from ctrombley/docs/checks-for-continuous-validation
docs: dissociate CV from preconditions and postconditions
2023-06-29 07:49:25 -07:00
Chris Trombley
6d817660eb docs: dissociate CV from preconditions and postconditions 2023-06-28 16:40:49 -07:00
James Bardin
f2b34c5f95 update CHANGELOG.md 2023-06-28 14:02:11 -04:00
James Bardin
3fcf16f0a1
Merge pull request #33403 from hashicorp/jbardin/deps-with-no-instances
connect references from config nodes during apply
2023-06-28 14:00:10 -04:00
James Bardin
bb0bb7af1a remove NodeApplyableResource
Move the logic for NodeApplyableResource into
nodeExpandApplyableResource to remove an unnecessary level of expansion.
2023-06-28 13:32:00 -04:00
James Bardin
5c9d7a810d connect references from config nodes during apply
In order to ensure that transitive dependencies are connected even when
there are no instances for a resource, we need to route the references
through the config ("expand") node. This happens naturally by having the
expand node report its config references, however legacy configs can
contain self-referenced without the "self" identifier, so those need to
be filtered out.
2023-06-28 13:31:58 -04:00
Liam Cervante
2eb99a0e44
Fix the Terraform build after recent merges (#33436) 2023-06-28 10:12:43 +02:00
Liam Cervante
212ae6c4ba
Introduce separate testing scope for reference validation (#33339) 2023-06-28 09:47:24 +02:00
Liam Cervante
dfc26c2ac4
[Testing Framework] Add test command to Terraform CLI (#33327)
* Add test structure to views package for rendering test output

* Add test file HCL configuration and parser functionality

* Adds a TestContext structure for evaluating assertions against the state and plan

* Add test command to Terraform CLI
2023-06-28 09:37:42 +02:00
Liam Cervante
ed822559e5
[Testing framework] Implement JSON view functionality for test command (#33400) 2023-06-28 09:30:29 +02:00
kmoe
fbff64ad45
configs: remove import block duplicate id check (#33434) 2023-06-27 19:25:36 +01:00
Roberto Hidalgo
8e5a66b2f5
use multierror.Append instead of append
Co-authored-by: Chris Thain <32781396+cthain@users.noreply.github.com>
2023-06-26 13:02:58 -04:00
Liam Cervante
3732bffe13
[Testing Framework] Adds TestContext for evaluating test assertions (#33326)
* Add test structure to views package for rendering test output

* Add test file HCL configuration and parser functionality

* Adds a TestContext structure for evaluating assertions against the state and plan
2023-06-26 17:42:53 +02:00
Roberto Hidalgo
787cc693cd
use go-multierror instead of manually joining error reasons
Co-authored-by: Chris Thain <32781396+cthain@users.noreply.github.com>
2023-06-24 11:04:55 -06:00
Martin Atkins
d49e991c3c plans/objchange: Support nested unknowns in our unrefinedValue shim
Several parts of the objchange logic incorrectly use cty.Value.RawEquals
for value comparison, instead of more appropriate comparison methods like
cty.Value.Equals or c.Value.Range().Includes. That makes them incorrectly
consider two unknown values with the same type but different refinements
as always non-equal, rather than evaluating based on the overlap between
the refinements (if any).

As a short-term fix for that we previously added this unrefinedValue shim
that just strips away the refinements for comparison, thus allowing
callers to continue using RawEquals as long as they've already taken care
of all of the other things that can make that go wrong, such as value
marks.

Unfortunately the shim was too simplistic and only supported direct
unknown values. Unknown values with refinements can also appear nested
inside known container values such as collections, so the shim needs to
recursively un-refine the entire data structure in that case.

This is still intended only as a temporary fix until we have time to
revisit all of the callers and make them use cty's own logic for
comparison. Using cty's own logic will make the results more precise,
because e.g. it can notice if two unknown strings have different known
prefixes and therefore cannot possibly be equal despite not being fully
known. For now this shim will accept any pair of unknown values of the
same type as equal, regardless of refinement.
2023-06-22 13:16:43 -07:00
Brandon Croft
cbebace2df
Merge pull request #33415 from hashicorp/brandonc/go_mod_tidy
[Chore] go mod tidy
2023-06-22 11:22:49 -06:00
Brandon Croft
2173aff852
Run go mod tidy 2023-06-22 11:14:21 -06:00
Brandon Croft
63124e0cb7
Merge pull request #33336 from hashicorp/TF-7056-uploading-state-directly-to-hosted-state-upload-url-when-available
cloud: when saving state, utilize new 'pending' state version
2023-06-22 11:11:00 -06:00
Liam Cervante
cad9aa9025
[Testing Framework] Add test file HCL configuration and parser functionality (#33325)
* Add test structure to views package for rendering test output

* Add test file HCL configuration and parser functionality

* address comments
2023-06-22 17:03:37 +02:00
Liam Cervante
cf3a72a2bc
Reinstate the accidentally deleted experimental testing page (#33413)
* Reinstate the accidentally deleted experimental testing page

* try removing nav reference as it is hidden anyway

* try nesting the nav reference?

* try nesting with the other module pages
2023-06-22 16:01:18 +02:00
Liam Cervante
dc04fcbc75
Update upgrade guide navigation (#33411) 2023-06-22 15:26:22 +02:00
Liam Cervante
1fe57d457d
upgrade golang.org/x/crypto/openpgp to github.com/ProtoMail/go-crypto (#33406) 2023-06-22 08:32:12 +02:00
Brandon Croft
19b17ad0a2
remote: when saving state, create a pending state version then upload 2023-06-21 12:30:33 -06:00
Brandon Croft
9fe3f7a7b4
cloud: when saving state, create a pending state version then upload
Create a pending state version followed by a separate state upload

When this version of the endpoint fails (It is not yet generally available, or when using with Terraform Enterprise) Fall back to the original call with state content included in the request.

This strategy will reduce the amount of save failures due to network latency and gateway timeouts.
2023-06-21 12:30:32 -06:00
kmoe
5ed38eb3fa
Update CHANGELOG.md 2023-06-19 11:18:05 +01:00
Andrew Hickman
49f99db1c2
terraform show -json: Add Errored field to output for plan (#33372)
* Add Errored field to JSON output

* Fix test error message
2023-06-19 11:16:41 +01:00
Rose M Koron
66e3c20b18
Merge pull request #33274 from davendu/main
docs/backends/cos: add necessary permission list for using the backend
2023-06-16 10:35:18 -07:00
Daven Du
8b8a4c4a95
Apply suggestions from code review
Better expression.

Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com>
2023-06-16 21:00:01 +08:00
James Bardin
1e6b2d0f6b
Merge pull request #33378 from hashicorp/jbardin/objchange-refinements
validate planned set sizes using refinements
2023-06-15 13:19:33 -04:00
James Bardin
f6c536e436 validate planned set sizes using refinements 2023-06-15 13:08:09 -04:00
James Bardin
0be4a381fc
Merge pull request #33377 from hashicorp/jbardin/nesting-set-length
objchange: set length is unknown with partially known elements
2023-06-15 10:26:24 -04:00
James Bardin
3c8a163583 set length is unknown with partially known elems
If a set contains partially known values the length is unknown which
causes assertPlannedObjectValid to fail valid plans.

Revert to the old method if using LengthInt for the set lengths, which
returns the maximum number of possible elements, with a guard for
entirely unknown set values.
2023-06-15 09:29:42 -04:00