aws-inventory 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddf2d81ae755cef42708352f2ff90d1aa939313c
4
- data.tar.gz: a55cb8f7ae1aeaddd46b94569a9b0c3a8e054ffc
3
+ metadata.gz: 54f7eb62f72d45cf758bcae5ebab0ad2da793397
4
+ data.tar.gz: 2adba14a03a08557e60c2f33752f80c1383c8bd8
5
5
  SHA512:
6
- metadata.gz: 72aaff05c6cf39d6abc233757338c0311e234d696a2e413c152c930d78201ba3acdd298c8bda86b54c482e1f29375f102c4921f5c50c64bd75481b35baec116b
7
- data.tar.gz: 1b317e030f213585ef8ca8093fe843a2f1754fc9b99eacf122c70248061cd64088552000fa44266b9812acfddc0cff18049ee6d27666128b6fd3360b5eb36406
6
+ metadata.gz: 55ed6c3db50420cf2b98731ad1f1f7074e8e8a66b1fd66e62d3728c229aab221c754e437e142ab9a09d58541779b4a3e4b2d79870644163fadf186ac3d659e17
7
+ data.tar.gz: 5da8014d494ea64e80cf7423d9370e7dca653e0fcd277212f64cc892a08b1adfe1ebacfdc73648661ff8975dd8a12fd76a6b333d0f1e10d640360378d614f6c5
@@ -3,6 +3,9 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.4.3]
7
+ * account for elbs using security groups
8
+
6
9
  ## [0.4.2]
7
10
  * sg unused report prints out group_id instead of vpc_id
8
11
 
@@ -1,10 +1,19 @@
1
1
  module AwsInventory::SecurityGroup::Shared
2
2
  def used_security_groups
3
3
  groups = instances.inject([]) do |results, i|
4
- results += i.security_groups
4
+ results += i.security_groups # returns Aws::EC2::Types::GroupIdentifier
5
5
  results
6
6
  end
7
- groups.uniq(&:group_id)
7
+ instance_groups = groups.uniq(&:group_id)
8
+
9
+ v1_group_ids = elbv1.describe_load_balancers.load_balancer_descriptions.map(&:security_groups).flatten
10
+ v2_group_ids = elbv2.describe_load_balancers.load_balancers.map(&:security_groups).flatten
11
+ group_ids = v1_group_ids + v2_group_ids
12
+ elb_groups = ec2.describe_security_groups(group_ids: group_ids).security_groups # returns Aws::EC2::Types::SecurityGroup
13
+
14
+ # Ducktyping: the types are different by they both respond to the group_id method.
15
+ all_groups = instance_groups + elb_groups
16
+ all_groups.uniq(&:group_id)
8
17
  end
9
18
 
10
19
  def unused_security_groups
@@ -1,3 +1,3 @@
1
1
  module AwsInventory
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-inventory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-03 00:00:00.000000000 Z
11
+ date: 2018-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor