Skip to content

Commit

Permalink
New Resource: azurerm_packet_capture
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed Mar 30, 2018
1 parent 70fc814 commit 190cf57
Show file tree
Hide file tree
Showing 8 changed files with 951 additions and 0 deletions.
5 changes: 5 additions & 0 deletions azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ type ArmClient struct {
ifaceClient network.InterfacesClient
loadBalancerClient network.LoadBalancersClient
localNetConnClient network.LocalNetworkGatewaysClient
packetCapturesClient network.PacketCapturesClient
publicIPClient network.PublicIPAddressesClient
routesClient network.RoutesClient
routeTablesClient network.RouteTablesClient
Expand Down Expand Up @@ -737,6 +738,10 @@ func (c *ArmClient) registerNetworkingClients(endpoint, subscriptionId string, a
c.configureClient(&networksClient.Client, auth)
c.vnetClient = networksClient

packetCapturesClient := network.NewPacketCapturesClientWithBaseURI(endpoint, subscriptionId)
c.configureClient(&packetCapturesClient.Client, auth)
c.packetCapturesClient = packetCapturesClient

peeringsClient := network.NewVirtualNetworkPeeringsClientWithBaseURI(endpoint, subscriptionId)
c.configureClient(&peeringsClient.Client, auth)
c.vnetPeeringsClient = peeringsClient
Expand Down
33 changes: 33 additions & 0 deletions azurerm/import_arm_packet_capture_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package azurerm

import (
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)

func testAccAzureRMPacketCapture_importBasic(t *testing.T) {
rInt := acctest.RandInt()
rString := acctest.RandString(6)
location := testLocation()

resourceName := "azurerm_packet_capture.test"
config := testAzureRMPacketCapture_storageAccountAndLocalDiskConfig(rInt, rString, location)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMPacketCaptureDestroy,
Steps: []resource.TestStep{
{
Config: config,
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
1 change: 1 addition & 0 deletions azurerm/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ func Provider() terraform.ResourceProvider {
"azurerm_network_security_group": resourceArmNetworkSecurityGroup(),
"azurerm_network_security_rule": resourceArmNetworkSecurityRule(),
"azurerm_network_watcher": resourceArmNetworkWatcher(),
"azurerm_packet_capture": resourceArmPacketCapture(),
"azurerm_policy_definition": resourceArmPolicyDefinition(),
"azurerm_postgresql_configuration": resourceArmPostgreSQLConfiguration(),
"azurerm_postgresql_database": resourceArmPostgreSQLDatabase(),
Expand Down
7 changes: 7 additions & 0 deletions azurerm/resource_arm_network_watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ func TestAccAzureRMNetworkWatcher(t *testing.T) {
"importBasic": testAccAzureRMNetworkWatcher_importBasic,
"importComplete": testAccAzureRMNetworkWatcher_importComplete,
},
"PacketCapture": {
"import": testAccAzureRMPacketCapture_importBasic,
"localDisk": testAccAzureRMPacketCapture_localDisk,
"storageAccount": testAccAzureRMPacketCapture_storageAccount,
"storageAccountAndLocalDisk": testAccAzureRMPacketCapture_storageAccountAndLocalDisk,
"withFilters": testAccAzureRMPacketCapture_withFilters,
},
}

for group, m := range testCases {
Expand Down
Loading

0 comments on commit 190cf57

Please sign in to comment.