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

Implement conditional resources and modules #1014

Merged
merged 8 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ parameterDefaultValue -> "=" expression

variableDecl -> "variable" IDENTIFIER(name) "=" expression NL

resourceDecl -> "resource" IDENTIFIER(name) interpString(type) "=" object NL
resourceDecl -> "resource" IDENTIFIER(name) interpString(type) "=" ifCondition? object NL

moduleDecl -> "module" IDENTIFIER(name) interpString(type) "=" object NL

Expand Down Expand Up @@ -85,6 +85,8 @@ argumentList -> expression ("," expression)*

parenthesizedExpression -> "(" expression ")"

ifCondition -> "if" parenthesizedExpression

interpString -> interpStringLeftPiece ( expression interpStringMiddlePiece )* expression interpStringRightPiece | literalString
interpStringLeftPiece -> "'" STRINGCHAR* "${"
interpStringMiddlePiece -> "}" STRINGCHAR* "${"
Expand Down
14 changes: 6 additions & 8 deletions src/Bicep.Cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@
using System;
using System.IO;
using System.Linq;
using System.Text;
using Bicep.Cli.CommandLine;
using Bicep.Cli.CommandLine.Arguments;
using Bicep.Cli.Logging;
using Bicep.Core.Diagnostics;
using Bicep.Core.Emit;
using Bicep.Core.FileSystem;
using Bicep.Core.Semantics;
using Bicep.Core.Syntax;
using Bicep.Core.Text;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Bicep.Cli.CommandLine.Arguments;
using Bicep.Core.TypeSystem.Az;
using Bicep.Core.TypeSystem;
using Bicep.Core.Diagnostics;
using Bicep.Core.FileSystem;
using Bicep.Core.TypeSystem.Az;
using Bicep.Core.Workspaces;
using Bicep.Decompiler;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;

namespace Bicep.Cli
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[
{
"label": "arrayOutput",
"kind": "property",
"detail": "arrayOutput",
"documentation": {
"kind": "markdown",
"value": "Type: `array` \nRead-only property \n"
},
"deprecated": false,
"preselect": false,
"sortText": "2_arrayOutput",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "arrayOutput"
},
"commitCharacters": [
"."
]
},
{
"label": "objOutput",
"kind": "property",
"detail": "objOutput",
"documentation": {
"kind": "markdown",
"value": "Type: `object` \nRead-only property \n"
},
"deprecated": false,
"preselect": false,
"sortText": "2_objOutput",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "objOutput"
},
"commitCharacters": [
"."
]
},
{
"label": "stringOutputA",
"kind": "property",
"detail": "stringOutputA",
"documentation": {
"kind": "markdown",
"value": "Type: `string` \nRead-only property \n"
},
"deprecated": false,
"preselect": false,
"sortText": "2_stringOutputA",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "stringOutputA"
},
"commitCharacters": [
"."
]
},
{
"label": "stringOutputB",
"kind": "property",
"detail": "stringOutputB",
"documentation": {
"kind": "markdown",
"value": "Type: `string` \nRead-only property \n"
},
"deprecated": false,
"preselect": false,
"sortText": "2_stringOutputB",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "stringOutputB"
},
"commitCharacters": [
"."
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[
{
"label": "arrayParam",
"kind": "property",
"detail": "arrayParam (Required)",
"documentation": {
"kind": "markdown",
"value": "Type: `array` \nWrite-only property \n"
},
"deprecated": false,
"preselect": false,
"sortText": "2_arrayParam",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "arrayParam"
},
"commitCharacters": [
":"
]
},
{
"label": "objParam",
"kind": "property",
"detail": "objParam (Required)",
"documentation": {
"kind": "markdown",
"value": "Type: `object` \nWrite-only property \n"
},
"deprecated": false,
"preselect": false,
"sortText": "2_objParam",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "objParam"
},
"commitCharacters": [
":"
]
},
{
"label": "stringParamA",
"kind": "property",
"detail": "stringParamA",
"documentation": {
"kind": "markdown",
"value": "Type: `string` \nWrite-only property \n"
},
"deprecated": false,
"preselect": false,
"sortText": "2_stringParamA",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "stringParamA"
},
"commitCharacters": [
":"
]
},
{
"label": "stringParamB",
"kind": "property",
"detail": "stringParamB (Required)",
"documentation": {
"kind": "markdown",
"value": "Type: `string` \nWrite-only property \n"
},
"deprecated": false,
"preselect": false,
"sortText": "2_stringParamB",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "stringParamB"
},
"commitCharacters": [
":"
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[
{
"label": "dependsOn",
"kind": "property",
"detail": "dependsOn",
"documentation": {
"kind": "markdown",
"value": "Type: `resource | module[]` \nWrite-only property \n"
},
"deprecated": false,
"preselect": false,
"sortText": "2_dependsOn",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "dependsOn"
},
"commitCharacters": [
":"
]
},
{
"label": "name",
"kind": "property",
"detail": "name (Required)",
"documentation": {
"kind": "markdown",
"value": "Type: `string` \n"
},
"deprecated": false,
"preselect": false,
"sortText": "2_name",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "name"
},
"commitCharacters": [
":"
]
},
{
"label": "params",
"kind": "property",
"detail": "params (Required)",
"documentation": {
"kind": "markdown",
"value": "Type: `params` \nWrite-only property \n"
},
"deprecated": false,
"preselect": false,
"sortText": "2_params",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "params"
},
"commitCharacters": [
":"
]
},
{
"label": "scope",
"kind": "property",
"detail": "scope",
"documentation": {
"kind": "markdown",
"value": "Type: `resourceGroup` \nWrite-only property \n"
},
"deprecated": false,
"preselect": false,
"sortText": "2_scope",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "scope"
},
"commitCharacters": [
":"
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[
{
"label": "dependsOn",
"kind": "property",
"detail": "dependsOn",
"documentation": {
"kind": "markdown",
"value": "Type: `resource | module[]` \nWrite-only property \n"
},
"deprecated": false,
"preselect": false,
"sortText": "2_dependsOn",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "dependsOn"
},
"commitCharacters": [
":"
]
},
{
"label": "params",
"kind": "property",
"detail": "params (Required)",
"documentation": {
"kind": "markdown",
"value": "Type: `params` \nWrite-only property \n"
},
"deprecated": false,
"preselect": false,
"sortText": "2_params",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "params"
},
"commitCharacters": [
":"
]
},
{
"label": "scope",
"kind": "property",
"detail": "scope",
"documentation": {
"kind": "markdown",
"value": "Type: `resourceGroup` \nWrite-only property \n"
},
"deprecated": false,
"preselect": false,
"sortText": "2_scope",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "scope"
},
"commitCharacters": [
":"
]
}
]
Loading