(context)
return {
      'resources': [{
          'name': base_name,
          'type': 'compute.v1.instance',
          'properties': instance
      }],
      'outputs': [{
          'name': 'address',
          'value': '$(ref.' + base_name + '.networkInterfaces[0].networkIP)'
      }]
  }
Generate configuration.
Generate configuration.
Generate configuration .
def GenerateConfig(context):
  """Generate configuration."""

  base_name = context.env['deployment'] + '-' + context.env['name']

  items = []
  for key, value in six.iteritems(context.properties['metadata']):
    items.append({
        'key': key,
        'value': value
        })

  items.append({
      'key': 'startup-script',
      'value': context.imports[context.properties['startup-script']]
      })
  metadata = {'items': items}

  # Properties for the container-based instance.
  instance = {
      'zone': context.properties['zone'],
      'machineType': ZonalComputeUrl(
          context.env['project'], context.properties['zone'], 'machineTypes',
          context.properties['machine-type']),
      'metadata': metadata,
      'disks': [{
          'deviceName': 'boot',
          'type': 'PERSISTENT',
          'autoDelete': True,
          'boot': True,
          'initializeParams': {
              'diskName': base_name + '-disk',
              'sourceImage': GlobalComputeUrl(
                  'debian-cloud', 'images',
                  'family/debian-9')
              },
          }],
      'networkInterfaces': [{
          'accessConfigs': [{
              'name': 'external-nat',
              'type': 'ONE_TO_ONE_NAT'
              }],
          'network': GlobalComputeUrl(
              context.env['project'], 'networks', 'default')
          }],
      'serviceAccounts': [{
          'email': 'default',
          'scopes': [
              'https://www.googleapis.com/auth/compute.readonly',
              'https://www.googleapis.com/auth/cloud.useraccounts.readonly',
              'https://www.googleapis.com/auth/devstorage.read_only',
              'https://www.googleapis.com/auth/logging.write',
              'https://www.googleapis.com/auth/monitoring.write'
              ]
          }]
      }

  return {
      'resources': [{
          'name': base_name,
          'type': 'compute.v1.instance',
          'properties': instance
      }],
      'outputs': [{
          'name': 'address',
          'value': '$(ref.' + base_name + '.networkInterfaces[0].networkIP)'
      }]
  }
def GenerateConfig ( context ) : base_name = context . env [ 'deployment' ] + '-' + context . env [ 'name' ] items = [ ] for key , value in six . iteritems ( context . properties [ 'metadata' ] ) : items . append ( { 'key' : key , 'value' : value } ) items . append ( { 'key' : 'startup-script' , 'value' : context . imports [ context . properties [ 'startup-script' ] ] } ) metadata = { 'items' : items } # Properties for the container-based instance. instance = { 'zone' : context . properties [ 'zone' ] , 'machineType' : ZonalComputeUrl ( context . env [ 'project' ] , context . properties [ 'zone' ] , 'machineTypes' , context . properties [ 'machine-type' ] ) , 'metadata' : metadata , 'disks' : [ { 'deviceName' : 'boot' , 'type' : 'PERSISTENT' , 'autoDelete' : True , 'boot' : True , 'initializeParams' : { 'diskName' : base_name + '-disk' , 'sourceImage' : GlobalComputeUrl ( 'debian-cloud' , 'images' , 'family/debian-9' ) } , } ] , 'networkInterfaces' : [ { 'accessConfigs' : [ { 'name' : 'external-nat' , 'type' : 'ONE_TO_ONE_NAT' } ] , 'network' : GlobalComputeUrl ( context . env [ 'project' ] , 'networks' , 'default' ) } ] , 'serviceAccounts' : [ { 'email' : 'default' , 'scopes' : [ 'https://www.googleapis.com/auth/compute.readonly' , 'https://www.googleapis.com/auth/cloud.useraccounts.readonly' , 'https://www.googleapis.com/auth/devstorage.read_only' , 'https://www.googleapis.com/auth/logging.write' , 'https://www.googleapis.com/auth/monitoring.write' ] } ] } return { 'resources' : [ { 'name' : base_name , 'type' : 'compute.v1.instance' , 'properties' : instance } ] , 'outputs' : [ { 'name' : 'address' , 'value' : '$(ref.' + base_name + '.networkInterfaces[0].networkIP)' } ] }