Generate code by terraform plan -generate-config-out
import block
and terraform plan -generate-config-out
are very useful to import resources.
https://developer.hashicorp.com/terraform/language/import
But some users can't run terraform plan
on their laptop, so they can't run it.
tfaction provides an action generating Terraform code by terraform plan -generate-config-out
.
How to use
Please see the example workflow.
- Write import blocks and create a feature branch
We considered creating import blocks and pull requests by workflow, but unfortunately it was difficult because input types of workflow_dispatch event don't support multiline text.
https://github.com/orgs/community/discussions/12882
So we gave up it and decided to have users add import blocks and create a feature branch themselves.
- Run the workflow by workflow_dispatch event
The workflow generate code by terraform plan -generate-config-out
and pushes a commit to the feature branch.