Fix internet_protocol/routing_mode case mismatch causing perpetual replace on cloudstack_vpc_offering - #330
Open
sudo87 wants to merge 1 commit into
Open
Conversation
…place on cloudstack_vpc_offering CloudStack's API normalizes these ForceNew fields' casing on write (e.g. ipv4 -> IPv4, static -> Static), which produced a permanent diff and proposed a destroy/recreate on every subsequent plan. Add a case-insensitive DiffSuppressFunc to both fields. network_mode is unaffected: the API rejects incorrect casing outright instead of silently normalizing it, so no fix is needed there.
Contributor
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds case-insensitive diff suppression for CloudStack-normalized ForceNew fields to prevent perpetual plan diffs and unnecessary VPC offering replacements.
Changes:
- Add
DiffSuppressFuncusing case-insensitive comparison forinternet_protocol. - Add
DiffSuppressFuncusing case-insensitive comparison forrouting_mode. - Import
stringsto supportstrings.EqualFold.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| import ( | ||
| "fmt" | ||
| "log" | ||
| "strings" |
Comment on lines
+86
to
+88
| DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { | ||
| return strings.EqualFold(old, new) | ||
| }, |
Comment on lines
+103
to
+105
| DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { | ||
| return strings.EqualFold(old, new) | ||
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
CloudStack's API normalizes these ForceNew fields' casing on write (e.g. ipv4 -> IPv4, static -> Static), which produced a permanent diff and proposed a destroy/recreate on every subsequent plan. Add a case-insensitive DiffSuppressFunc to both fields.
network_mode is unaffected: the API rejects incorrect casing outright instead of silently normalizing it, so no fix is needed there.