Skip to content

Commit

Permalink
azurerm_network_packet_capture - deprecate resource for 5.0 (#28324)
Browse files Browse the repository at this point in the history
* Deprecate  `azurerm_network_packet_capture` in 5.0

* Update feature flag in test
  • Loading branch information
sreallymatt authored Dec 18, 2024
1 parent 4913b97 commit 7743928
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
25 changes: 10 additions & 15 deletions internal/services/network/network_packet_capture_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand All @@ -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{}
Expand All @@ -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{}
Expand All @@ -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{}
Expand All @@ -98,10 +94,9 @@ 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")
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{}
Expand Down
10 changes: 8 additions & 2 deletions internal/services/network/registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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
}
16 changes: 10 additions & 6 deletions website/docs/5.0-upgrade-guide.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand All @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions website/docs/guides/4.0-upgrade-guide.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7743928

Please sign in to comment.