(context)
return {
      'resources':
          resources,
      'outputs': [{
          'name': 'ip',
          'value': '$(ref.' + forwardingrule_name + '.IPAddress)'
      }]
  }
Build an internal load balancer (regionBackendService).

  Args:
    context: The context object provided by Deployment Manager.

  Returns:
    A config object for Deployment Manager (basically a dict with resources).
Build an internal load balancer (regionBackendService).
Build an internal load balancer ( regionBackendService ) .
def GenerateConfig(context):
  """Build an internal load balancer (regionBackendService).

  Args:
    context: The context object provided by Deployment Manager.

  Returns:
    A config object for Deployment Manager (basically a dict with resources).
  """

  properties = context.properties
  prefix = context.properties['region'] + '-' + context.env['deployment']

  healthcheck_name = prefix + '-healthcheck'
  loadbalancer_name = prefix + '-loadbalancer'
  forwardingrule_name = prefix + '-forwardingrule'

  resources = [{
      'name': healthcheck_name,
      'type': 'compute.v1.healthCheck',
      'properties': {
          'type': 'TCP',
          'tcpHealthCheck': {
              'port': 80
          },
      }
  }, {
      'name': loadbalancer_name,
      'type': 'compute.v1.regionBackendService',
      'properties': {
          'region': properties['region'],
          'network': properties['network'],
          'healthChecks': ['$(ref.' + healthcheck_name + '.selfLink)'],
          'backends': properties['instance-groups'],
          'protocol': 'TCP',
          'loadBalancingScheme': 'INTERNAL',
      }
  }, {
      'name': forwardingrule_name,
      'type': 'compute.v1.forwardingRule',
      'properties': {
          'ports': [80],
          'network': properties['network'],
          'subnetwork': properties['subnet'],
          'region': properties['region'],
          'backendService': '$(ref.' + loadbalancer_name + '.selfLink)',
          'loadBalancingScheme': 'INTERNAL',
      }
  }, {
      'name': prefix + '-allow-internal-lb-firewall-rule',
      'type': 'compute.v1.firewall',
      'properties': {
          'network':
              properties['network'],
          'sourceRanges': [
              '10.128.0.0/20',
          ],
          'targetTags': [properties['instance-tag']],
          'allowed': [{
              'IPProtocol': 'tcp',
              'ports': ['80']
          }, {
              'IPProtocol': 'tcp',
              'ports': ['443']
          }]
      }
  }, {
      'name': prefix + '-allow-health-check-firewall-rule',
      'type': 'compute.v1.firewall',
      'properties': {
          'network': properties['network'],
          'sourceRanges': [
              '130.211.0.0/22',
              '35.191.0.0/16',
          ],
          'targetTags': [properties['instance-tag']],
          'allowed': [{
              'IPProtocol': 'tcp'
          }]
      }
  }]

  return {
      'resources':
          resources,
      'outputs': [{
          'name': 'ip',
          'value': '$(ref.' + forwardingrule_name + '.IPAddress)'
      }]
  }
def GenerateConfig ( context ) : properties = context . properties prefix = context . properties [ 'region' ] + '-' + context . env [ 'deployment' ] healthcheck_name = prefix + '-healthcheck' loadbalancer_name = prefix + '-loadbalancer' forwardingrule_name = prefix + '-forwardingrule' resources = [ { 'name' : healthcheck_name , 'type' : 'compute.v1.healthCheck' , 'properties' : { 'type' : 'TCP' , 'tcpHealthCheck' : { 'port' : 80 } , } } , { 'name' : loadbalancer_name , 'type' : 'compute.v1.regionBackendService' , 'properties' : { 'region' : properties [ 'region' ] , 'network' : properties [ 'network' ] , 'healthChecks' : [ '$(ref.' + healthcheck_name + '.selfLink)' ] , 'backends' : properties [ 'instance-groups' ] , 'protocol' : 'TCP' , 'loadBalancingScheme' : 'INTERNAL' , } } , { 'name' : forwardingrule_name , 'type' : 'compute.v1.forwardingRule' , 'properties' : { 'ports' : [ 80 ] , 'network' : properties [ 'network' ] , 'subnetwork' : properties [ 'subnet' ] , 'region' : properties [ 'region' ] , 'backendService' : '$(ref.' + loadbalancer_name + '.selfLink)' , 'loadBalancingScheme' : 'INTERNAL' , } } , { 'name' : prefix + '-allow-internal-lb-firewall-rule' , 'type' : 'compute.v1.firewall' , 'properties' : { 'network' : properties [ 'network' ] , 'sourceRanges' : [ '10.128.0.0/20' , ] , 'targetTags' : [ properties [ 'instance-tag' ] ] , 'allowed' : [ { 'IPProtocol' : 'tcp' , 'ports' : [ '80' ] } , { 'IPProtocol' : 'tcp' , 'ports' : [ '443' ] } ] } } , { 'name' : prefix + '-allow-health-check-firewall-rule' , 'type' : 'compute.v1.firewall' , 'properties' : { 'network' : properties [ 'network' ] , 'sourceRanges' : [ '130.211.0.0/22' , '35.191.0.0/16' , ] , 'targetTags' : [ properties [ 'instance-tag' ] ] , 'allowed' : [ { 'IPProtocol' : 'tcp' } ] } } ] return { 'resources' : resources , 'outputs' : [ { 'name' : 'ip' , 'value' : '$(ref.' + forwardingrule_name + '.IPAddress)' } ] }