1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

fix-vpc-tenancy

This commit is contained in:
Ramon de Paula Marques 2019-08-14 13:13:53 -03:00
parent c534ef3194
commit 2fe60ddb59
3 changed files with 15 additions and 3 deletions

View file

@ -106,7 +106,13 @@ module Fog
def save
requires :cidr_block
data = service.create_vpc(cidr_block, { 'AmazonProvidedIpv6CidrBlock' => amazon_provided_ipv_6_cidr_block }).body['vpcSet'].first
options = {
'AmazonProvidedIpv6CidrBlock' => amazon_provided_ipv_6_cidr_block,
'InstanceTenancy' => tenancy
}
data = service.create_vpc(cidr_block, options).body['vpcSet'].first
new_attributes = data.reject {|key,value| key == 'requestId'}
new_attributes = data.reject {|key,value| key == 'requestId' || key == 'tagSet' }
merge_attributes(new_attributes)

View file

@ -11,7 +11,6 @@ module Fog
# * options<~Hash>:
# * InstanceTenancy<~String> - The allowed tenancy of instances launched into the VPC. A value of default
# means instances can be launched with any tenancy; a value of dedicated means instances must be launched with tenancy as dedicated.
# please not that the documentation is incorrect instanceTenancy will not work while InstanceTenancy will
#
# === Returns
# * response<~Excon::Response>:
@ -54,7 +53,8 @@ module Fog
'classicLinkEnabled' => false,
'classicLinkDnsSupport' => false,
'cidrBlockAssociationSet' => [{ 'cidrBlock' => cidrBlock, 'state' => 'associated', 'associationId' => "vpc-cidr-assoc-#{vpc_id}" }],
'ipv6CidrBlockAssociationSet' => []
'ipv6CidrBlockAssociationSet' => [],
'instanceTenancy' => options['InstanceTenancy'] || 'default'
}
self.data[:vpcs].push(vpc)

View file

@ -68,6 +68,12 @@ Shindo.tests('Fog::Compute[:aws] | vpc requests', ['aws']) do
data
end
tests("#create_vpc('10.255.254.0/28', {'InstanceTenancy' => 'dedicated'})").returns('dedicated') do
data = Fog::Compute[:aws].create_vpc('10.255.254.0/28',
{'InstanceTenancy' => 'dedicated'}).body
data['vpcSet'].first['instanceTenancy']
end
tests('#describe_vpcs').formats(@describe_vpcs_format) do
Fog::Compute[:aws].describe_vpcs.body
end