From 21cfcc2dfe2fdd596f076d076ffe6fe821b64ab8 Mon Sep 17 00:00:00 2001 From: sreallymatt <106555974+sreallymatt@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:38:10 -0700 Subject: [PATCH] Deprecate in 5.0 --- .../network_packet_capture_resource.go | 2 +- .../network_packet_capture_resource_test.go | 22 ++++++++----------- internal/services/network/registration.go | 10 +++++++-- website/docs/5.0-upgrade-guide.html.markdown | 16 +++++++++----- .../guides/4.0-upgrade-guide.html.markdown | 4 ---- 5 files changed, 28 insertions(+), 26 deletions(-) diff --git a/internal/services/network/network_packet_capture_resource.go b/internal/services/network/network_packet_capture_resource.go index 772bde4680b3..88c9feb75706 100644 --- a/internal/services/network/network_packet_capture_resource.go +++ b/internal/services/network/network_packet_capture_resource.go @@ -26,7 +26,7 @@ func resourceNetworkPacketCapture() *pluginsdk.Resource { Create: resourceNetworkPacketCaptureCreate, Read: resourceNetworkPacketCaptureRead, Delete: resourceNetworkPacketCaptureDelete, - DeprecationMessage: "The \"azurerm_network_packet_capture\" resource is deprecated and will be removed in favour of the `azurerm_virtual_machine_packet_capture` and `azurerm_virtual_machine_scale_set_packet_capture` resources in version 4.0 of the AzureRM Provider.", + DeprecationMessage: "The `azurerm_network_packet_capture` resource is deprecated and will be removed in favour of the `azurerm_virtual_machine_packet_capture` and `azurerm_virtual_machine_scale_set_packet_capture` resources in version 5.0 of the AzureRM Provider.", Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { _, err := packetcaptures.ParsePacketCaptureID(id) diff --git a/internal/services/network/network_packet_capture_resource_test.go b/internal/services/network/network_packet_capture_resource_test.go index 2cfe68f4af14..690e58ea7716 100644 --- a/internal/services/network/network_packet_capture_resource_test.go +++ b/internal/services/network/network_packet_capture_resource_test.go @@ -19,10 +19,9 @@ import ( type NetworkPacketCaptureResource struct{} -// todo remove for 4.0 func testAccNetworkPacketCapture_localDisk(t *testing.T) { - if features.FourPointOhBeta() { - t.Skip("this test requires 3.0 mode") + if features.FivePointOhBeta() { + t.Skip("Skipping since `azure_network_packet_capture` is deprecated and will be removed in 5.0") } data := acceptance.BuildTestData(t, "azurerm_network_packet_capture", "test") r := NetworkPacketCaptureResource{} @@ -38,10 +37,9 @@ func testAccNetworkPacketCapture_localDisk(t *testing.T) { }) } -// todo remove for 4.0 func testAccNetworkPacketCapture_requiresImport(t *testing.T) { - if features.FourPointOhBeta() { - t.Skip("this test requires 3.0 mode") + if features.FivePointOhBeta() { + t.Skip("Skipping since `azure_network_packet_capture` is deprecated and will be removed in 5.0") } data := acceptance.BuildTestData(t, "azurerm_network_packet_capture", "test") r := NetworkPacketCaptureResource{} @@ -60,10 +58,9 @@ func testAccNetworkPacketCapture_requiresImport(t *testing.T) { }) } -// todo remove for 4.0 func testAccNetworkPacketCapture_storageAccount(t *testing.T) { - if features.FourPointOhBeta() { - t.Skip("this test requires 3.0 mode") + if features.FivePointOhBeta() { + t.Skip("Skipping since `azure_network_packet_capture` is deprecated and will be removed in 5.0") } data := acceptance.BuildTestData(t, "azurerm_network_packet_capture", "test") r := NetworkPacketCaptureResource{} @@ -79,10 +76,9 @@ func testAccNetworkPacketCapture_storageAccount(t *testing.T) { }) } -// todo remove for 4.0 func testAccNetworkPacketCapture_storageAccountAndLocalDisk(t *testing.T) { - if features.FourPointOhBeta() { - t.Skip("this test requires 3.0 mode") + if features.FivePointOhBeta() { + t.Skip("Skipping since `azure_network_packet_capture` is deprecated and will be removed in 5.0") } data := acceptance.BuildTestData(t, "azurerm_network_packet_capture", "test") r := NetworkPacketCaptureResource{} @@ -101,7 +97,7 @@ func testAccNetworkPacketCapture_storageAccountAndLocalDisk(t *testing.T) { // todo remove for 4.0 func testAccNetworkPacketCapture_withFilters(t *testing.T) { if features.FourPointOhBeta() { - t.Skip("this test requires 3.0 mode") + t.Skip("Skipping since `azure_network_packet_capture` is deprecated and will be removed in 5.0") } data := acceptance.BuildTestData(t, "azurerm_network_packet_capture", "test") r := NetworkPacketCaptureResource{} diff --git a/internal/services/network/registration.go b/internal/services/network/registration.go index 400e0397702b..de4b559030db 100644 --- a/internal/services/network/registration.go +++ b/internal/services/network/registration.go @@ -4,6 +4,7 @@ package network import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) @@ -101,7 +102,7 @@ func (r Registration) SupportedDataSources() map[string]*pluginsdk.Resource { // SupportedResources returns the supported Resources supported by this Service func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { - return map[string]*pluginsdk.Resource{ + resources := map[string]*pluginsdk.Resource{ "azurerm_application_gateway": resourceApplicationGateway(), "azurerm_application_security_group": resourceApplicationSecurityGroup(), "azurerm_bastion_host": resourceBastionHost(), @@ -129,7 +130,6 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { "azurerm_network_interface_nat_rule_association": resourceNetworkInterfaceNatRuleAssociation(), "azurerm_network_interface_security_group_association": resourceNetworkInterfaceSecurityGroupAssociation(), - "azurerm_network_packet_capture": resourceNetworkPacketCapture(), "azurerm_network_profile": resourceNetworkProfile(), "azurerm_point_to_site_vpn_gateway": resourcePointToSiteVPNGateway(), "azurerm_private_endpoint": resourcePrivateEndpoint(), @@ -174,4 +174,10 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource { "azurerm_vpn_site": resourceVpnSite(), "azurerm_web_application_firewall_policy": resourceWebApplicationFirewallPolicy(), } + + if !features.FivePointOhBeta() { + resources["azurerm_network_packet_capture"] = resourceNetworkPacketCapture() + } + + return resources } diff --git a/website/docs/5.0-upgrade-guide.html.markdown b/website/docs/5.0-upgrade-guide.html.markdown index 04e287f8bda0..ebafb0c7e535 100644 --- a/website/docs/5.0-upgrade-guide.html.markdown +++ b/website/docs/5.0-upgrade-guide.html.markdown @@ -34,13 +34,9 @@ Please follow the format in the example below for adding removed resources: This deprecated resource has been superseded/retired and has been removed from the Azure Provider. ``` -### `azurerm_security_center_auto_provisioning` - -* This deprecated resource has been removed from the Azure Provider. Please see the [documention for more details](https://learn.microsoft.com/en-us/azure/defender-for-cloud/prepare-deprecation-log-analytics-mma-agent#log-analytics-agent-autoprovisioning-experience---deprecation-plan). +### `azurerm_network_packet_capture` -### `azurerm_orbital_spacecraft` - -* This deprecated resource has been retired and has been removed from the Azure Provider. +* This deprecated resource has been superseded by `azurerm_virtual_machine_packet_capture` and `azurerm_virtual_machine_scale_set_packet_capture` and has been removed from the Azure Provider. ### `azurerm_orbital_contact` @@ -50,6 +46,14 @@ This deprecated resource has been superseded/retired and has been removed from t * This deprecated resource has been retired and has been removed from the Azure Provider. +### `azurerm_orbital_spacecraft` + +* This deprecated resource has been retired and has been removed from the Azure Provider. + +### `azurerm_security_center_auto_provisioning` + +* This deprecated resource has been removed from the Azure Provider. Please see the [documention for more details](https://learn.microsoft.com/en-us/azure/defender-for-cloud/prepare-deprecation-log-analytics-mma-agent#log-analytics-agent-autoprovisioning-experience---deprecation-plan). + ## Removed Data Sources Please follow the format in the example below for adding removed data sources: diff --git a/website/docs/guides/4.0-upgrade-guide.html.markdown b/website/docs/guides/4.0-upgrade-guide.html.markdown index 85076b31d720..4ffdde810138 100644 --- a/website/docs/guides/4.0-upgrade-guide.html.markdown +++ b/website/docs/guides/4.0-upgrade-guide.html.markdown @@ -475,10 +475,6 @@ The Azure Database for MySQL Single Server will be retired on 2024-09-16 and wil The Azure Database for MySQL Single Server will be retired on 2024-09-16 and will migrate to using the Azure Database for MySQL Flexible Server, as a result this resource has been removed from the Azure Provider. -### `azurerm_network_packet_capture` - -This deprecated resource has been superseded by `azurerm_virtual_machine_packet_capture` and `azurerm_virtual_machine_scale_set_packet_capture` and has been removed from the Azure Provider. - ### `azurerm_template_deployment` This deprecated resource has been superseded by `azurerm_resource_group_template_deployment` and has been removed from the Azure Provider.