Skip to content

Commit

Permalink
Fix PeeringConnection:
Browse files Browse the repository at this point in the history
When we have a vpc that belongs to some other account, we can't lookup it.
  • Loading branch information
joaogbcravo committed Dec 15, 2015
1 parent 8895678 commit 01de6a5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/chef/provider/aws_vpc_peering_connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ def create_aws_object

options = {}
options[:vpc_id] = new_resource.vpc
options[:peer_vpc_id] = new_resource.peer_vpc
options[:peer_owner_id] = new_resource.peer_owner_id unless new_resource.peer_owner_id.nil?
options = AWSResource.lookup_options(options, resource: new_resource)

if new_resource.peer_owner_id.nil?
options[:peer_vpc_id] = new_resource.peer_vpc
options = AWSResource.lookup_options(options, resource: new_resource)
else
options = AWSResource.lookup_options(options, resource: new_resource)
options[:peer_vpc_id] = new_resource.peer_vpc
options[:peer_owner_id] = new_resource.peer_owner_id
end

ec2_resource = new_resource.driver.ec2_resource
vpc = ec2_resource.vpc(options[:vpc_id])
Expand Down

0 comments on commit 01de6a5

Please sign in to comment.