Class: Chef::Resource::AwsSecurityGroup
- Inherits:
-
Provisioning::AWSDriver::AWSResource
- Object
- LWRPBase
- Provisioning::AWSDriver::SuperLWRP
- Provisioning::AWSDriver::AWSResource
- Chef::Resource::AwsSecurityGroup
- Includes:
- Provisioning::AWSDriver::AWSTaggable
- Defined in:
- lib/chef/resource/aws_security_group.rb
Constant Summary
Constants inherited from Provisioning::AWSDriver::AWSResource
Provisioning::AWSDriver::AWSResource::NOT_PASSED
Instance Method Summary collapse
Methods included from Provisioning::AWSDriver::AWSTaggable
Methods inherited from Provisioning::AWSDriver::AWSResource
#action, #action=, #aws_object_id, get_aws_object, get_aws_object_id, #initialize, lookup_options
Methods inherited from Provisioning::AWSDriver::SuperLWRP
Constructor Details
This class inherits a constructor from Chef::Provisioning::AWSDriver::AWSResource
Instance Method Details
#aws_object ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/chef/resource/aws_security_group.rb', line 56 def aws_object if security_group_id result = driver.ec2.security_groups[security_group_id] else # Names are unique within a VPC. Try to search by name and narroy by VPC, if # provided if vpc vpc_object = Chef::Resource::AwsVpc.get_aws_object(vpc, resource: self) results = vpc_object.security_groups.filter('group-name', name).to_a else results = driver.ec2.security_groups.filter('group-name', name).to_a end if results.size >= 2 raise ::Chef::Provisioning::AWSDriver::Exceptions::MultipleSecurityGroupError.new(name, results) end result = results.first end result && result.exists? ? result : nil end |