Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify previous Terraform state can be reused #1430

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NamelessOne91
Copy link
Contributor

Related https://github.com/SUSE/spacewalk/issues/25242

Introduces additional checks when "use_previous_terraform_state"is checked, with the aim to validate a previous Terraform state is indeed present and can be safely reused.

@NamelessOne91 NamelessOne91 self-assigned this Oct 11, 2024
@srbarrios
Copy link
Member

Looks a nice improvement.
As suggestion, I would also try to use virsh to collect the actual resources status (for instance VMs and disks created), as the tfstate it might actually don't match the real state.
And if I'm guessing right, terraform plan only compares the information from tfstate and main.tf, without directly checking the real deployed resources.

@NamelessOne91 NamelessOne91 force-pushed the use_previous_tf_state_improvements branch from 676b625 to 877d38e Compare October 12, 2024 13:30
@NamelessOne91
Copy link
Contributor Author

And if I'm guessing right, terraform plan only compares the information from tfstate and main.tf, without directly checking the real deployed resources.

IIRC plan does automatically a refresh to check differences between deployed resources and what's in the state file ... but I may not RC 😄
So, it seems there's an option to force it anyway.

I added it and refactored the code a bit to be more robust.
Still needs to be tested properly, as I have a few doubts it will work and do what we expect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants