Azure / Azure/bicep

VS Code Extension not recognizing deploymentScript changes in Module (loadTextContent())

Open
#11,225 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

**Bicep version**
bicep --version: 0.16.2
Bicep VS Code Extension Version: 0.18.4

**Describe the bug**
When a deploymentScripts resource is called from a module and the .ps1 file changes, the extension command to build or publish the template ignores the changes. When executing ```biceps build```, the change is considered.

This bug only occurs when the script is referenced from a module. When the deploymentScripts resource is places in the main bicep file, the change is considered from both the Extension as well from the CLI.

The bug could be related to #9590

**To Reproduce**
Files to reproduce:
main.bicep
```
module submodule 'module.bicep' = {
name: 'module'
}

resource mainScript 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
name: 'mainScript'
kind: 'AzurePowerShell'
location: resourceGroup().location
properties: {
azPowerShellVersion: '7.5.0'
scriptContent: loadTextContent('./scriptMain.ps1')
retentionInterval: 'PT1H'
}
}
```

module.bicep
```
resource moduleScript 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
name: 'moduleScript'
kind: 'AzurePowerShell'
location: resourceGroup().location
properties: {
azPowerShellVersion: '7.5.0'
scriptContent: loadTextContent('./scriptModule.ps1')
retentionInterval: 'PT1H'
}
}
```
scriptMain.ps1
```
param (
[string]$Name
)
```
scriptModule.ps1
```
param (
[string]$Name
)
```

Any changes to the scriptModule.ps1 are ignored by the extension.
Changes to the scriptMain.ps1 are taken for the build.

Contributor guide

Open the contributing guide

Research direction

Start with the provided main.bicep, module.bicep, scriptMain.ps1, and scriptModule.ps1 files, then compare the VS Code extension's build or publish behavior with the CLI build. Trace how changes to loadTextContent('./scriptModule.ps1') are tracked when the deploymentScripts resource is in a module. Done means module script changes are recognized by the extension as they are by the CLI.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, vscode
Domain
infrastructure, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.