opentofu/internal
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
..
addrs [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
backend [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
builtin [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
checks [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
cloud [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
command Plannable import: Add generated config to JSON and human-readable plan output (#33154) 2023-05-11 08:50:03 +02:00
communicator [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
configs plannable import: add a provider argument to the import block (#33175) 2023-05-11 09:04:39 +02:00
copy [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
dag [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
depsfile [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
didyoumean [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
e2e [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
experiments [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
genconfig Plannable import: Generate config for imported resources during the plan. (#33153) 2023-05-11 08:38:37 +02:00
getmodules [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
getproviders [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
grpcwrap [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
helper/slowmessage [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
httpclient [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
initwd [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
instances [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
ipaddr [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
lang [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
legacy [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
logging [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
modsdir [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
moduledeps [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
moduletest [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
plans Plannable import: Generate config for imported resources during the plan. (#33153) 2023-05-11 08:38:37 +02:00
plugin [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
plugin6 [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
provider-simple [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
provider-simple-v6 [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
provider-terraform/main [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
providercache [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
providers [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
provisioner-local-exec/main [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
provisioners [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
refactoring [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
registry [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
repl [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
replacefile [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
states [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
terminal [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
terraform plannable import: add a provider argument to the import block (#33175) 2023-05-11 09:04:39 +02:00
tfdiags [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
tfplugin5 Rebuild protobuf 2023-05-02 11:44:23 -04:00
tfplugin6 Rebuild protobuf 2023-05-02 11:44:23 -04:00