def get_forwarding_rule(properties, target, res_name, project_id):
    ' Creates the forwarding rule. '
    name = '{}-forwarding-rule'.format(res_name)
    rule_properties = {'name': properties.get('name', res_name), 'project': project_id, 'loadBalancingScheme': 'EXTERNAL', 'target': '$(ref.{}.selfLink)'.format(target['name']), 'IPProtocol': 'TCP'}
    rule_resource = {'name': name, 'type': 'forwarding_rule.py', 'properties': rule_properties, 'metadata': {'dependsOn': [target['name']]}}
    optional_properties = ['description', 'IPAddress', 'ipVersion', 'portRange']
    for prop in optional_properties:
        set_optional_property(rule_properties, properties, prop)
    return ([rule_resource], [{'name': 'forwardingRuleName', 'value': rule_properties['name']}, {'name': 'forwardingRuleSelfLink', 'value': '$(ref.{}.selfLink)'.format(name)}, {'name': 'IPAddress', 'value': '$(ref.{}.IPAddress)'.format(name)}])
Creates the forwarding rule.
def get_forwarding_rule(properties, target, res_name, project_id):
    '  '
    name = '{}-forwarding-rule'.format(res_name)
    rule_properties = {'name': properties.get('name', res_name), 'project': project_id, 'loadBalancingScheme': 'EXTERNAL', 'target': '$(ref.{}.selfLink)'.format(target['name']), 'IPProtocol': 'TCP'}
    rule_resource = {'name': name, 'type': 'forwarding_rule.py', 'properties': rule_properties, 'metadata': {'dependsOn': [target['name']]}}
    optional_properties = ['description', 'IPAddress', 'ipVersion', 'portRange']
    for prop in optional_properties:
        set_optional_property(rule_properties, properties, prop)
    return ([rule_resource], [{'name': 'forwardingRuleName', 'value': rule_properties['name']}, {'name': 'forwardingRuleSelfLink', 'value': '$(ref.{}.selfLink)'.format(name)}, {'name': 'IPAddress', 'value': '$(ref.{}.IPAddress)'.format(name)}])