-
Notifications
You must be signed in to change notification settings - Fork 798
Add this.exists() as an experimental feature #17727
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
base: main
Are you sure you want to change the base?
Conversation
Test this change out locally with the following install scripts (Action run 18512672134) VSCode
Azure CLI
|
Dotnet Test Results 96 files - 48 96 suites - 48 41m 21s ⏱️ - 35m 28s Results for commit f1f4fe6. ± Comparison against base commit f37ea76. This pull request removes 1917 and adds 669 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces this().exists
as an experimental feature for Bicep, allowing developers to conditionally modify resource properties based on whether the resource already exists during deployment. The feature requires explicit enablement through experimental flags and is restricted to resource property contexts only.
Key changes:
- Adds a new experimental feature flag
thisExistsFunction
with configuration support - Implements the
this()
function that returns an object with anexists
property - Restricts usage to resource properties only, with proper validation and error handling
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/vscode-bicep/schemas/bicepconfig.schema.json |
Adds schema definition for the new thisExistsFunction experimental feature |
src/Bicep.Core/Semantics/Namespaces/AzNamespaceType.cs |
Implements the this() function with context validation and return type definition |
src/Bicep.Core/Semantics/Namespaces/NamespaceProvider.cs |
Passes feature provider to namespace creation for conditional function registration |
src/Bicep.Core/Intermediate/ |
Adds new ThisFunctionExpression type and visitor pattern support |
src/Bicep.Core/Emit/ExpressionConverter.cs |
Converts this().exists to ARM template targetExists() function |
src/Bicep.Core/Features/ |
Adds feature flag support across the feature provider infrastructure |
src/Bicep.Core/Diagnostics/DiagnosticBuilder.cs |
Adds error message for invalid usage contexts |
src/Bicep.Core/Configuration/ExperimentalFeaturesEnabled.cs |
Extends configuration to include the new experimental feature |
Tests and documentation files | Comprehensive test coverage and documentation for the new feature |
Description
Adds this.exists() for use in resource properties. Should be blocked from usage in all other places as it is a runtime function.
Example Usage
Checklist
Microsoft Reviewers: Open in CodeFlow