title: Resource dependency issues in nested cloudformation stack
body: <p>I am receiving an error when I try to update my root stack with a new nested stack.</p>
  
  <p>Error:  "Template format error: Unresolved resource dependencies [ProjectsusgetFinancialsLF] in the Resources block of the template".</p>
  
  <p>Here is how I am passing my values to from my main stack to the nested stack:</p>
  
  <pre><code>    "Resources": {
      "FinancialStack": {
          "Type": "AWS::CloudFormation::Stack",
          "Properties": {
              "TemplateURL": "https://s3.amazonaws.com/example/child-cft.json",
              "TimeoutInMinutes": "10",
              "Parameters": {
                  "DBuser": {
                      "Ref": "DBuser"
                  },
                  "testDB": {
                      "Fn::GetAtt": [
                          "testDB",
                          "Endpoint.Address"
                      ]
                  },
                  "DBname": {
                      "Ref": "DBname"
                  },
                  "DBpass": {
                      "Ref": "DBpass"
                  },
                  "EnvType": {
                      "Ref": "EnvType"
                  },
                  "LambdaExecution": {
                      "Fn::GetAtt": [
                          "LambdaExecutionRole",
                          "Arn"
                      ]
                  },
                  "ApiGatewayRestApi": {
                      "Ref": "ApiGatewayRestApi"
                  },
                  "AuthorizerFuncApiGateway": {
                      "Ref": "AuthorizerFuncApiGatewayAuthorizer"
                  },
                  "ApiGatewayResourcePortfoliosPortfolioidVarProjectsProjectidVar" : {
                      "Ref": "ApiGatewayResourcePortfoliosPortfolioidVarProjectsProjectidVar"
                  }
              }
          },
          "DependsOn": [
              "testDB",
              "LambdaExecutionRole",
              "AuthorizerFuncApiGatewayAuthorizer",
              "ApiGatewayResourcePortfoliosPortfolioidVarProjectsProjectidVar"
          ]
      }
  </code></pre>
  
  <p>This is my child stack and the function where the error is getting thrown: </p>
  
  <pre><code>{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "AWS CloudFormation to generate test one shot deployment",
  "Parameters": {
      "DBuser": {
          "Type": "String"
      },
      "testDB": {
          "Type": "String"
      },
      "DBname": {
          "Type": "String"
      },
      "DBpass": {
          "Type": "String"
      },
      "EnvType": {
          "Type": "String"
      },
      "LambdaExecution": {
          "Type": "String"
      },
      "ApiGatewayRestApi": {
          "Type": "String"
      },
      "AuthorizerFuncApiGateway": {
          "Type": "String"
      },
      "ApiGatewayResourcePortfoliosPortfolioidVarProjectsProjectidVar": {
          "Type": "String"
      }
  },
  "Resources": {
      "ProjectsusgetProjectFinancialsLF": {
          "Type": "AWS::Lambda::Function",
          "Properties": {
              "Code": {
                  "S3Bucket": "dev",
                  "S3Key": "test-lamda.zip",
                  "S3ObjectVersion": "9eNYbcI5EOuuut9igX2xpgbGCtKD1D4K"
              },
              "Environment": {
                  "Variables": {
                      "MYSQLDB_USER": {
                          "Ref": "DBuser"
                      },
                      "MYSQLDB_HOST": {
                          "Ref": "testDB"
                      },
                      "MYSQLDB_DATABASE": {
                          "Ref": "DBname"
                      },
                      "MYSQLDB_PASSWORD": {
                          "Ref": "DBpass"
                      }
                  }
              },
              "Description": "A get project financials function",
              "FunctionName": {
                  "Fn::Join": [
                      "-",
                      [
                          {
                              "Ref": "EnvType"
                          },
                          "getProjectFinancials"
                      ]
                  ]
              },
              "Handler": "src/controllers/projects.getProjectFinancials",
              "Role": {
                  "Ref": "LambdaExecution"
              },
              "Runtime": "nodejs6.10"
          }
      },
  </code></pre>
  
  <p>I am not sure why [ProjectsusgetFinancialsLF] is having unresolved dependencies. I feel like I have provided everything required by the function. I can't figure out what is the issue. Can someone explain to me what is going wrong?</p>
  
  <p>Edit: Included the testDB resource in the root stack</p>
  
  <pre><code>"       "testDB": {
          "Type": "AWS::RDS::DBInstance",
          "Properties": {
              "DBName": {
                  "Ref": "DBname"
              },
              "DBSecurityGroups": [
                  {
                      "Ref": "DBSecurityGroup"
                  }
              ],
              "AllocatedStorage": "5",
              "DBInstanceClass": "db.t2.micro",
              "DBInstanceIdentifier": "testinst",
              "Engine": "MySQL",
              "EngineVersion": "5.7",
              "MasterUsername": {
                  "Ref": "DBuser"
              },
              "MasterUserPassword": {
                  "Ref": "DBpass"
              },
              "DBParameterGroupName": {
                  "Ref": "RDSDBParameterGroup"
              }
          }
      },"
  </code></pre>