Skip to content

Commit

Permalink
Applying feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
CorrenSoft committed Jan 13, 2025
1 parent 1b8100e commit 9e8e171
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1228,32 +1228,29 @@ func TestAccKubernetesClusterNodePool_updateVmSizeAfterFailureWithTempWithoutOri

client := clients.Containers.AgentPoolsClient

id, err := commonids.ParseKubernetesClusterID(state.Attributes["kubernetes_cluster_id"])
originalNodePoolId, err := agentpools.ParseAgentPoolID(state.Attributes["id"])
if err != nil {
return err
return fmt.Errorf("retrieving %s: %+v", originalNodePoolId, err)
}

originalNodePoolId := agentpools.NewAgentPoolID(id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, state.Attributes["name"])

resp, err := client.Get(ctx, originalNodePoolId)
resp, err := client.Get(ctx, *originalNodePoolId)
if err != nil {
return fmt.Errorf("retrieving %s: %+v", originalNodePoolId, err)
return fmt.Errorf("retrieving %s: %+v", *originalNodePoolId, err)
}
if resp.Model == nil {
return fmt.Errorf("retrieving %s: model was nil", originalNodePoolId)
return fmt.Errorf("retrieving %s: model was nil", *originalNodePoolId)
}

tempNodePoolName := "temp"
profile := resp.Model
profile.Name = &tempNodePoolName
profile.Properties.VMSize = pointer.To("Standard_F4s_v2")

tempNodePoolId := agentpools.NewAgentPoolID(id.SubscriptionId, id.ResourceGroupName, id.ManagedClusterName, tempNodePoolName)
tempNodePoolId := agentpools.NewAgentPoolID(originalNodePoolId.SubscriptionId, originalNodePoolId.ResourceGroupName, originalNodePoolId.ManagedClusterName, tempNodePoolName)
if err := client.CreateOrUpdateThenPoll(ctx, tempNodePoolId, *profile); err != nil {
return fmt.Errorf("creating %s: %+v", tempNodePoolId, err)
}

if err := client.DeleteThenPoll(ctx, originalNodePoolId); err != nil {
if err := client.DeleteThenPoll(ctx, *originalNodePoolId); err != nil {
return fmt.Errorf("deleting original %s: %+v", originalNodePoolId, err)
}

Expand Down

0 comments on commit 9e8e171

Please sign in to comment.