Skip to content

Commit

Permalink
Merge pull request #157 from ElYusubov/development
Browse files Browse the repository at this point in the history
Add latest experimental code
  • Loading branch information
ElYusubov authored Mar 27, 2024
2 parents 81f7832 + f2fd9c2 commit 8f2c42a
Show file tree
Hide file tree
Showing 5 changed files with 199 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Pilot-project/pilot-01-environment.bicep
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// pilot-webapp-environment
param location string = 'eastus2'
param location string = resourceGroup().location

// param myDemoOrganization string = 'Packt Publishing'
// var setValue = myDemoOrganization

resource appServicePlan 'Microsoft.Web/serverFarms@2020-06-01' = {
name: 'kinetEco35-appplan'
Expand All @@ -14,6 +17,7 @@ resource appServicePlan 'Microsoft.Web/serverFarms@2020-06-01' = {
}
}


resource appServiceApp 'Microsoft.Web/sites@2020-06-01' = {
name: 'kinetEco35-webapp'
location: location
Expand Down
2 changes: 1 addition & 1 deletion deploy/main.bicep
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// main.bicep - test run the pipeline
// Requires registration of Microsoft.Web, Insights and AlertsManagment

@description('The Azure region (location) for deployment.')
@description('The Azure region/location for deployment.')
param location string = resourceGroup().location

@description('The allowed environment types are: Dev, Test, and Prod.')
Expand Down
3 changes: 2 additions & 1 deletion samples/2-deploy-param-storage.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ targetScope = 'subscription'

@description('Resource Group name for the deployment')
@minLength(3)
param resourceGroupName string = 'rg-BackToFuture'
@maxLength(90)
param resourceGroupName string = 'rg-BicepDemo'

@description('Azure region to deploy all resources')
@allowed([
Expand Down
127 changes: 127 additions & 0 deletions samples/20-experiment-Bicep.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// @description('String value defined for test deployment')
// param stringValue string = 'deployment parameter'

// @description('Integere value defined for test deployment')
// param intValue int = 45

// var concatValues = '${stringValue}AddToVar'
// var sumUpIntValues = intValue + 5


// @allowed([
// 'dev'
// 'test'
// 'prod'
// ])
// param environmentName string

// var environmentSettings = {
// dev: {
// instanceSize: 'Small'
// instanceCount: 1
// }
// test: {
// instanceSize: 'Small'
// instanceCount: 2
// }
// prod: {
// instanceSize: 'Large'
// instanceCount: 4
// }
// }

// output instanceSize string = environmentSettings[environmentName].instanceSize
// output instanceCount int = environmentSettings[environmentName].instanceCount

// output finalConcat string = concatValues
// output finalSumUp int = sumUpIntValues



//// - Code #2

// param suffix string = '001'
// var webAppName = concat('webapp-', suffix)



//// - Code #3

// param resourceName string = 'defaultResourceName'

// resource myResource 'Microsoft.Provider/resourceType@version' = {
// name: resourceName
// // additional resource properties
// }





//// - Code #4

// param location string = resourceGroup().location

// @allowed([
// 'dev'
// 'test'
// 'prod'
// ])
// param environmentName string = 'dev'

// param appServiceAppName string = 'app-bicepOrg-${environmentName}-${uniqueString(resourceGroup().id)}'
// param appServicePlanName string = 'plan-bicepOrg-${environmentName}-${uniqueString(resourceGroup().id)}'

// resource appServiceApp 'Microsoft.Web/sites@2023-01-01' = {
// name: appServiceAppName
// // ...
// }

// resource appServicePlan 'Microsoft.Web/serverfarms@2023-01-01' = {
// name: appServicePlanName
// // ...
// }



//// - Code #5

// @minLength(3)
// @maxLength(24)
// param primaryStorageAccountName string = 'bopri${environmentName}${uniqueString(resourceGroup().id)}'

// @allowed([
// 'dev'
// 'test'
// 'prod'
// ])
// param environmentName string = 'dev'

// param location string = resourceGroup().location

// @minLength(3)
// @maxLength(24)
// param secondaryStorageAccountName string = 'bosec${environmentName}${uniqueString(resourceGroup().id)}'

// resource primaryStorageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = {
// name: primaryStorageAccountName
// location: location
// // ...
// }

// resource secondaryStorageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = {
// name: secondaryStorageAccountName
// // ...
// }




//// - Code #6

// // Define a parameter with a name of a known function range
// param range int

// // Because of the naming condtion, we must use sys namespace to call the function.
// output result array = sys.range(1, range)
// // The second use of range refers to the parameter.
64 changes: 64 additions & 0 deletions samples/21-test-experiment.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//// - Code #8

// param location string = resourceGroup().location

// resource wpAci 'Microsoft.ContainerInstance/containerGroups@2023-05-01' = {
// name: 'wordpress-containerinstance'
// location: location
// properties: {
// osType: 'Linux'
// containers: [
// {
// name: 'wordpress'
// properties: {
// resources: {
// requests: {
// cpu: any('0.75') // Convert numeric value to string
// memoryInGB: any('1.5')
// }
// }
// }
// }
// ]
// }
// }



//// - Code #8

// param intToConvert int = 9
// param stringToConvert string = 'packt'
// param objectToConvert object = { b: 'i', c: 'p' }

// output intOutput array = array(intToConvert)
// output stringOutput array = array(stringToConvert)
// output objectOutput array = array(objectToConvert)



//// - Code #9

// concat(arg1, arg2, arg3, ...)

// param firstArray array = ['item1', 'item2', 'item3']
// param secondArray array = ['item7', 'item8', 'item9']

// output return array = concat(firstArray, secondArray)


// param environment string = 'prod'
// param resourceType string = 'web'
// param resourceName string = 'app'

// var concatenatedName = '${environment}-${resourceType}-${resourceName}'

// output resourceNameWithEnvironment string = concatenatedName


param availableFruits array = ['apple', 'strawberry', 'orange', 'banana', 'pear']
param desiredfruit string = 'orange'

var hasDesiredFruit = contains(availableFruits, desiredfruit)

output containsDesiredFruit bool = hasDesiredFruit

0 comments on commit 8f2c42a

Please sign in to comment.