Method: Awspec::Helper::Finder::Ec2#find_subnet

Defined in:
lib/awspec/helper/finder/ec2.rb

#find_subnet(subnet_id) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/awspec/helper/finder/ec2.rb', line 39

def find_subnet(subnet_id)
  res = @ec2_client.describe_subnets({
                                       filters: [{ name: 'subnet-id', values: [subnet_id] }]
                                     })
  return res[:subnets][0] if res[:subnets].count == 1
  res = @ec2_client.describe_subnets({
                                       filters: [{ name: 'tag:Name', values: [subnet_id] }]
                                     })
  return res[:subnets][0] if res[:subnets].count == 1
end