Commit Graph

31149 Commits

Author SHA1 Message Date
Rose M Koron
fbdc07cb7d
Update website/docs/language/resources/provisioners/syntax.mdx 2023-05-11 17:09:42 -07:00
Liam Cervante
cd06543b39
plannable import: fix config generation printing empty collections instead of null values (#33183) 2023-05-11 20:18:25 +02:00
Liam Cervante
192cb255a6
checks: no longer experimental (#33184) 2023-05-11 20:17:49 +02:00
Martin Atkins
b56af3a36a website: Clarify what the "any" type constraint placeholder is for
From helping folks in community forums I've noticed that many people
misunderstand "type = any" as being a shorthand to avoid writing out a
proper type constraint, rather than as a way to handle the very rare case
where a module truly does not care what type of value it's accepting.

This is understandable because the previous documentation only described
how this feature behaved, and not what this feature was for. This new
content instead leads by describing the single rare situation where this
feature is appropriate to use, and only then explains some details of
how it works. Hopefully this will help avoid misleading people into using
this placeholder in inappropriate situations, and thus allow Terraform to
give them better feedback about errors elsewhere in their configurations.
2023-05-11 09:40:34 -07: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
Liam Cervante
4d837df546
Plannable import: Add generated config to JSON and human-readable plan output (#33154)
* 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 generated config to json and human-readable plan output

---------

Co-authored-by: Katy Moe <katy@katy.moe>
2023-05-11 08:50:03 +02:00
Liam Cervante
79f7f59155
Plannable import: Generate config for imported resources during the plan. (#33153)
* 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

---------

Co-authored-by: Katy Moe <katy@katy.moe>
2023-05-11 08:38:37 +02:00
CJ Horton
bc084858b1 add import hooks for plan and apply
Separate hooks used for the legacy import command for those used by
the new import mechanism; also add apply output for imports.
2023-05-10 20:53:44 -07:00
CJ Horton
9904f62bfd
Merge pull request #33171 from hashicorp/revert-33155-liamcervante/plannable-import/streamed-logs
Revert "Plannable import: Make the streamed logs more consistent during planning"
2023-05-10 20:53:14 -07:00
Craig Wright
a3f5537faa
Merge pull request #33172 from stefkiourk/patch-3 2023-05-10 15:16:05 -07:00
James Bardin
2e0efe7321
Merge pull request #33047 from hashicorp/jbardin/destroy-provider-pruning
prune unused providers within modules
2023-05-10 11:54:10 -04:00
Stef Ki
719c5854bb
Update fmt.mdx to include missing period / full stop 2023-05-10 11:45:12 +02:00
Liam Cervante
2793af042c Revert "Plannable import: Make the streamed logs more consistent during a plan operation (#33155)"
This reverts commit 3c20f7b340.
2023-05-10 11:00:45 +02:00
Liam Cervante
3c20f7b340
Plannable import: Make the streamed logs more consistent during a plan operation (#33155) 2023-05-10 08:27:15 +02:00
Craig Wright
27f87ff70e
Merge pull request #33159 from VictoriaMOtus/main 2023-05-08 17:27:29 -07:00
hashicorp-copywrite[bot]
bb36298b21 [COMPLIANCE] Add Copyright and License Headers 2023-05-08 15:47:42 -07:00
Brian McClain
ec390864a1
Merge pull request #33162 from hashicorp/ref-update
docs: Clarify doc reference
2023-05-08 16:29:17 -04:00
Brian McClain
ef470252b7
Clarify doc reference (#33162) 2023-05-08 16:28:27 -04:00
Brian McClain
58f3d923d9
Clarify doc reference (#33162) 2023-05-08 16:28:05 -04:00
Brian McClain
9b6856a98c Clarify doc reference 2023-05-08 16:16:00 -04:00
Victoria Mann
39667b77b8
Update command to match /cli/commands/taint -replace cmd
Update documentation to match the documentation on the deprecated taint command in /cli/commands/taint.
2023-05-06 17:01:55 -04:00
Rose M Koron
c9ab87d49e
Merge pull request #32073 from igventurelli/patch-1
Fixing s3.mdx on Delegating Access
2023-05-05 16:25:40 -07:00
Rose M Koron
9d815ea727
Merge pull request #32058 from coreyti/patch-1
tiny update to Resource Addressing: "value4"
2023-05-05 16:22:02 -07:00
Rose M Koron
7bc8014f22
Merge pull request #31992 from philomory/patch-1
[docs] Add warning about prefix loss when migrating
2023-05-05 16:12:36 -07:00
Rose M Koron
9ad521eac6
Update website/docs/cli/cloud/migrating.mdx 2023-05-05 16:05:45 -07:00
Rose M Koron
257ed78361
Merge pull request #33119 from willfaught/patch-1
Change separating to grouping
2023-05-05 15:55:27 -07:00
Rose M Koron
374885addf
Merge pull request #31977 from petoju/feature/fix-alternative
Fix regex pattern for more alternatives
2023-05-05 15:51:39 -07:00
Rose M Koron
6eee1ba44f
Merge pull request #31920 from robpickerill/main
update setsubtract examples to include toset notation
2023-05-05 15:41:51 -07:00
Martin Atkins
320539922a
Update CHANGELOG.md 2023-05-05 13:37:31 -07:00
Rees Pozzi
fed6538dec
core: Correct typo in "Moved resource instances excluded by targeting" error message 2023-05-05 13:36:05 -07:00
James Bardin
76737a8966
Merge pull request #33151 from hashicorp/jbardin/import-refresh
Import: only refresh an imported state once
2023-05-05 08:09:33 -04:00
James Bardin
be682f1d29 only refresh an import state once
The imported resource was being stored in the wrong state, and only
ended up in the refresh state because ReadResource was being called a
second time in the normal refresh path.

Make sure to only refresh the imported resource once. This is still done
separately within importState so that we can handle the error slightly
differently to let the user know if an imported instance does not exist.
2023-05-04 14:20:45 -04:00
Martin Atkins
9e095b2f65 version: Clean up after v1.5.0-alpha20230504 release 2023-05-04 10:49:23 -07:00
Martin Atkins
1a41519946 version: Prepare for v1.5.0-alpha20230504 release 2023-05-04 09:46:05 -07:00
Liam Cervante
77f10c4f68
Imports should come before Adds in change summaries (#33147) 2023-05-04 15:06:48 +02:00
Liam Cervante
81eb73731d
[Plannable Import] Implement streamed logs for plan (#33106)
* [plannable import] embed the resource id within the changes

* [Plannable Import] Implement streamed logs for -json plan

* use latest structs

* remove implementation plans from TODO
2023-05-04 10:02:06 +02:00
Liam Cervante
54c1c1162f
[Plannable Import] Implement human-readable plan rendering (#33113)
* [plannable import] embed the resource id within the changes

* add the plannable imports to the json and human plans

* latest importing struct
2023-05-03 18:50:04 +02:00
Craig Wright
ddd87994bf
Update README.md
Fixing broken relative link path.
2023-05-02 16:23:40 -07:00
Alisdair McDiarmid
b81253999e
Merge pull request #33003 from hashicorp/compliance/add-headers
[COMPLIANCE] Add Copyright and License Headers
2023-05-02 12:03:01 -04:00
Alisdair McDiarmid
b5658a46a2 Rebuild protobuf 2023-05-02 11:44:23 -04:00
hashicorp-copywrite[bot]
325d18262e [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
Liam Cervante
4210d905c0
[plannable import] embed the resource id within the changes (#33134)
* [plannable import] embed the resource id within the changes

* make pointers and update docs
2023-05-02 16:04:51 +02:00
Liam Cervante
b5576159da
Migrate 'state show' command to new renderer (#33116)
* Migrate 'state show' command to new renderer

* handle error
2023-05-02 15:27:59 +02:00
James Bardin
2c09ae4f3d prune unused providers within modules
The logic used to prune unused providers was only taking into account
the common case of providers in the root module. The quick check of
looking for up edges doesn't work within a module, because the module
structures will create non-resource nodes connected to the providers.
Use a deeper check of looking for any dependent resources which may
require that provider to be configured.
2023-05-01 10:38:13 -04:00
Vishnu Ravindra
f0b3b74f7c
website: Switch provider tutorial link from plugin-sdk to plugin-framework (#33129)
Link to plugin-framework tutorial updated
2023-05-01 08:46:13 -04:00
kmoe
28643516b2
Plannable import 3: Make import plannable (#33085)
During a plan, Terraform now checks for the presence of import blocks.

For each resource in config, if an import block is present with a matching address, planning that node will now trigger an ImportResourceState and ReadResource. The resulting state is treated as the node's "refresh state", and planning proceeds as normal from there.

The walkImport operation is now only used for the legacy "terraform import" CLI command. This is the only case under which the plan should produce graphNodeImportStates.
2023-04-28 23:45:43 +01:00
Will Faught
35bef84306
Change separating to grouping 2023-04-28 15:24:52 -07:00
kmoe
b3a49a2fa7
Update CHANGELOG.md 2023-04-28 09:52:31 +01:00
Craig Wright
19423e0a46
Merge pull request #33101 from hashicorp/fix-33069 2023-04-26 15:26:41 -07:00
Craig Wright
aae6e8ee69 Replaced tab with spaces. 2023-04-26 15:11:49 -07:00