Skip to content

(aws-servicecatalog): Nested directories in the ProductStackHistory feature #20658

@padaszewski

Description

@padaszewski

Describe the feature

Hi,

Using the servicecatalog ProdutStackHistory I found out that there is no possibility to nest the directories for the version if the top directory does not exist. Have a look at the example:

    const productStackHistory = new ProductStackHistory(this, 'ProductStackHistory', {
      productStack: productStack,
      currentVersionName: `${versionName}-${stage}`,
      currentVersionLocked: false,
      directory: `version-snapshots/${props.configDefinition.name}`,
    })

In this example when I do not create the directory version-snapshots manually then the creation of the snapshot fails with follwing stacktrace:

Error: ENOENT: no such file or directory, mkdir 'version-snapshots/someName'
    at Object.mkdirSync (node:fs:1349:3)
    at ProductStackHistory._writeTemplateToSnapshot

Use Case

I mean there is no much effort on creating the empty directory and also some dummy file inside to do the version control on it. The product stack I have is generic and underlines a very specific account hierrchy, which I want to convert to an appropriate directories structure. But this is kind of annoying in the development process when I'm deleting the whole directory to see if all the nested directores are going to be created correctly and then I get this error. When someone from my team does it and don't know the issue then it's of course even worse for him to debug.

Proposed Solution

  1. Implement the nesting so the upper example works OR
  2. Throw an descriptive error like 'ProductStackHistory can just create one directory. Create the desired directories hierarchy manually and try again.'

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.27.0

Environment details (OS name and version, etc.)

Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-servicecatalogRelated to AWS Service CatalogbugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions