Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…#580)

* Pull in ARM types from https://github.com/Azure/bicep-types-az

* Fix some samples

* Allow assignment from param with no allowed to string literal

* Add type deserialization tests

* Address PR feedback
  • Loading branch information
anthony-c-martin authored Oct 7, 2020
1 parent 81938ed commit e5c5b0e
Show file tree
Hide file tree
Showing 57 changed files with 606 additions and 373 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
submodules: true

- name: Setup .NET Core
uses: actions/[email protected]
Expand Down Expand Up @@ -93,6 +94,7 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
submodules: true

- name: Setup .NET Core
uses: actions/[email protected]
Expand Down Expand Up @@ -123,6 +125,7 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
submodules: true

- name: Setup Node.js
uses: actions/[email protected]
Expand Down Expand Up @@ -162,6 +165,7 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
submodules: true

- name: Setup .NET Core
uses: actions/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
submodules: true

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "bicep-types-az"]
path = bicep-types-az
url = https://github.com/Azure/bicep-types-az.git
1 change: 1 addition & 0 deletions bicep-types-az
Submodule bicep-types-az added at 85d513
4 changes: 2 additions & 2 deletions docs/examples/101/1vm-2nics-2subnets-1vnet/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ resource vm 'Microsoft.Compute/virtualMachines@2017-03-30' = {
adminUsername: adminUsername
adminPassword: adminPassword
windowsConfiguration: {
provisionVmAgent: true
provisionVMAgent: true
}
}
hardwareProfile: {
Expand Down Expand Up @@ -131,7 +131,7 @@ resource nic1 'Microsoft.Network/networkInterfaces@2017-06-01' = {
id: '${vnet.id}/subnets/${subnet1Name}'
}
privateIPAllocationMethod: 'Dynamic'
publicIpAddress: {
publicIPAddress: {
id: pip.id
}
}
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/101/1vm-2nics-2subnets-1vnet/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]",
"windowsConfiguration": {
"provisionVmAgent": true
"provisionVMAgent": true
}
},
"hardwareProfile": {
Expand Down Expand Up @@ -155,7 +155,7 @@
"id": "[format('{0}/subnets/{1}', resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName')), variables('subnet1Name'))]"
},
"privateIPAllocationMethod": "Dynamic",
"publicIpAddress": {
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/101/aks/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ param agentCount int {
param agentVMSize string = 'Standard_DS2_v2'
// osType was a defaultValue with only one allowedValue, which seems strange?, could be a good TTK test

resource aks 'Microsoft.ContainerService/managedClusters@2020-03-01' = {
resource aks 'Microsoft.ContainerService/managedClusters@2017-08-31' = {
name: clusterName
location: location
properties: {
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/101/aks/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"resources": [
{
"type": "Microsoft.ContainerService/managedClusters",
"apiVersion": "2020-03-01",
"apiVersion": "2017-08-31",
"name": "[parameters('clusterName')]",
"location": "[parameters('location')]",
"properties": {
Expand Down
4 changes: 1 addition & 3 deletions docs/examples/101/cosmosdb-webapp/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,14 @@ resource farm 'Microsoft.Web/serverFarms@2019-08-01' = {
capacity: appServicePlanInstances
}
properties: {
name: hostingPlanName
}
}

resource website 'Microsoft.Web/sites@2019-08-01' = {
name: websiteName
location: location
properties: {
serverFarmId: resourceId('Microsoft.Web/serverfarms', hostingPlanName)
serverFarmId: farm.id
siteConfig: {
appSettings: [
{
Expand All @@ -99,7 +98,6 @@ resource website 'Microsoft.Web/sites@2019-08-01' = {

resource srcCtrl 'Microsoft.Web/sites/sourcecontrols@2019-08-01' = {
name: '${website.name}/web'
location: location
properties: {
repoUrl: repositoryUrl
branch: branch
Expand Down
10 changes: 4 additions & 6 deletions docs/examples/101/cosmosdb-webapp/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,15 @@
}
},
{
"type": "Microsoft.Web/serverFarms",
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2019-08-01",
"name": "[variables('hostingPlanName')]",
"location": "[parameters('location')]",
"sku": {
"name": "[parameters('appServicePlanTier')]",
"capacity": "[parameters('appServicePlanInstances')]"
},
"properties": {
"name": "[variables('hostingPlanName')]"
}
"properties": {}
},
{
"type": "Microsoft.Web/sites",
Expand Down Expand Up @@ -121,14 +119,14 @@
}
},
"dependsOn": [
"[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('cosmosAccountName'))]"
"[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('cosmosAccountName'))]",
"[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]"
]
},
{
"type": "Microsoft.Web/sites/sourcecontrols",
"apiVersion": "2019-08-01",
"name": "[format('{0}/web', variables('websiteName'))]",
"location": "[parameters('location')]",
"properties": {
"repoUrl": "[parameters('repositoryUrl')]",
"branch": "[parameters('branch')]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ resource ws 'Microsoft.Databricks/workspaces@2018-04-01' = {
}
properties: {
// TODO: improve once we have scoping functions
ManagedResourceGroupId: managedResourceGroupId
managedResourceGroupId: managedResourceGroupId
parameters: {
customVirtualNetworkId: {
value: vnet.id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"name": "[parameters('pricingTier')]"
},
"properties": {
"ManagedResourceGroupId": "[variables('managedResourceGroupId')]",
"managedResourceGroupId": "[variables('managedResourceGroupId')]",
"parameters": {
"customVirtualNetworkId": {
"value": "[resourceId('Microsoft.Network/virtualNetworks', parameters('vnetName'))]"
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/101/databricks-workspace/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ resource ws 'Microsoft.Databricks/workspaces@2018-04-01' = {
}
properties: {
// TODO: improve once we have scoping functions
ManagedResourceGroupId: '${subscription().id}/resourceGroups/${managedResourceGroupName}'
managedResourceGroupId: '${subscription().id}/resourceGroups/${managedResourceGroupName}'
}
}

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/101/databricks-workspace/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"name": "[parameters('pricingTier')]"
},
"properties": {
"ManagedResourceGroupId": "[format('{0}/resourceGroups/{1}', subscription().id, variables('managedResourceGroupName'))]"
"managedResourceGroupId": "[format('{0}/resourceGroups/{1}', subscription().id, variables('managedResourceGroupName'))]"
}
}
],
Expand Down
11 changes: 3 additions & 8 deletions docs/examples/101/function-app-create/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ param location string = resourceGroup().location
param functionRuntime string = 'dotnet'

param appNamePrefix string = uniqueString(resourceGroup().id)
param workspaceResourceId string

var functionAppName = '${appNamePrefix}-functionapp'
var appServiceName = '${appNamePrefix}-appservice'
Expand Down Expand Up @@ -51,10 +52,6 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2019-06-01' = {
// Blob Services for Storage Account
resource blobServices 'Microsoft.Storage/storageAccounts/blobServices@2019-06-01' = {
name: '${storageAccount.name}/default'
sku: {
name: 'Standard_LRS'
tier: 'Standard'
}
properties: {
cors: {
corsRules: []
Expand All @@ -73,7 +70,7 @@ resource appInsights 'Microsoft.Insights/components@2020-02-02-preview' = {
kind: 'web'
properties: {
Application_Type: 'web'
RetentionInDays: 90
WorkspaceResourceId: workspaceResourceId
publicNetworkAccessForIngestion: 'Enabled'
publicNetworkAccessForQuery: 'Enabled'
}
Expand Down Expand Up @@ -160,7 +157,7 @@ resource functionApp 'Microsoft.Web/sites@2018-11-01' = {
clientAffinityEnabled: false
clientCertEnabled: false
hostNamesDisabled: false
dailyMemoryTimeQuote: 0
dailyMemoryTimeQuota: 0
httpsOnly: true
redundancyMode: 'None'
}
Expand All @@ -170,7 +167,6 @@ resource functionApp 'Microsoft.Web/sites@2018-11-01' = {
// Function App Config
resource functionAppConfig 'Microsoft.Web/sites/config@2018-11-01' = {
name: '${functionApp.name}/web'
location: location
properties: {
numberOfWorkers: -1
defaultDocuments: [
Expand Down Expand Up @@ -249,7 +245,6 @@ resource functionAppConfig 'Microsoft.Web/sites/config@2018-11-01' = {
// Function App Binding
resource functionAppBinding 'Microsoft.Web/sites/hostNameBindings@2018-11-01' = {
name: '${functionApp.name}/${functionApp.name}.azurewebsites.net'
location: location
properties: {
siteName: functionAppName
hostNameType: 'Verified'
Expand Down
19 changes: 8 additions & 11 deletions docs/examples/101/function-app-create/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"appNamePrefix": {
"type": "string",
"defaultValue": "[uniqueString(resourceGroup().id)]"
},
"workspaceResourceId": {
"type": "string"
}
},
"functions": [],
Expand Down Expand Up @@ -60,10 +63,6 @@
"type": "Microsoft.Storage/storageAccounts/blobServices",
"apiVersion": "2019-06-01",
"name": "[format('{0}/default', variables('storageAccountName'))]",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"properties": {
"cors": {
"corsRules": []
Expand All @@ -85,14 +84,14 @@
"kind": "web",
"properties": {
"Application_Type": "web",
"RetentionInDays": 90,
"WorkspaceResourceId": "[parameters('workspaceResourceId')]",
"publicNetworkAccessForIngestion": "Enabled",
"publicNetworkAccessForQuery": "Enabled"
},
"tags": "[variables('appTags')]"
},
{
"type": "Microsoft.Web/serverFarms",
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2019-08-01",
"name": "[variables('appServiceName')]",
"location": "[parameters('location')]",
Expand Down Expand Up @@ -136,7 +135,7 @@
"hostType": "Standard"
}
],
"serverFarmId": "[resourceId('Microsoft.Web/serverFarms', variables('appServiceName'))]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('appServiceName'))]",
"reserved": false,
"isXenon": false,
"hyperV": false,
Expand Down Expand Up @@ -172,22 +171,21 @@
"clientAffinityEnabled": false,
"clientCertEnabled": false,
"hostNamesDisabled": false,
"dailyMemoryTimeQuote": 0,
"dailyMemoryTimeQuota": 0,
"httpsOnly": true,
"redundancyMode": "None"
},
"tags": "[variables('appTags')]",
"dependsOn": [
"[resourceId('Microsoft.Insights/components', variables('appInsightsName'))]",
"[resourceId('Microsoft.Web/serverFarms', variables('appServiceName'))]",
"[resourceId('Microsoft.Web/serverfarms', variables('appServiceName'))]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
]
},
{
"type": "Microsoft.Web/sites/config",
"apiVersion": "2018-11-01",
"name": "[format('{0}/web', variables('functionAppName'))]",
"location": "[parameters('location')]",
"properties": {
"numberOfWorkers": -1,
"defaultDocuments": [
Expand Down Expand Up @@ -269,7 +267,6 @@
"type": "Microsoft.Web/sites/hostNameBindings",
"apiVersion": "2018-11-01",
"name": "[format('{0}/{1}.azurewebsites.net', variables('functionAppName'), variables('functionAppName'))]",
"location": "[parameters('location')]",
"properties": {
"siteName": "[variables('functionAppName')]",
"hostNameType": "Verified"
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/101/monitor-action-groups/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ param logicAppReceivers array = []
param azureFunctionReceivers array = []
param armRoleReceivers array = []

resource actionGroup 'Microsoft.Insights/actionGroups@2018-03-01' = {
resource actionGroup 'Microsoft.Insights/actionGroups@2019-06-01' = {
name: actionGroupName
location: 'Global'
properties: {
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/101/monitor-action-groups/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
"variables": {},
"resources": [
{
"type": "Microsoft.Insights/actionGroups",
"apiVersion": "2018-03-01",
"type": "microsoft.insights/actionGroups",
"apiVersion": "2019-06-01",
"name": "[parameters('actionGroupName')]",
"location": "Global",
"properties": {
Expand All @@ -76,7 +76,7 @@
"outputs": {
"actionGroupId": {
"type": "string",
"value": "[resourceId('Microsoft.Insights/actionGroups', parameters('actionGroupName'))]"
"value": "[resourceId('microsoft.insights/actionGroups', parameters('actionGroupName'))]"
}
}
}
Loading

0 comments on commit e5c5b0e

Please sign in to comment.