Skip to content

Fix internet_protocol/routing_mode case mismatch causing perpetual replace on cloudstack_vpc_offering - #330

Open
sudo87 wants to merge 1 commit into
mainfrom
fix/vpc-offering-case-insensitive-forcenew-fields
Open

Fix internet_protocol/routing_mode case mismatch causing perpetual replace on cloudstack_vpc_offering#330
sudo87 wants to merge 1 commit into
mainfrom
fix/vpc-offering-case-insensitive-forcenew-fields

Conversation

@sudo87

@sudo87 sudo87 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

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.

…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.
@sudo87
sudo87 requested review from sureshanaparti and a lite review from Copilot August 28, 2026 09:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 DiffSuppressFunc using case-insensitive comparison for internet_protocol.
  • Add DiffSuppressFunc using case-insensitive comparison for routing_mode.
  • Import strings to support strings.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)
},
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