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

bastionhosts - upgrade api version from 2023-11-01 to 2024-01-01 #27277

Merged
merged 1 commit into from
Sep 6, 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
4 changes: 2 additions & 2 deletions internal/services/network/bastion_host_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-11-01/bastionhosts"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2024-01-01/bastionhosts"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate"
Expand Down Expand Up @@ -104,7 +104,7 @@ func dataSourceBastionHost() *pluginsdk.Resource {
}

func dataSourceBastionHostRead(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.BastionHosts
client := meta.(*clients.Client).Network.BastionHostsClient
subscriptionId := meta.(*clients.Client).Account.SubscriptionId
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down
10 changes: 5 additions & 5 deletions internal/services/network/bastion_host_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-11-01/bastionhosts"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2024-01-01/bastionhosts"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate"
Expand Down Expand Up @@ -168,7 +168,7 @@ func resourceBastionHost() *pluginsdk.Resource {
}

func resourceBastionHostCreate(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.BastionHosts
client := meta.(*clients.Client).Network.BastionHostsClient
subscriptionId := meta.(*clients.Client).Account.SubscriptionId
ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d)
defer cancel()
Expand Down Expand Up @@ -278,7 +278,7 @@ func resourceBastionHostCreate(d *pluginsdk.ResourceData, meta interface{}) erro
}

func resourceBastionHostUpdate(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.BastionHosts
client := meta.(*clients.Client).Network.BastionHostsClient
ctx, cancel := timeouts.ForUpdate(meta.(*clients.Client).StopContext, d)
defer cancel()

Expand Down Expand Up @@ -368,7 +368,7 @@ func resourceBastionHostUpdate(d *pluginsdk.ResourceData, meta interface{}) erro
}

func resourceBastionHostRead(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.BastionHosts
client := meta.(*clients.Client).Network.BastionHostsClient
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d)
defer cancel()

Expand Down Expand Up @@ -436,7 +436,7 @@ func resourceBastionHostRead(d *pluginsdk.ResourceData, meta interface{}) error
}

func resourceBastionHostDelete(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Network.BastionHosts
client := meta.(*clients.Client).Network.BastionHostsClient
ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d)
defer cancel()

Expand Down
4 changes: 2 additions & 2 deletions internal/services/network/bastion_host_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"testing"

"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-11-01/bastionhosts"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2024-01-01/bastionhosts"
"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"
Expand Down Expand Up @@ -144,7 +144,7 @@ func (BastionHostResource) Exists(ctx context.Context, clients *clients.Client,
return nil, err
}

resp, err := clients.Network.BastionHosts.Get(ctx, *id)
resp, err := clients.Network.BastionHostsClient.Get(ctx, *id)
if err != nil {
return nil, fmt.Errorf("reading Bastion Host (%s): %+v", *id, err)
}
Expand Down
9 changes: 9 additions & 0 deletions internal/services/network/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,27 @@ import (
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/networkinterfaces"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/vmsspublicipaddresses"
network_2023_11_01 "github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-11-01"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2024-01-01/bastionhosts"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

type Client struct {
*network_2023_11_01.Client

BastionHostsClient *bastionhosts.BastionHostsClient
// VMSS Data Source requires the Network Interfaces and VMSSPublicIpAddresses client from `2023-09-01` for the `ListVirtualMachineScaleSetVMNetworkInterfacesComplete` method
NetworkInterfacesClient *networkinterfaces.NetworkInterfacesClient
VMSSPublicIPAddressesClient *vmsspublicipaddresses.VMSSPublicIPAddressesClient
}

func NewClient(o *common.ClientOptions) (*Client, error) {
BastionHostsClient, err := bastionhosts.NewBastionHostsClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building Bastion Client: %+v", err)
}
o.Configure(BastionHostsClient.Client, o.Authorizers.ResourceManager)

NetworkInterfacesClient, err := networkinterfaces.NewNetworkInterfacesClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building Network Interfaces Client: %+v", err)
Expand All @@ -42,6 +50,7 @@ func NewClient(o *common.ClientOptions) (*Client, error) {
}

return &Client{
BastionHostsClient: BastionHostsClient,
NetworkInterfacesClient: NetworkInterfacesClient,
VMSSPublicIPAddressesClient: VMSSPublicIPAddressesClient,
Client: client,
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.

Loading
Loading