amazon image: fetch meta-data everytime in case if something changes #66487
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.
Motivation for this change
Context: this PR assumes you are running an instance in Amazon EC2.
Currently, after a reboot, a NixOS instance will re-configure itself, but to the user-data value which was set at instance creation.
AWS support changing user data while an instance is stopped. Further, if you use CloudFormation to manage your EC2 instances, and you make a change to user data, your instance will be stopped, user data updated, and instance restarted.
This PR cherry-picks a commit from unmerged PR #19031 which re-downloads user data on every boot, not just the first boot, so that changes to user-data can be picked up and applied. This will mean that instances can be truly declaratively managed using AWS CloudFormation - a change to user-data in your CloudFormation template will cause the instance to be reconfigured to the desired state.
This PR conflicts with issue #41826, which says we shouldn't reconfigure machines after reboot at all. That said, I think the current behaviour is confusing, and either this PR or #41826 would be better.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)