dougmoscrop/serverless-plugin-split-stacks

`replaceOutputs()` should `dependsOn` target nested stack?

vicary opened this issue · 0 comments

One of our resources in AppSync data source references a lambda ARN internally, we were adding function alias for provisioned currency.

It was all good before split stacks kicks in, until this plugin replaces my { "Fn::GetAtt": ["TheLambdaName", "Arn"] } with this format { "Fn::GetAtt": ["FunctionsNestedStack", "Outputs.TheLambdaNameArn"] }.

_.each(references, reference => {
if (reference.id in this.resourceMigrations) {
const newValue = this.nestedOutput(reference, this.resourceMigrations[reference.id]);
reference.replace(newValue);
}
});

The deployment always fail with an error of Fn::GetAtt referencing undefined resource FunctionsNestedStack when used with this plugin, I am wondering if this is caused by the lack of DependsOn to the FunctionsNestedStack from the above lines.


The whole error message as below,

An error occurred: AppSyncDataSourcesNestedStack - Template error: instance of Fn::GetAtt references undefined resource FunctionsNestedStack.

Original reference syntax,

{
  "lambdaFunctionArn": {
    "Fn::Join": [
      ":",
      [
        { "Fn::GetAtt": ["TheLambdaName", "Arn"] },
        "provisioned"
      ]
    ]
  }
}

After Split Stacks hook,

{
  "lambdaFunctionArn": {
    "Fn::Join": [
      ":",
      [
        { "Fn::GetAtt": ["FunctionsNestedStack", "Outputs.TheLambdaNameArn"] },
        "provisioned"
      ]
    ]
  }
}