ec2_group: Fix error "global name 'group' is not defined"

The error happened when creating a security group that references itself. This
is fixed by adding the new group to the `groups` dict as soon as it is created.