Skip to content

Fix SetMetadata to preserve existing GCP instance metadata#1657

Merged
james00012 merged 1 commit intomainfrom
fix/preserve-gcp-instance-metadata
Jan 28, 2026
Merged

Fix SetMetadata to preserve existing GCP instance metadata#1657
james00012 merged 1 commit intomainfrom
fix/preserve-gcp-instance-metadata

Conversation

@james00012
Copy link
Copy Markdown
Contributor

Summary

  • Fix newMetadata to preserve existing metadata items when adding new key-value pairs
  • Add unit tests for the newMetadata function

Problem

Since v0.55.0, SetMetadata and AddSshKey replaced all instance metadata instead of merging new items with existing ones.

Solution

Modified newMetadata to first copy existing metadata items, then add/update with new key-value pairs.

Fixes #1655

The newMetadata function was not preserving existing metadata items
when adding new key-value pairs. This caused SetMetadata and AddSshKey
to replace all instance metadata instead of merging.

Fixes #1655
@james00012 james00012 force-pushed the fix/preserve-gcp-instance-metadata branch from aa4042e to 5b58d39 Compare January 23, 2026 02:31
@james00012 james00012 merged commit d475460 into main Jan 28, 2026
3 checks passed
@james00012 james00012 deleted the fix/preserve-gcp-instance-metadata branch January 28, 2026 03:42
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.

setMetadataE in modules/gcp/compute.go no longer preserves existing metadata

2 participants