diff --git a/mage_helpers/cdk.go b/mage_helpers/cdk.go index 6f0ce01bd47f03023d6ec230f5c3345809ca730e..11aef4a16bdb6889f81d0270d7571ce190c74ac7 100644 --- a/mage_helpers/cdk.go +++ b/mage_helpers/cdk.go @@ -7,7 +7,9 @@ import ( "io/ioutil" "os" "os/exec" + "path/filepath" "strconv" + "strings" ) func CDKCompileTypeScript(cdkDir string) error { @@ -223,6 +225,24 @@ func CDKSynthDebug(cdkDir string, env string, handler string, appName string, pr return err } + // Copy nested stack to handler_api folder + + err = filepath.Walk(cdkDir+"/cdk.out/", func(path string, info os.FileInfo, err error) error { + if strings.Contains(path, "nested.template.json") { + + filename := filepath.Base(path) + err := Copy(path, "./core/"+handler+"/"+filename) + if err != nil { + return err + } + } + + return nil + }) + if err != nil { + return err + } + return nil }