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

Resolve accidental destruction of startup-scripts #1085

Merged
merged 2 commits into from
Mar 27, 2023

Conversation

tpdownes
Copy link
Member

When the startup-script module is used with VM instance templates that have create_before_destroy enabled (a common setting), a change to the script contents will result in the script being created, then destroyed. This commit resolves that by ensuring that all startup-script objects are created with unique, repeatable identifiers. This allows the new object to be created while destroying the old object with a different identifier.

Submission Checklist

  • Have you installed and run this change against pre-commit? (pre-commit install)
  • Are all tests passing? (make tests)
  • Have you written unit tests to cover this change?
  • Is unit test coverage still above 80%?
  • Have you updated all applicable documentation?
  • Have you followed the guidelines in our Contributing document?

When the startup-script module is used with VM instance templates that
have create_before_destroy enabled (a common setting), a change to the
script contents will result in the script being created, then destroyed.
This commit resolves that by ensuring that all startup-script objects
are created with unique, repeatable identifiers. This allows the new
object to be created while destroying the old object with a different
identifier.
@tpdownes
Copy link
Member Author

This PR will be followed up by another PR to update all internal use of startup-script to the appropriate ref.

When testing, please give extra consideration to runners specified with "source" rather than "content" as those are less covered in tests.

@tpdownes
Copy link
Member Author

An additional test that I performed but you should also consider: trigger a change to the template that does not involve the script and observe that nothing changes with the script. e.g. machine_type.

modules/scripts/startup-script/main.tf Outdated Show resolved Hide resolved
modules/scripts/startup-script/main.tf Outdated Show resolved Hide resolved
@nick-stroud nick-stroud assigned tpdownes and unassigned nick-stroud Mar 24, 2023
@tpdownes tpdownes assigned nick-stroud and unassigned tpdownes Mar 24, 2023
@nick-stroud nick-stroud assigned tpdownes and unassigned nick-stroud Mar 24, 2023
@tpdownes tpdownes assigned nick-stroud and unassigned tpdownes Mar 27, 2023
@nick-stroud nick-stroud assigned tpdownes and unassigned nick-stroud Mar 27, 2023
@tpdownes tpdownes merged commit 34bb725 into GoogleCloudPlatform:develop Mar 27, 2023
@tpdownes tpdownes deleted the fix_startup_script branch March 27, 2023 16:20
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