<!-- Love localstack? Please consider supporting our collective:
👉  https://opencollective.com/localstack/donate -->

# Type of request: This is a ...

[ X ] bug report
[ ] feature request

# Detailed description

When using an intrinsic function (e.g. Sub, Join) within the AWS::Lambda::Function FunctionName property, any resources dependent on that Lambda function fail to successfully deploy, as they appear unable to resolve the function ARN.

All the below permutations should work.

Note there are no dependent resources in the below snippet, please refer to attached example.

```
Parameters:
  Environment:
    Type: string
    Description: Environment name
    Default: ''
Resources: 
  ...
  ConnectionHandlerLambdaFunction:
    Type: AWS::Lambda::Function
    Properties:
      ...
      # I work.
      FunctionName: localstack-websockets-dev-connectionHandler
      # I do not work.
      FunctionName: !Sub localstack-websockets-${Environment}-connectionHandler
      # I do not work.
      FunctionName:
        Fn::Sub: localstack-websockets-${Environment}-connectionHandler
      # I do not work.
      FunctionName:
        Fn::Sub: 
        - localstack-websockets-${Environment}-connectionHandler
        - {}
      # I do not work.
      FunctionName:
        Fn::Join: 
        - ''
        - - localstack-websockets
          - Ref: Environment
          - connectionHandler
```

## Expected behavior

Sub / Join should work as per AWS functionality.

## Actual behavior

The stack fails to deploy as not all resources can be deployed.

The following log entries appear:

```
2020-12-01T00:26:14:DEBUG:localstack.services.cloudformation.cloudformation_starter: Currently processing (update=False) resource serverless-websockets/testDashactionWebsocketsRoute: None
localstack_main   | 2020-12-01T00:26:14:DEBUG:localstack.utils.cloudformation.template_deployer: Extract resource attribute: ApiGatewayV2::Api PhysicalResourceId
localstack_main   | 2020-12-01T00:26:14:DEBUG:localstack.utils.cloudformation.template_deployer: Extract resource attribute: Lambda::Function Arn
localstack_main   | 2020-12-01T00:26:14:WARNING:localstack.utils.cloudformation.template_deployer: Unexpected error retrieving details for resource ApiGatewayV2::Integration: expected string or bytes-like object Traceback (most recent call last):
localstack_main   |   File "/opt/code/localstack/.venv/lib/python3.8/site-packages/localstack_ext/services/cloudformation/cloudformation_extended.py", line 272, in retrieve_resource_details
localstack_main   |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1149, in resolve_refs_recursively
localstack_main   |     join_values = [resolve_refs_recursively(stack_name, v, resources) for v in join_values]
localstack_main   |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1149, in <listcomp>
localstack_main   |     join_values = [resolve_refs_recursively(stack_name, v, resources) for v in join_values]
localstack_main   |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1145, in resolve_refs_recursively
localstack_main   |     return resolve_ref(stack_name, value[keys_list[0]][0], resources, attribute=value[keys_list[0]][1])
localstack_main   |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1129, in resolve_ref
localstack_main   |     result = extract_resource_attribute(resource_type, resource_new, attribute, resource_id=ref, resource=resource)
localstack_main   |   File "/opt/code/localstack/localstack/utils/cloudformation/template_deployer.py", line 1046, in extract_resource_attribute
localstack_main   |     return func_configs.get('FunctionArn') or aws_stack.lambda_function_arn(func_configs.get('FunctionName'))
localstack_main   |   File "/opt/code/localstack/localstack/utils/aws/aws_stack.py", line 389, in lambda_function_arn
localstack_main   |     return lambda_function_or_layer_arn('function', function_name, account_id=account_id, region_name=region_name)
localstack_main   |   File "/opt/code/localstack/localstack/utils/aws/aws_stack.py", line 398, in lambda_function_or_layer_arn
localstack_main   |     if re.match(pattern, entity_name):
localstack_main   |   File "/usr/lib/python3.8/re.py", line 189, in match
localstack_main   |     return _compile(pattern, flags).match(string)
localstack_main   | TypeError: expected string or bytes-like object
localstack_main   |  - {'Type': 'AWS::ApiGatewayV2::Integration', 'Properties': {'ApiId': {'Ref': 'WebsocketsApi'}, 'IntegrationType': 'AWS_PROXY', 'IntegrationUri': {'Fn::Join': ['', ['arn:', {'Ref': 'AWS::Partition'}, ':apigateway:', {'Ref': 'AWS::Region'}, ':lambda:path/2015-03-31/functions/', {'Fn::GetAtt': ['ActionHandlerLambdaFunction', 'Arn']}, '/invocations']]}}} {}
...
localstack_name   |Exception: Unable to resolve all CloudFormation resources after traversing dependency tree (maximum depth 40): ['SdefaultWebsocketsRoute', 'SconnectWebsocketsRoute', 'SdisconnectWebsocketsRoute', 'testDashactionWebsocketsRoute', 'WebsocketsDeploymentStage', 'WebsocketsDeploymentfL6JMF7jePzZNmpbxmED780n2EOusDnLIjNfLpcX8']
```

# Steps to reproduce

[serverless-websockets-intrinsic-functions.zip](https://github.com/localstack/localstack/files/5619518/serverless-websockets-intrinsic-functions.zip)

Download / unzip example.

1. Start localstack.
2. Run `deploy-working.sh`. You should see the stack successfully deploy.
3. Restart localstack.
4. Run `deploy-broken.sh`. You should see error entries in the logs.

## Command used to start LocalStack

`docker-compose up`

docker-compose.yml:
```
version: '2.1'

# networks:
#   local:
#     driver: bridge
services:
  localstack:
    container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
    image: localstack/localstack
    ports:
      - "4566:4566"
      - "4510:4510"
      - "4571:4571"
      - "4572:4572"
      - "4513:4513"
      - "4514:4514"
      - "${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}"
    environment:
      - SERVICES=${SERVICES- }
      - DATA_DIR=${DATA_DIR- }
      - PORT_WEB_UI=${PORT_WEB_UI- }
      - LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR- }
      - KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY- }
      - DOCKER_HOST=unix:///var/run/docker.sock
      - HOST_TMP_FOLDER=${TMPDIR}
      - LOCALSTACK_API_KEY=...
      - DEBUG=1
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
    tmpfs:
      - /tmp/localstack:exec,mode=600
    network_mode: bridge
  dynamodb-admin:
    depends_on:
      - localstack
    image: aaronshaf/dynamodb-admin
    ports:
      - 8001:8001
    environment:
      - DYNAMO_ENDPOINT=http://localstack:4566
      - AWS_REGION=ap-southeast-2
      - AWS_ACCESS_KEY_ID=local
      - AWS_SECRET_ACCESS_KEY=local
    links:
      - localstack
    network_mode: bridge
```

## Client code (AWS SDK code snippet, or sequence of "awslocal" commands)

...

stack_name = kwargs.get('stack_name', 'stack')
    nested_stack_name = '%s-%s' % (stack_name, common.short_uid())
    stack_params = params.get('Parameters', {})
    stack_params = [{'ParameterKey': k, 'ParameterValue': v} for k, v in stack_params.items()]
    result = {
        'StackName': nested_stack_name,
        'TemplateURL': params.get('TemplateURL'),
        'Parameters': stack_params
    }
    return result
def get_lambda_code_param(params, **kwargs):
    code = params.get('Code', {})
    zip_file = code.get('ZipFile')
    if zip_file and not common.is_base64(zip_file):
        tmp_dir = common.new_tmp_dir()
        handler_file = get_handler_file_from_name(params['Handler'], runtime=params['Runtime'])
        tmp_file = os.path.join(tmp_dir, handler_file)
        common.save_file(tmp_file, zip_file)
        zip_file = create_zip_file(tmp_file, get_content=True)
        code['ZipFile'] = zip_file
        common.rm_rf(tmp_dir)
    return code
def sns_subscription_params(params, **kwargs):