我正在尝试创建简单的VM的基础上给出的例子在这里1。我要将自定义服务帐户2添加到此VM。我的配置如下所示
def GenerateConfig(context):
"""Create instance with disks."""
resources = [{
'type': 'compute.v1.instance',
'name': 'vm-' + context.env['deployment'],
'properties': {
'zone': context.properties['zone'],
'disks': [{
'deviceName': 'boot',
'type': 'PERSISTENT',
'boot': True,
'autoDelete': True,
'initializeParams': {
'diskName': 'disk-' + context.env['deployment'],
}
}],
'networkInterfaces': [{
'network': '...',
'subnetwork': '...',
'no-address': True,
}],
'tags':{
'items': [context.env['deployment']]
},
'service-account': ''.join(['custom-compute@',
context.env['project'],
'.iam.gserviceaccount.com']),
'scopes': ['https://www.googleapis.com/auth/devstorage.read_only',
'https://www.googleapis.com/auth/logging.write',
'https://www.googleapis.com/auth/monitoring.write',
'https://www.googleapis.com/auth/trace.append']
}
}]
return {'resources': resources}我能够成功地创建部署。但是,当我描述新创建的实例时,它没有任何与vm相关联的"service-account“。
我找不到任何将service-account添加到部署管理器模板的示例。我也尝试过使用"serviceAccount“键而不是”service-account“,但没有成功。有人知道我错过了什么吗?
发布于 2018-04-25 11:01:27
我找到了参考DM reference docs。所需的更改包括
'serviceAccounts': [{
'email': '....',
'scopes': '...'
}]https://stackoverflow.com/questions/50012946
复制相似问题