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

applicationgateways - update to use hashicorp/go-azure-sdk #25844

Merged
merged 4 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
298 changes: 152 additions & 146 deletions internal/services/network/application_gateway_data_source.go

Large diffs are not rendered by default.

1,715 changes: 799 additions & 916 deletions internal/services/network/application_gateway_resource.go

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions internal/services/network/application_gateway_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import (
"testing"
"time"

"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/applicationgateways"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/utils"
"github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network"
Expand Down Expand Up @@ -1322,17 +1323,17 @@ func TestAccApplicationGateway_removeFirewallPolicy(t *testing.T) {
}

func (t ApplicationGatewayResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
id, err := parse.ApplicationGatewayID(state.ID)
id, err := applicationgateways.ParseApplicationGatewayID(state.ID)
if err != nil {
return nil, err
}

resp, err := clients.Network.ApplicationGatewaysClient.Get(ctx, id.ResourceGroup, id.Name)
resp, err := clients.Network.Client.ApplicationGateways.Get(ctx, *id)
if err != nil {
return nil, fmt.Errorf("reading Application Gateway (%s): %+v", id, err)
return nil, fmt.Errorf("retrieving %s: %+v", id, err)
}

return utils.Bool(resp.ID != nil), nil
return pointer.To(resp.Model != nil), nil
}

func (r ApplicationGatewayResource) basic(data acceptance.TestData) string {
Expand Down
17 changes: 16 additions & 1 deletion internal/services/network/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package client
import (
"fmt"

network_2022_07_01 "github.com/hashicorp/go-azure-sdk/resource-manager/network/2022-07-01"
network_2023_09_01 "github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
Expand All @@ -15,6 +16,13 @@ import (
type Client struct {
*network_2023_09_01.Client

// This additional version has been added to facilitate migration of the remaining network
// resources to `hashicorp/go-azure-sdk` because upgrading directly to 2023-09-01 will have introduced
// breaking changes
// TODO 4.0 the following resources/data sources should be updated to use 2023-09-01 just prior to releasing 4.0:
// `azurerm_application_gateway` (resource and data source)
V20220701Client *network_2022_07_01.Client
stephybun marked this conversation as resolved.
Show resolved Hide resolved

// Usages of the clients below use `Azure/azure-sdk-for-go` and should be updated
// to use `hashicorp/go-azure-sdk` (available above).
ApplicationGatewaysClient *network.ApplicationGatewaysClient
Expand Down Expand Up @@ -179,8 +187,15 @@ func NewClient(o *common.ClientOptions) (*Client, error) {
return nil, fmt.Errorf("building clients for Network: %+v", err)
}

v20220701Client, err := network_2022_07_01.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) {
o.Configure(c, o.Authorizers.ResourceManager)
})
if err != nil {
return nil, fmt.Errorf("building 2022-07-01 clients for Network: %+v", err)
}
return &Client{
Client: client,
Client: client,
V20220701Client: v20220701Client,

ApplicationGatewaysClient: &ApplicationGatewaysClient,
CustomIPPrefixesClient: &customIpPrefixesClient,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading