Class: Chef::Resource::AwsInternetGateway

Overview

An AWS internet gateway, allowing communication between instances inside a VPC and the internet.

‘name` is not guaranteed unique for an AWS account; therefore, Chef will store the internet gateway ID associated with this name in your Chef server in the data bag `data/aws_internet_gateway/<name>`.

API documentation for the AWS Ruby SDK for VPCs (and the object returned from ‘aws_object` can be found here:

Constant Summary

Constants inherited from Provisioning::AWSDriver::AWSResource

Provisioning::AWSDriver::AWSResource::NOT_PASSED

Instance Method Summary collapse

Methods included from Provisioning::AWSDriver::AWSTaggable

included

Methods inherited from Provisioning::AWSDriver::AWSResourceWithEntry

#delete_managed_entry, #get_id_from_managed_entry, #save_managed_entry, #to_s

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

#_pv_is, attribute, lazy

Constructor Details

This class inherits a constructor from Chef::Provisioning::AWSDriver::AWSResource

Instance Method Details

#aws_objectObject



43
44
45
46
47
48
# File 'lib/chef/resource/aws_internet_gateway.rb', line 43

def aws_object
  driver, id = get_driver_and_id
  ec2_resource = ::Aws::EC2::Resource.new(driver.ec2)
  result = ec2_resource.internet_gateway(id) if id
  result && exists?(result) ? result : nil
end

#exists?(result) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
53
54
# File 'lib/chef/resource/aws_internet_gateway.rb', line 50

def exists?(result)
  return true if result.data
rescue ::Aws::EC2::Errors::InvalidInternetGatewayIDNotFound
  false
end