abcxyz / abcxyz/guardian

[Backlog][Tooling] Terraform Refactoring Tool

Open
#61 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
26
Forks
7
Avg merge
1d 1h
Merged PRs (30d)
1

Description

### TL;DR

GitHub workflow that implements https://github.com/padok-team/tfautomv & automatically commits a change to a history.tf file for noop refactoring to resource names.

### Detailed design

```markdown
Refactoring TF resources becomes tedious when the resource names are modified. You can rely on `terraform state mv` for changes that impact a small number of resources but this is manual and painstaking. For more complex changes there is no good solution.

https://github.com/padok-team/tfautomv Is a tool that can be used to automatically generate `moved` blocks from file changes. We can either use this or build our own if this doesn't meet our requirements (use git history + terraform plan on local temporary isolated backend + compare plans to determine which resources have moved = generate moved blocks).

The github workflow would:
* Only trigger on a PR when the user indicates that a trivial move has occurred. Possibly this could be implemented with a PR title, description, or comment tag.
* Automatically generate the `moved` blocks and commit it to the PR.
```

### Alternatives considered

```markdown
Just use the CLI tool instead of creating a github workflow.
```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.