Skip to content

Commit

Permalink
Merge pull request #203 from CloudVE/add_iam_handling
Browse files Browse the repository at this point in the history
Added IAM handling for AWS and GCP
  • Loading branch information
afgane committed May 30, 2019
2 parents d8c8d5c + 74eeaad commit 122e1a2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
26 changes: 14 additions & 12 deletions cloudbridge/providers/aws/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,18 +756,20 @@ def create(self, label, image, vm_type, subnet,
self._resolve_launch_options(subnet, zone_name, vm_firewalls)

placement = {'AvailabilityZone': zone_id} if zone_id else None
inst = self.svc.create('create_instances',
ImageId=image_id,
MinCount=1,
MaxCount=1,
KeyName=key_pair_name,
SecurityGroupIds=vm_firewall_ids or None,
UserData=str(user_data) or None,
InstanceType=vm_size,
Placement=placement,
BlockDeviceMappings=bdm,
SubnetId=subnet_id
)
inst = self.svc.create(
'create_instances',
ImageId=image_id,
MinCount=1,
MaxCount=1,
KeyName=key_pair_name,
SecurityGroupIds=vm_firewall_ids or None,
UserData=str(user_data) or None,
InstanceType=vm_size,
Placement=placement,
BlockDeviceMappings=bdm,
SubnetId=subnet_id,
IamInstanceProfile=kwargs.pop('iam_instance_profile', None)
)
if inst and len(inst) == 1:
# Wait until the resource exists
# pylint:disable=protected-access
Expand Down
4 changes: 4 additions & 0 deletions cloudbridge/providers/gcp/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,10 @@ def create(self, label, image, vm_type, subnet,
'networkInterfaces': [network_interface]
}

service_accounts = kwargs.pop('service_accounts', None)
if service_accounts:
config['serviceAccounts'] = service_accounts

if vm_firewalls and isinstance(vm_firewalls, list):
vm_firewall_names = []
if isinstance(vm_firewalls[0], VMFirewall):
Expand Down

0 comments on commit 122e1a2

Please sign in to comment.