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

New Resource: azurerm_packet_capture #1044

Merged
merged 3 commits into from
Apr 3, 2018
Merged

New Resource: azurerm_packet_capture #1044

merged 3 commits into from
Apr 3, 2018

Conversation

tombuildsstuff
Copy link
Contributor

Adds support for Packet Capturing from Virtual Machines using a Network Watcher

Since this is reliant on the VM Extension and the Network Watcher (and we can only provision one per region at a time) - I've added this to the Network Watcher test case

@tombuildsstuff tombuildsstuff added this to the 1.3.2 milestone Mar 29, 2018
@tombuildsstuff tombuildsstuff changed the title New Resource: azurerm_packet_capture [WIP] New Resource: azurerm_packet_capture Mar 29, 2018
@tombuildsstuff tombuildsstuff force-pushed the packet-capture branch 4 times, most recently from f7eb7a9 to 190cf57 Compare March 30, 2018 18:51
@tombuildsstuff tombuildsstuff changed the title [WIP] New Resource: azurerm_packet_capture New Resource: azurerm_packet_capture Mar 30, 2018
@tombuildsstuff
Copy link
Contributor Author

Tests pass:

screen shot 2018-03-30 at 16 43 51

@tombuildsstuff tombuildsstuff requested a review from a team March 30, 2018 20:45
resp, err := client.Get(ctx, resourceGroup, watcherName, name)
if err != nil {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpick: missing logging message, e.g. log.Printf("[WARN] Packet Capture (%s) not found - removing from state", id)

Steps: []resource.TestStep{
{
Config: testAzureRMPacketCapture_localDiskConfig(ri, location),
Check: resource.ComposeTestCheckFunc(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpick: should we be ensuring any attributes are correctly in state? e.g.

resource.TestCheckResourceAttr(resourceName, "storage_location.#", "1"),
resource.TestCheckResourceAttr(resourceName, "storage_location.0.file_path", "/var/captures/packet.cap"),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we’ve been leaning on the Import tests to achieve that, since it’s comparing the config anyway - rather than duplicating these values; but I can change this if you want?

}

resource "azurerm_virtual_network" "test" {
name = "production-network"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpick: should terraform fmt the examples to make them easier to read

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


* `local_port` - (Optional) The local port to be filtered on. Notation: "80" for single port entry."80-85" for range. "80;443;" for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Changing this forces a new resource to be created.

* `protocol` - (Required) The Protocol to be filtered on. Possible values include `Any`, `TCP` and ``UDP`. Changing this forces a new resource to be created.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: Double backticks before UDP

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


A `filter` block contains:

* `local_ip_address` - (Optional) The local IP Address to be filtered on. Notation: "127.0.0.1" for single address entry. "127.0.0.1-127.0.0.255" for range. "127.0.0.1;127.0.0.5"? for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Changing this forces a new resource to be created.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extraneous ? before for multiple entries

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's actually a copy and paste from the Microsoft Documentation

screen shot 2018-04-03 at 08 16 01

but yes, I'd agree let's remove it


* `maximum_bytes_per_packet` - (Optional) The number of bytes captured per packet. The remaining bytes are truncated. Defaults to `0` (Entire Packet Captured). Changing this forces a new resource to be created.

* `maximum_bytes_per_session` - (Optional) Maximum size of the capture in Bytes. Defaults to `10737441824` (1GB). Changing this forces a new resource to be created.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: default does not match what is defined in the schema: 1073741824

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed in the portal this should be 1073741824 - will fix

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@tombuildsstuff tombuildsstuff removed the request for review from radeksimko April 3, 2018 12:37
@tombuildsstuff tombuildsstuff merged commit a447c30 into master Apr 3, 2018
@tombuildsstuff tombuildsstuff deleted the packet-capture branch April 3, 2018 12:37
tombuildsstuff added a commit that referenced this pull request Apr 3, 2018
@ghost
Copy link

ghost commented Mar 31, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants