Skip to content

Commit

Permalink
Add missing gateway_ip_version attribute with default value IPV4 if a…
Browse files Browse the repository at this point in the history
…bsent during state upgrade
  • Loading branch information
akshat-jindal-nit committed Dec 12, 2024
1 parent c2be554 commit c5bb19f
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,17 @@ Not currently available publicly.`,
}

func ResourceComputeHaVpnGatewayUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) {
return tpgresource.TerraformLabelsStateUpgrade(rawState)
log.Printf("[DEBUG] Attributes before migration: %#v", rawState)


// Check if "gateway_ip_version" already exists
if _, ok := rawState["gateway_ip_version"]; !ok {
// Add the missing attribute with the default value
rawState["gateway_ip_version"] = "IPV4"
} else {
log.Printf("[DEBUG] 'gateway_ip_version' already exists: %#v", rawState["gateway_ip_version"])
}

log.Printf("[DEBUG] Attributes after migration: %#v", rawState)
return rawState, nil
}

0 comments on commit c5bb19f

Please sign in to comment.