fix(droplet): detect monitoring/ipv6 drift via droplet.Features#67
fix(droplet): detect monitoring/ipv6 drift via droplet.Features#67
Conversation
Agent-Logs-Url: https://github.com/GoCodeAlone/workflow-plugin-digitalocean/sessions/3cb12045-f989-4c4c-adf6-c1782e6322f6 Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the Droplet resource driver to detect drift for monitoring and ipv6 by reading the live droplet’s enabled features (droplet.Features) and comparing them against the desired spec when those keys are explicitly present in config.
Changes:
- Add
dropletHasFeaturehelper to check whether a feature string (e.g."monitoring","ipv6") is present ingodo.Droplet.Features. - Extend
dropletOutputto emit booleanOutputs["monitoring"]/Outputs["ipv6"]derived fromdroplet.Features. - Extend
DropletDriver.Diffto detectmonitoring/ipv6drift (ForceNew) when those keys are present in desired config, and update doc comments accordingly. - Add unit tests covering read-side feature extraction and diff behavior (toggle vs absent-key).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
internal/drivers/droplet.go |
Adds feature-based read outputs for monitoring/ipv6 and drift detection logic in Diff, plus updated doc comments. |
internal/drivers/droplet_test.go |
Adds tests ensuring Read derives booleans from Features and Diff forces replace on mismatches while skipping absent keys. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/GoCodeAlone/workflow-plugin-digitalocean/sessions/5f0057aa-dfcc-4a6d-a3c0-52fdf27fcbd3 Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Applied in edbcc99. Both |
The failing job is |
DropletDriver.Diffsilently ignored changes tomonitoringandipv6because the code assumed godo'sDroplet.Getresponse had no read-side signal for them. The DO API does expose these viadroplet.Features []string(e.g.["monitoring", "ipv6"]) — no side-channel state file required.Changes
dropletHasFeature(droplet, feature)— linear scan ofdroplet.Featuresto check if a feature string is presentdropletOutput()— adds"monitoring"and"ipv6"boolean keys toOutputs, derived fromdroplet.FeaturesDiff()— detects drift onmonitoringandipv6with the same key-present guard used byvpc_uuid,enable_backups, andtags(absent key = no churn for legacy YAML)user_dataandssh_keys; movesmonitoring/ipv6into the detected listuser_dataandssh_keysremain undetectable — write-only and not returned byDroplet.Getrespectively.Example