Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark partial update when NSX update fails for vpc #1414

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions nsxt/resource_nsxt_policy_project_ip_address_allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ func resourceNsxtPolicyProjectIpAddressAllocationUpdate(d *schema.ResourceData,
client := clientLayer.NewIpAddressAllocationsClient(connector)
_, err := client.Update(parents[0], parents[1], id, obj)
if err != nil {
// Trigger partial update to avoid terraform updating state based on failed intent
// TODO - move this into handleUpdateError
d.Partial(true)
return handleUpdateError("ProjectIpAddressAllocation", id, err)
}

Expand Down
3 changes: 3 additions & 0 deletions nsxt/resource_nsxt_vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ func resourceNsxtVpcUpdate(d *schema.ResourceData, m interface{}) error {
client := clientLayer.NewVpcsClient(connector)
_, err := client.Update(parents[0], parents[1], id, obj)
if err != nil {
// Trigger partial update to avoid terraform updating state based on failed intent
// TODO - move this into handleUpdateError
d.Partial(true)
return handleUpdateError("Vpc", id, err)
}

Expand Down
3 changes: 3 additions & 0 deletions nsxt/resource_nsxt_vpc_connectivity_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ func resourceNsxtVpcConnectivityProfileUpdate(d *schema.ResourceData, m interfac
client := clientLayer.NewVpcConnectivityProfilesClient(connector)
_, err := client.Update(parents[0], parents[1], id, obj)
if err != nil {
// Trigger partial update to avoid terraform updating state based on failed intent
// TODO - move this into handleUpdateError
d.Partial(true)
return handleUpdateError("VpcConnectivityProfile", id, err)
}

Expand Down
3 changes: 3 additions & 0 deletions nsxt/resource_nsxt_vpc_dhcp_v4_static_binding_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@ func resourceNsxtVpcSubnetDhcpV4StaticBindingConfigUpdate(d *schema.ResourceData
client := clientLayer.NewDhcpStaticBindingConfigsClient(connector)
_, err := client.Update(parents[0], parents[1], parents[2], parents[3], id, convObj.(*data.StructValue))
if err != nil {
// Trigger partial update to avoid terraform updating state based on failed intent
// TODO - move this into handleUpdateError
d.Partial(true)
return handleUpdateError("DhcpV4StaticBindingConfig", id, err)
}

Expand Down
3 changes: 3 additions & 0 deletions nsxt/resource_nsxt_vpc_external_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ func resourceNsxtVpcExternalAddressRead(d *schema.ResourceData, m interface{}) e
func resourceNsxtVpcExternalAddressUpdate(d *schema.ResourceData, m interface{}) error {
err := updatePort(d, m, false)
if err != nil {
// Trigger partial update to avoid terraform updating state based on failed intent
// TODO - move this into handleUpdateError
d.Partial(true)
return handleUpdateError("External Address", "", err)
}
return resourceNsxtVpcExternalAddressRead(d, m)
Expand Down
3 changes: 3 additions & 0 deletions nsxt/resource_nsxt_vpc_ip_address_allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ func resourceNsxtVpcIpAddressAllocationUpdate(d *schema.ResourceData, m interfac
client := clientLayer.NewIpAddressAllocationsClient(connector)
_, err := client.Update(parents[0], parents[1], parents[2], id, obj)
if err != nil {
// Trigger partial update to avoid terraform updating state based on failed intent
// TODO - move this into handleUpdateError
d.Partial(true)
return handleUpdateError("VpcIpAddressAllocation", id, err)
}

Expand Down
3 changes: 3 additions & 0 deletions nsxt/resource_nsxt_vpc_nat_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ func resourceNsxtPolicyVpcNatRuleUpdate(d *schema.ResourceData, m interface{}) e
client := clientLayer.NewNatRulesClient(connector)
_, err := client.Update(parents[0], parents[1], parents[2], parents[3], id, obj)
if err != nil {
// Trigger partial update to avoid terraform updating state based on failed intent
// TODO - move this into handleUpdateError
d.Partial(true)
return handleUpdateError("PolicyVpcNatRule", id, err)
}

Expand Down
3 changes: 3 additions & 0 deletions nsxt/resource_nsxt_vpc_service_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@ func resourceNsxtVpcServiceProfileUpdate(d *schema.ResourceData, m interface{})
client := clientLayer.NewVpcServiceProfilesClient(connector)
_, err := client.Update(parents[0], parents[1], id, obj)
if err != nil {
// Trigger partial update to avoid terraform updating state based on failed intent
// TODO - move this into handleUpdateError
d.Partial(true)
return handleUpdateError("VpcServiceProfile", id, err)
}

Expand Down
3 changes: 3 additions & 0 deletions nsxt/resource_nsxt_vpc_static_routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ func resourceNsxtVpcStaticRoutesUpdate(d *schema.ResourceData, m interface{}) er
client := clientLayer.NewStaticRoutesClient(connector)
_, err := client.Update(parents[0], parents[1], parents[2], id, obj)
if err != nil {
// Trigger partial update to avoid terraform updating state based on failed intent
// TODO - move this into handleUpdateError
d.Partial(true)
return handleUpdateError("StaticRoutes", id, err)
}

Expand Down
3 changes: 3 additions & 0 deletions nsxt/resource_nsxt_vpc_subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,9 @@ func resourceNsxtVpcSubnetUpdate(d *schema.ResourceData, m interface{}) error {
client := clientLayer.NewSubnetsClient(connector)
_, err := client.Update(parents[0], parents[1], parents[2], id, obj)
if err != nil {
// Trigger partial update to avoid terraform updating state based on failed intent
// TODO - move this into handleUpdateError
d.Partial(true)
return handleUpdateError("VpcSubnet", id, err)
}

Expand Down
Loading