feat(talos_machine_configuration_apply): add prevent_uncontrolled_reboots option #286
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add a new
prevent_uncontrolled_rebootsboolean attribute to thetalos_machine_configuration_applyresource to prevent uncontrolled reboots during configuration updates.Motivation
When applying Talos machine configurations with
apply_mode=auto, Terraform may automatically reboot nodes if the configuration changes require it. This can be problematic in production environments where reboots need to be carefully controlled and scheduled.Changes
Feature
prevent_uncontrolled_reboots(boolean, default:false)apply_mode=auto, performs a dry-run check duringterraform planstagedmodeautomode normallyImplementation
handleRebootPrevention()helper function to encapsulate the logicTesting
TestAccTalosMachineConfigurationApplyResourcePreventRebootsResult :
When a change is made that requires a reboot, the following happens:
If another Terraform apply is run before rebooting the nodes:
After rebooting the nodes, the state needs to be fixed: