title: AWS CloudFormation: Combining ImportValue and Sub functions causes error
body: <p>When uploading my template to CloudFormation I am receiving the following validation error:</p>
  <blockquote>
  <p>Template validation error: Template error: the attribute in
  Fn::ImportValue must not depend on any resources, imported values, or
  Fn::GetAZs</p>
  </blockquote>
  <p>I have a test template below that reproduces the issue:</p>
  <pre class="lang-yaml prettyprint-override"><code>Resources:
    EC2Instance:
      Type: &quot;AWS::EC2::Instance&quot;
      Properties:
        ImageId: ami-3bfab942
        InstanceType: t2.micro
        KeyName: mykeypair
        UserData:
          &quot;Fn::Base64&quot;:
            !Sub |
              #!/bin/bash
              yum update -y aws-cfn-bootstrap
              /opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource EC2Instance --configsets testset --region ${AWS::Region}
              yum -y update
      Metadata:
        AWS::CloudFormation::Init:
          configSets:
            testset:
              - &quot;testConfiguration&quot;
          testConfiguration:
            commands: 
              CreateTestFile:
                cwd: &quot;~&quot;
                command: 
                  &quot;Fn::ImportValue&quot;: 
                    !Sub | 
                      touch ${myexport}
  </code></pre>
  <p>To keep things as simple as I can I'm basically trying to create a bash command using the export. So in the above example I want to create a file named based on what the export value is. I don't understand the error message in the context of what I'm trying to do. I've validated that the export exists in another stack that I've created.</p>