├── .github └── workflows │ └── ci.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── README.md ├── cmd ├── apply.go ├── doc.go ├── mock.go ├── mv.go ├── rename.go ├── root.go ├── version.go └── version_test.go ├── docs └── cli │ ├── tfrefactor.md │ ├── tfrefactor_completion.md │ ├── tfrefactor_completion_bash.md │ ├── tfrefactor_completion_fish.md │ ├── tfrefactor_completion_powershell.md │ ├── tfrefactor_completion_zsh.md │ ├── tfrefactor_doc.md │ ├── tfrefactor_mv.md │ ├── tfrefactor_rename.md │ └── tfrefactor_version.md ├── go.mod ├── go.sum ├── main.go └── refactor ├── address.go ├── diff.go ├── mv.go ├── mv_test.go ├── parse.go ├── rename.go ├── rename_test.go ├── test_data └── tf_org │ ├── case_all_data_blocks │ ├── from │ │ ├── a.tf │ │ └── a2.tf │ └── to │ │ ├── a.tf │ │ ├── a2.tf │ │ └── data.tf │ ├── case_all_locals │ ├── from │ │ ├── a.tf │ │ └── b.tf │ └── to │ │ ├── a.tf │ │ ├── b.tf │ │ └── locals.tf │ ├── case_all_outputs │ ├── from │ │ └── a.tf │ └── to │ │ ├── a.tf │ │ └── outputs.tf │ ├── case_all_vars │ ├── from │ │ └── a.tf │ └── to │ │ ├── a.tf │ │ └── variables.tf │ ├── case_data_single_block │ ├── from │ │ ├── a.tf │ │ └── data.tf │ └── to │ │ ├── a.tf │ │ └── data.tf │ ├── case_data_single_block_new_file │ ├── from │ │ └── a.tf │ └── to │ │ ├── a.tf │ │ └── data.tf │ ├── case_resource_type │ ├── from │ │ └── a.tf │ └── to │ │ ├── a.tf │ │ └── dest.tf │ ├── case_single_local │ ├── from │ │ └── a.tf │ └── to │ │ ├── a.tf │ │ └── locals.tf │ └── case_single_var │ ├── from │ └── a.tf │ └── to │ ├── a.tf │ └── variables.tf └── update_plan.go /.github/workflows/ci.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/.github/workflows/ci.yml -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/.gitignore -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/CONTRIBUTING.md -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/LICENSE -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/Makefile -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/README.md -------------------------------------------------------------------------------- /cmd/apply.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/cmd/apply.go -------------------------------------------------------------------------------- /cmd/doc.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/cmd/doc.go -------------------------------------------------------------------------------- /cmd/mock.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/cmd/mock.go -------------------------------------------------------------------------------- /cmd/mv.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/cmd/mv.go -------------------------------------------------------------------------------- /cmd/rename.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/cmd/rename.go -------------------------------------------------------------------------------- /cmd/root.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/cmd/root.go -------------------------------------------------------------------------------- /cmd/version.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/cmd/version.go -------------------------------------------------------------------------------- /cmd/version_test.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/cmd/version_test.go -------------------------------------------------------------------------------- /docs/cli/tfrefactor.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/docs/cli/tfrefactor.md -------------------------------------------------------------------------------- /docs/cli/tfrefactor_completion.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/docs/cli/tfrefactor_completion.md -------------------------------------------------------------------------------- /docs/cli/tfrefactor_completion_bash.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/docs/cli/tfrefactor_completion_bash.md -------------------------------------------------------------------------------- /docs/cli/tfrefactor_completion_fish.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/docs/cli/tfrefactor_completion_fish.md -------------------------------------------------------------------------------- /docs/cli/tfrefactor_completion_powershell.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/docs/cli/tfrefactor_completion_powershell.md -------------------------------------------------------------------------------- /docs/cli/tfrefactor_completion_zsh.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/docs/cli/tfrefactor_completion_zsh.md -------------------------------------------------------------------------------- /docs/cli/tfrefactor_doc.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/docs/cli/tfrefactor_doc.md -------------------------------------------------------------------------------- /docs/cli/tfrefactor_mv.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/docs/cli/tfrefactor_mv.md -------------------------------------------------------------------------------- /docs/cli/tfrefactor_rename.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/docs/cli/tfrefactor_rename.md -------------------------------------------------------------------------------- /docs/cli/tfrefactor_version.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/docs/cli/tfrefactor_version.md -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/go.mod -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/go.sum -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/main.go -------------------------------------------------------------------------------- /refactor/address.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/address.go -------------------------------------------------------------------------------- /refactor/diff.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/diff.go -------------------------------------------------------------------------------- /refactor/mv.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/mv.go -------------------------------------------------------------------------------- /refactor/mv_test.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/mv_test.go -------------------------------------------------------------------------------- /refactor/parse.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/parse.go -------------------------------------------------------------------------------- /refactor/rename.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/rename.go -------------------------------------------------------------------------------- /refactor/rename_test.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/rename_test.go -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_all_data_blocks/from/a.tf: -------------------------------------------------------------------------------- 1 | data "a" "b" { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_all_data_blocks/from/a2.tf: -------------------------------------------------------------------------------- 1 | data "a2" "b" { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_all_data_blocks/to/a.tf: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_all_data_blocks/to/a2.tf: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_all_data_blocks/to/data.tf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/test_data/tf_org/case_all_data_blocks/to/data.tf -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_all_locals/from/a.tf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/test_data/tf_org/case_all_locals/from/a.tf -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_all_locals/from/b.tf: -------------------------------------------------------------------------------- 1 | locals { 2 | b = "c" 3 | } 4 | -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_all_locals/to/a.tf: -------------------------------------------------------------------------------- 1 | resource "a" "b" { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_all_locals/to/b.tf: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_all_locals/to/locals.tf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/test_data/tf_org/case_all_locals/to/locals.tf -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_all_outputs/from/a.tf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/test_data/tf_org/case_all_outputs/from/a.tf -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_all_outputs/to/a.tf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/test_data/tf_org/case_all_outputs/to/a.tf -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_all_outputs/to/outputs.tf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/test_data/tf_org/case_all_outputs/to/outputs.tf -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_all_vars/from/a.tf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/test_data/tf_org/case_all_vars/from/a.tf -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_all_vars/to/a.tf: -------------------------------------------------------------------------------- 1 | resource "a" "b" { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_all_vars/to/variables.tf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/test_data/tf_org/case_all_vars/to/variables.tf -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_data_single_block/from/a.tf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/test_data/tf_org/case_data_single_block/from/a.tf -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_data_single_block/from/data.tf: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_data_single_block/to/a.tf: -------------------------------------------------------------------------------- 1 | resource "a" "b" { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_data_single_block/to/data.tf: -------------------------------------------------------------------------------- 1 | data "a" "b" { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_data_single_block_new_file/from/a.tf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/test_data/tf_org/case_data_single_block_new_file/from/a.tf -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_data_single_block_new_file/to/a.tf: -------------------------------------------------------------------------------- 1 | resource "a" "b" { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_data_single_block_new_file/to/data.tf: -------------------------------------------------------------------------------- 1 | data "a" "b" { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_resource_type/from/a.tf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/test_data/tf_org/case_resource_type/from/a.tf -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_resource_type/to/a.tf: -------------------------------------------------------------------------------- 1 | resource "b" "a" { 2 | # should stay 3 | } 4 | -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_resource_type/to/dest.tf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/test_data/tf_org/case_resource_type/to/dest.tf -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_single_local/from/a.tf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/test_data/tf_org/case_single_local/from/a.tf -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_single_local/to/a.tf: -------------------------------------------------------------------------------- 1 | locals { 2 | a = "b" 3 | } 4 | -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_single_local/to/locals.tf: -------------------------------------------------------------------------------- 1 | locals { 2 | b = "c" 3 | } 4 | -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_single_var/from/a.tf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/test_data/tf_org/case_single_var/from/a.tf -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_single_var/to/a.tf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/test_data/tf_org/case_single_var/to/a.tf -------------------------------------------------------------------------------- /refactor/test_data/tf_org/case_single_var/to/variables.tf: -------------------------------------------------------------------------------- 1 | variable "a" { 2 | foo = "bar" 3 | } 4 | -------------------------------------------------------------------------------- /refactor/update_plan.go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craftvscruft/tfrefactor/HEAD/refactor/update_plan.go --------------------------------------------------------------------------------