title: AWS CloudFormation function call fails: Fn::ImportValue must not depend on any resources, imported values, or Fn::GetAZs
body: <p>I have a cloud formation template (mainVPC) that creates few Subnets in a VPC and exports the subnets with names "PrivateSubnetA", "PrivateSubnetB" ...
  I have a different cloud formation template that creates DBSubnetGroup. I want to use "PrivateSubnetA", "PrivateSubnetB" as default values if user does not provide data. CloundFormation does not support imported values in parameters. So I put some default value (XXXX) and had a condition section to see if the user has provided some input</p>
  
  <pre><code>Conditions:
    userNotProvidedSubnetA: !Equals 
      - !Ref PrivateSubnetA
      - XXXX
    userNotProvidedSubnetB: !Equals 
      - !Ref PrivateSubnetB
      - XXXX
  </code></pre>
  
  <p>This helps me in figuring out if the user has provided data. Now I want to use default values, if the user has not provided values, else use user-provided values.
  below is code for that</p>
  
  <pre><code> DBSubnetGroup:
      Type: 'AWS::RDS::DBSubnetGroup'
      Properties:
        DBSubnetGroupDescription: RDS Aurora Cluster Subnet Group
        SubnetIds:
          - !If 
            - userNotProvidedSubnetA
            - Fn::ImportValue:
                  !Sub  '${fmMainVpc}-PrivateSubnetA'
            - !Ref PrivateSubnetA
          - !If 
            - userNotProvidedSubnetB
            - Fn::ImportValue:
                  !Sub '${fmMainVpc}-PrivateSubnetB'
            - !Ref PrivateSubnetB
  </code></pre>
  
  <p>This fails with the error "Template error: the attribute in Fn::ImportValue must not depend on any resources, imported values, or Fn::GetAZs".
  ImportValue is not used anywhere else in the template.</p>
  
  <p>Is there a way for using exported values as default values ( the default values cannot be hardcoded, they come as exported values from a run of another stack), while providing an option for the users to provide their own values (to create resources).</p>
  
  <p>Thanks.</p>