Commit Graph

130 Commits

Author SHA1 Message Date
Syasusu
e25c06c673
Fix: improve unit test coverage for ProvisionerBlock decode (#1324)
Signed-off-by: Syasusu <syasusu@163.com>
2024-03-13 13:45:45 -04:00
Christian Mesh
5ab6167bbf
Initial wiring of encryption through the command package (#1316)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2024-03-07 08:55:57 -05:00
Christian Mesh
36eb93f958
Integrate encryption config into configs package (#1295)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2024-03-04 11:04:45 -05:00
Christian Mesh
2f5dcd5c0a
Integrate Encryption into State Backends (#1288)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2024-03-04 09:25:14 -05:00
chenzj
0b6d8ba2a5
fix: internal/config unit test for windows (#1281)
Signed-off-by: Zejun Chen <tibazq@gmail.com>
2024-02-21 14:39:59 -05:00
Ronny Orot
e9fe0f1118
Add support for removed block (#1158)
Signed-off-by: Ronny Orot <ronny.orot@gmail.com>
2024-02-21 10:31:44 +02:00
namgyalangmo
cb2e9119aa
Update copyright notice (#1232)
Signed-off-by: namgyalangmo <75657887+namgyalangmo@users.noreply.github.com>
2024-02-08 09:48:59 +00:00
Christian Mesh
06b31cd26f
Replace additional Terraform -> OpenTofu (#1007)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Co-authored-by: James Humphries <jamesh@spacelift.io>
2023-12-13 11:35:41 -05:00
Christian Mesh
abd324ea7c
Revert "Fixes #898: Replace hashicorp and terraform references" (#995) 2023-12-11 15:10:03 -05:00
Janos
15bef1428a
Fixes #898: Replace hashicorp and terraform references (#973)
Signed-off-by: Janos Bonic <86970079+janosdebugs@users.noreply.github.com>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Co-authored-by: Christian Mesh <christianmesh1@gmail.com>
2023-12-08 08:03:09 -05:00
Haidong Ji
8138991eed
Change references to opentofu.org (#902)
Signed-off-by: Haidong Ji <ji@haidongji.com>
2023-11-24 17:07:06 +01:00
Janos
5154b14818
Fixes #539: Setting both "Type" and "NestedType" removes other validation error messages (#897)
Signed-off-by: Janos Bonic <86970079+janosdebugs@users.noreply.github.com>
2023-11-21 10:57:37 +00:00
Christian Mesh
14b0765cb4
Fix S3 Remote State Backend Validation (#876)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2023-11-15 10:19:42 -05:00
Dmitry Kisler
54e1741ee6
Update hcl version to v2.19.1 (#852)
Signed-off-by: Dmitry Kisler <admin@dkisler.com>
2023-11-10 13:31:15 +01:00
RLRabinowitz
26fb627af9
Remove all Terraform mentions in STDOUTs in the codebase (#704) 2023-10-12 14:24:04 +01:00
RLRabinowitz
8967cdcee7
Remove all Terraform Cloud mentions in STDOUTs in the codebase (#703) 2023-10-12 12:07:16 +01:00
RLRabinowitz
e0ecd2ebb3
Use registry.opentofu.org as the default registry (#379)
Signed-off-by: RLRabinowitz <rlrabinowitz2@gmail.com>
2023-10-03 10:49:38 +03:00
Dmitry Kisler
a127607a85
Rename terraform to tofu in GoString method and docstrings (#576)
Signed-off-by: Dmitry Kisler <admin@dkisler.com>
2023-09-26 19:09:27 +02:00
Lars Lehtonen
7b799c9305
internal/configs/configload: prune copyDir() (#581) 2023-09-26 14:39:56 +03:00
Yaron Yarimi
90f7e5275f
Rename multiple packages to OpenTofu (depsfile, genconfig, getmodules) (#499) 2023-09-20 17:05:24 +03:00
Yaron Yarimi
c6aeb9e836
Rename legacy package to OpenTofu (#493) 2023-09-20 16:10:32 +03:00
Yaron Yarimi
c8acedd885
Rename github.com/placeholderplaceholderplaceholder/opentf to github.com/opentofu/opentofu (#461) 2023-09-20 14:35:35 +03:00
Lars Lehtonen
b65a5fd7a8
Multi Package Wrap Errors (#414) 2023-09-18 15:53:49 +03:00
Lars Lehtonen
ebe331fdd3
internal/configs: deprecate io/ioutil (#333)
Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com>
2023-09-08 01:12:25 +02:00
RLRabinowitz
19239936a4 Rename internal/legacy/terraform to internal/legacy/opentf 2023-08-27 15:58:38 +03:00
Elbaz
2729114bec missed some 2023-08-23 11:41:04 +03:00
Elbaz
6000fe690e fix warning checks 2023-08-22 15:47:37 +03:00
Elbaz
75ff795326 more naming updates 2023-08-22 15:43:11 +03:00
Elbaz
60770c81a2 update namings 2023-08-22 15:33:08 +03:00
Kuba Martin
ebcf7455eb
Rename root module name. (#4)
* Rename module name from "github.com/hashicorp/terraform" to "github.com/placeholderplaceholderplaceholder/opentf".

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Gofmt.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Regenerate protobuf.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix comments.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Undo issue and pull request link changes.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Undo comment changes.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Fix comment.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* Undo some link changes.

Signed-off-by: Jakub Martin <kubam@spacelift.io>

* make generate && make protobuf

Signed-off-by: Jakub Martin <kubam@spacelift.io>

---------

Signed-off-by: Jakub Martin <kubam@spacelift.io>
2023-08-17 14:45:11 +02:00
kmoe
765c25d2ed
allow interpolation in import block id (#33618)
The import block id field can now reference variables, attributes, and module outputs, as long as the result is a known non-empty string at plan time. A null or unknown value will result in an error.

This commit slightly modifies the legacy CLI terraform import code path to construct a synthetic hcl.Expression from the import id passed in from the command line, with no intended change of functionality.
2023-08-02 10:20:27 +01:00
Liam Cervante
f397954c52
testing framework: allow users to specify deeply nested testing directories (#33584) 2023-07-27 10:38:21 +02:00
Liam Cervante
4122ba86fc
terraform test: fix crash when using nested modules from test run blocks (#33589) 2023-07-27 10:22:53 +02:00
Liam Cervante
e1019b3641
testing framework: validate the configuration before terraform test (#33559)
* testing framework: call validate on the configuration before running terraform test

* address comments

* make tests pass after merge

* fix tests
2023-07-26 10:56:44 +02:00
Liam Cervante
222676390c
testing framework: add validation for provider blocks in test files (#33542)
* testing framework: add validation for provider blocks in test files

* .tftest -> .tftest.hcl
2023-07-26 10:01:18 +02:00
Liam Cervante
c91f91cc9e
testing framework: change test file extension to .tftest.hcl (#33553) 2023-07-20 16:57:05 +02:00
Liam Cervante
4b34902fab
[testing framework] allow tests to define and override providers (#33466)
* [testing framework] prepare for beta phase of development

* [Testing Framework] Add module block to test run blocks

* [testing framework] allow tests to define and override providers
2023-07-10 14:33:15 +01:00
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
f74a8d16cf
[testing framework] implement expect_failures functionality (#33443) 2023-07-10 11:30:44 +01:00
Liam Cervante
212ae6c4ba
Introduce separate testing scope for reference validation (#33339) 2023-06-28 09:47:24 +02:00
kmoe
fbff64ad45
configs: remove import block duplicate id check (#33434) 2023-06-27 19:25:36 +01: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
Martin Atkins
9f6a3ba701 build: Generate copyright headers automatically
HashiCorp legal now requires a copyright claim in a comment at the top of
every substantial file in this repository. If we don't add this ourselves
then a bot will open a PR to add missing entries, but that process adds
git history, pull request, and GitHub notification noise so instead we'll
deal with it proactively as part of our usual code generation steps.

This means that pull requests will fail their checks if there are any
files that lack copyright headers, so we can deal with those before we
merge rather than in a subsequent PR.
2023-05-30 08:21:40 -07:00
kmoe
be2ad69eda
plannable import: safer config generation and schema filters (#33232)
* genconfig: fix nil nested block panic

* genconfig: null NestingSingle blocks should be absent

A NestingSingle block that is null in state should be completely absent from config.

* configschema: make FilterOr variadic

* configschema: apply filters to nested types

* configschema: filter helper/schema id attribute

The legacy SDK adds an Optional+Computed "id" attribute to the
resource schema even if not defined in provider code.
During validation, however, the presence of an extraneous "id"
attribute in config will cause an error.
Remove this attribute so we do not generate an "id" attribute
where there is a risk that it is not in the real resource schema.

* configschema: filter test

* terraform: do not pre-validate generated config

Config generated from a resource's import state may fail validation in
the case of schema behaviours such as ExactlyOneOf and ConflictsWith.
We don't want to fail the plan now, because that would give the user no
way to proceed and fix the config to make it valid. We allow the plan to
complete and output the generated config.

* generate config alongside import process

Rather than waiting until we call `plan()`, generate the configuration
at the point of the import call, so we have the necessary data to return
in case planning fails later.

The `plan` and `state` predeclared variables in the plan() method were
obfuscating the actual return of nil throughout, so those identifiers
were removed for clarity.

* move generateHCLStringAttributes closer to caller

* store generated config in plan on error

* test for config gen with error

* add simple warning when generating config

---------

Co-authored-by: James Bardin <j.bardin@gmail.com>
2023-05-24 11:16:05 +01:00
Masayuki Morita
53755180fd
Fix an error message for import block with moved block (#33221)
Fixes #33220
2023-05-19 13:47:46 -07:00
CJ Horton
adcecddb4f
Merge pull request #33193 from hashicorp/radditude/no-import-blocks-in-child-modules
plannable import: disallow import blocks in child modules
2023-05-12 16:44:12 -07:00
kmoe
1172d40d7b
error if import target is move source (#33192)
It is invalid for any import block to have a "to" argument matching any moved block's "from" argument.
2023-05-13 00:30:15 +01:00
CJ Horton
2dd89d9776 import blocks are only allowed in the root module 2023-05-12 16:04:47 -07:00
CJ Horton
bd6ba6cf99
check for duplicate import blocks (#33190)
Importing to the same target address twice or importing the same ID
to multiple different resources of the same type is not allowed.
2023-05-12 23:14:44 +01:00
Liam Cervante
5d6c5a9a33
plannable import: add a provider argument to the import block (#33175)
* command: keep our promises

* remove some nil config checks

Remove some of the safety checks that ensure plan nodes have config attached at the appropriate time.

* add GeneratedConfig to plan changes objects

Add a new GeneratedConfig field alongside Importing in plan changes.

* add config generation package

The genconfig package implements HCL config generation from provider state values.

Thanks to @mildwonkey whose implementation of terraform add is the basis for this package.

* generate config during plan

If a resource is being imported and does not already have config, attempt to generate that config during planning. The config is generated from the state as an HCL string, and then parsed back into an hcl.Body to attach to the plan graph node.

The generated config string is attached to the change emitted by the plan.

* complete config generation prototype, and add tests

* plannable import: add a provider argument to the import block

* Update internal/configs/config.go

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

* Update internal/configs/config.go

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

* Update internal/configs/config.go

Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>

* fix formatting and tests

---------

Co-authored-by: Katy Moe <katy@katy.moe>
Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>
2023-05-11 09:04:39 +02:00