Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure safe access of output guards against missing value property #13162

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

jeskew
Copy link
Contributor

@jeskew jeskew commented Jan 31, 2024

Resolves #13160

Safe dereference of a module output (mod.outputs.?foo) is currently written to guard against conditional outputs with a false condition (i.e., it would be equivalent to writing mod.outputs.?foo.value if Bicep didn't automatically inject the .value into module output reference expressions). It currently doesn't guard against outputs whose value is null (which will cause the ARM engine to omit the .value property).

This PR updates the expression converter to make mod.outputs.?foo compile to something like [tryGet(tryGet(reference('mod').outputs, 'foo'), 'value')] to ensure both cases described above evaluate to null when evaluated by the ARM engine.

Microsoft Reviewers: Open in CodeFlow

@jeskew jeskew requested a review from a team January 31, 2024 17:13
Copy link
Contributor

github-actions bot commented Jan 31, 2024

Test this change out locally with the following install scripts (Action run 7730544761)

VSCode
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 7730544761
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 7730544761"
Azure CLI
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 7730544761
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 7730544761"

Copy link
Contributor

Test Results

    66 files   -     33      66 suites   - 33   24m 41s ⏱️ - 23m 12s
11 009 tests  -     20  11 009 ✅  -     20  0 💤 ±0  0 ❌ ±0 
25 908 runs   - 12 950  25 908 ✅  - 12 950  0 💤 ±0  0 ❌ ±0 

Results for commit d603aac. ± Comparison against base commit 68ce409.

@jeskew jeskew enabled auto-merge (squash) January 31, 2024 17:23
Copy link
Contributor

@shenglol shenglol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@jeskew jeskew merged commit e717819 into main Jan 31, 2024
44 checks passed
@jeskew jeskew deleted the jeskew/13160 branch January 31, 2024 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using a nullable string output from a module as input for another resource gives an error
2 participants