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

Block direct resource access in top level properties #12291

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

shenglol
Copy link
Contributor

@shenglol shenglol commented Oct 27, 2023

Update DTC validation logic to ensure direct resource access is blocked in top level resource properties.

Fixes #11958.

Microsoft Reviewers: Open in CodeFlow

// locations where referencing an entire resource/module module body is expected (e.g., scope).
return;
}

Copy link
Contributor Author

@shenglol shenglol Oct 27, 2023

Choose a reason for hiding this comment

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

This is no longer valid since 1) we changed type checking to only emit warnings for resources properties; 2) there is an edge case - identities's type is generic Resource which makes type checking useless.

But this makes me wonder if we should at least emit type errors for top level properties whose types cannot be customized by RPs, such as location.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 27, 2023

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

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

@github-actions
Copy link
Contributor

Test Results

     132 files  ±0       132 suites  ±0   4h 27m 8s ⏱️ +14s
10 683 tests +1  10 683 ✔️ +2  0 💤 ±0  0  - 1 
51 627 runs  +4  51 627 ✔️ +5  0 💤 ±0  0  - 1 

Results for commit 41be421. ± Comparison against base commit 8d5c061.

@shenglol shenglol merged commit 7664fd7 into main Oct 27, 2023
47 checks passed
@shenglol shenglol deleted the shenglol/block-reference-in-identity branch October 27, 2023 22:32
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.

Error when referencing a Managed Identity in the identity block of a storage account
2 participants