Commit Graph

31362 Commits

Author SHA1 Message Date
Liam Cervante
5acc95dda7
[Testing Framework] Add module block to test run blocks (#33456)
* [testing framework] prepare for beta phase of development

* [Testing Framework] Add module block to test run blocks
2023-07-10 11:42:05 +01:00
Liam Cervante
c9bc7e8479
Add input validation into the 'checks' outputs and tracking (#33481) 2023-07-10 11:33:45 +01:00
Liam Cervante
f74a8d16cf
[testing framework] implement expect_failures functionality (#33443) 2023-07-10 11:30:44 +01:00
CJ Horton
2622e89cfb
Merge pull request #33448 from agustinguayama/fix/small_typo
fix typo in terraform/internal/command /init.go
2023-07-07 09:45:44 -07:00
James Bardin
c42d3b4e51
Merge pull request #33462 from hashicorp/jbardin/destroy-output-provider-refs
always evaluate module outputs during destroy
2023-07-07 09:44:27 -04:00
Graham Davison
d179b686d9 Consolidates endpoint tests 2023-07-06 16:05:52 -07:00
Graham Davison
2f00c86255 Adds endpoint tests when configured in configuration 2023-07-06 16:05:52 -07:00
Graham Davison
90c10ebbe9 Removes redundant ARN parsing 2023-07-06 16:05:52 -07:00
Graham Davison
29e14d148b Reorders skip_... parameters 2023-07-06 16:05:52 -07:00
Graham Davison
c3f4f9cedd Fixes region validation 2023-07-06 16:05:52 -07:00
Graham Davison
454eed63e7 Adds KMS Key validation 2023-07-06 16:05:52 -07:00
Graham Davison
2fda09aab2 Updates attribute validation messages 2023-07-06 16:05:52 -07:00
Graham Davison
e8c7722d3e Restores conflict between kms_key_id and envvar AWS_SSE_CUSTOMER_KEY 2023-07-06 16:05:52 -07:00
Graham Davison
827d7bd384 Combines sse_customer_key and AWS_SSE_CUSTOMER_KEY validation 2023-07-06 16:05:52 -07:00
Graham Davison
4eaa44c5a5 Adds functions for clearing all envvars 2023-07-06 16:05:52 -07:00
Graham Davison
2d12f242c7 Adds checks for not getting validation errors when they are expected 2023-07-06 16:05:52 -07:00
Graham Davison
95eb523c02 Sets service endpoints from envvar and adds tests 2023-07-06 16:05:52 -07:00
Graham Davison
8d018cfef3 Adds test for setting region from envvars 2023-07-06 16:05:52 -07:00
Graham Davison
9bea21e8b2 Moves schema to ConfigSchema and removes references to legacy schema 2023-07-06 16:05:52 -07:00
Graham Davison
467e6256da Moves configuration to Configure 2023-07-06 16:05:52 -07:00
Graham Davison
381006742b Moves validation to PrepareConfig 2023-07-06 16:05:52 -07:00
Graham Davison
b5de540643 Fully populates schema values 2023-07-06 16:05:52 -07:00
Graham Davison
9257dfa8a7 S3 backend: Adds tests for defaults and validation 2023-07-06 16:05:52 -07:00
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
James Bardin
b45de53c13 always evaluate module outputs during destroy
A module output is generally not used during destroy, however it must be
evaluated when its value is used by a provider for configuration,
because that configuration is not stored between walks.

There was an oversight in the output expansion node where the output
node was not created because the operation was destroy, and module
outputs have nothing to destroy. This however skipped evaluation when
the output is needed by a provider as mentioned above. Because of the
way an implied plan is stored internally when executing `terraform
destroy`, this went unnoticed by the test.

Allowing the output to be evaluated during destroy fixes the issue, and
should be acceptable because an output is classified as temporary in the
graph, and will be pruned when not actually needed.

Update the existing test to serialize the plan, which triggers the
failure.
2023-06-30 15:24:49 -04: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
Agustin Guayama
db5b81d2c1
fix typo in terraform/internal/command /init.go 2023-06-29 17:34:34 -03: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