Clean up around some of the new code plus tests

Adds some more tests to the plugin for coverage purposes and missed edge
cases, adds new defensive input handling in security group rule
creation, and other random cleanup.