(context)
return {'resources': resources}
Generate Configuration.
Generate Configuration.
Generate Configuration .
def GenerateConfig(context):
  """Generate Configuration."""

  deployment = context.env['deployment']
  instance_template = deployment + '-it'
  igm = deployment + '-igm'

  resources = [{
      'name': instance_template,
      'type': 'compute.v1.instanceTemplate',
      'properties': {
          'zone': context.properties['zone'],
          'properties': {
              'machineType': 'f1-micro',
              'networkInterfaces': [{
                  'network': ''.join([URL_BASE, context.env['project'],
                                      '/global/networks/default']),
                  'accessConfigs': [{
                      'name': 'External NAT',
                      'type': 'ONE_TO_ONE_NAT'}]
              }],
              'disks': [{
                  'deviceName': 'boot',
                  'type': 'PERSISTENT',
                  'boot': True,
                  'autoDelete': True,
                  'initializeParams': {
                      'sourceImage': ''.join([URL_BASE,
                                              'debian-cloud/global/images/',
                                              'family/debian-9'])
                  }
              }]
          }
      }
  }, {
      'name': igm,
      'type': 'compute.v1.instanceGroupManager',
      'properties': {
          'baseInstanceName': deployment + '-instance',
          'instanceTemplate': ''.join(['$(ref.', instance_template,
                                       '.selfLink)']),
          'targetSize': int(context.properties['targetSize']),
          'zone': context.properties['zone']
      }
  }, {
      'name': deployment + '-as',
      'type': 'compute.v1.autoscaler',
      'properties': {
          'zone': context.properties['zone'],
          'target': '$(ref.' + igm + '.selfLink)',
          'autoscalingPolicy': {
              'maxNumReplicas': int(context.properties['maxReplicas']),
              'cpuUtilization': {
                  'utilizationTarget': 0.8
              },
              'coolDownPeriodSec': 90
          }
      }
  }]

  return {'resources': resources}
def GenerateConfig ( context ) : deployment = context . env [ 'deployment' ] instance_template = deployment + '-it' igm = deployment + '-igm' resources = [ { 'name' : instance_template , 'type' : 'compute.v1.instanceTemplate' , 'properties' : { 'zone' : context . properties [ 'zone' ] , 'properties' : { 'machineType' : 'f1-micro' , 'networkInterfaces' : [ { 'network' : '' . join ( [ URL_BASE , context . env [ 'project' ] , '/global/networks/default' ] ) , 'accessConfigs' : [ { 'name' : 'External NAT' , 'type' : 'ONE_TO_ONE_NAT' } ] } ] , 'disks' : [ { 'deviceName' : 'boot' , 'type' : 'PERSISTENT' , 'boot' : True , 'autoDelete' : True , 'initializeParams' : { 'sourceImage' : '' . join ( [ URL_BASE , 'debian-cloud/global/images/' , 'family/debian-9' ] ) } } ] } } } , { 'name' : igm , 'type' : 'compute.v1.instanceGroupManager' , 'properties' : { 'baseInstanceName' : deployment + '-instance' , 'instanceTemplate' : '' . join ( [ '$(ref.' , instance_template , '.selfLink)' ] ) , 'targetSize' : int ( context . properties [ 'targetSize' ] ) , 'zone' : context . properties [ 'zone' ] } } , { 'name' : deployment + '-as' , 'type' : 'compute.v1.autoscaler' , 'properties' : { 'zone' : context . properties [ 'zone' ] , 'target' : '$(ref.' + igm + '.selfLink)' , 'autoscalingPolicy' : { 'maxNumReplicas' : int ( context . properties [ 'maxReplicas' ] ) , 'cpuUtilization' : { 'utilizationTarget' : 0.8 } , 'coolDownPeriodSec' : 90 } } } ] return { 'resources' : resources }