     :CreateSecurityGroup (create params)
     (get-request (merge params {"Action" (name action)}))))
 
+(defn- filter-params
+  [name vpc-id]
+  {"Filter.1.Name" "group-name"
+   "Filter.1.Value" name
+   "Filter.2.Name" "vpc-id"
+   "Filter.2.Value" vpc-id})
+
 (defn- retrieve-sg-id [name vpc-id]
-  (xml1-> (process :DescribeSecurityGroups {"Filter.1.Name" "group-name"
-                                              "Filter.1.Value" name
-                                              "Filter.2.Name" "vpc-id"
-                                              "Filter.2.Value" vpc-id})
+  (xml1-> (process :DescribeSecurityGroups (filter-params name vpc-id))
           :securityGroupInfo :item :groupId text))
 
 (defn- sg-rule


(defn- delete-sg
  [name vpc-id]
  (if-let [id (sg-id name vpc-id)]
    (do
      (process :DeleteSecurityGroup {"GroupId" id})
      (cf/info  (str "I've succesfully deleted the security group '" name "' with id: " id)))))

(defn- build-sg
  [opts]
  (delete-sg (:GroupName opts) (:VpcId opts))
  (if-let [sg-id (create opts)]
    (try+
     (do

     (catch map? error
       (delete-sg (:GroupName opts) (:VpcId opts))
       (throw+ error)))))

(defn- update-sg-id
  [name vpc-id]
