abcxyz / abcxyz/guardian

Add the ability to migrate terraform state

Open
#154 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

Provide the ability for users to inform guardian that the state file needs to be migrated.

### Detailed design

Use PR body comments to determine if the `-migrate-state` flag should be used in the terraform init command.

This would require two phases:

1. Checkout the main branch, run `terraform init`
2. Checkout the PR branch, run `terraform init -migrate-state`
- This would leave the existing state intact, so if the plan/apply failed, it would be a no-op
4. Continue with the `plan` and `apply`

There should be a separate and distinct step to remove the old state file after a successful plan and apply.

### Alternatives considered

_No response_

### 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.