Skip to content

for each file in a directory #3607

Open
@skyaddict

Description

@skyaddict

With the creation of #471 there will be the ability to load content from a file. The next logical step would be to allow for each file in a folder. The file object returned should include FullName, BaseName, parent dir. Wildcarding would also be helpful. *.xls, *.liquid, etc.

Potentially something like Get_ChildItem from PowerShell.

foreach ($file in Get-ChildItem '$(Pipeline.Workspace)/Infrastructure/Schemas')

Example: I create an integration account and then need to load the Maps and schemas into this integration account. I could see something like

module map 'IntegrationAccount/IntegrationAccountMap.bicep' = [for file in getFiles('integrationAccount/maps'): {  
  scope: resourceGroup()
  name: file.BaseName
  params: {
    integrationAccountName: IntegrationAccount.outputs.name
    mapName: file.BaseName
    filePath: file.FullName
    mapType: 'Liquid'
  }
}]

Today an object with each file path and name listed does the trick, however having this be more dynamic would be excellent. and avoid missing things when they get added.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions