Coder Social home page Coder Social logo

function-todo-api's Introduction

Bicep starter template

A template repository to get started with an bicep infrastructure-as-code project, including the azure naming module to facilitate naming conventions. For the full reference of the supported resource types, head to the main module repository: https://github.com/nianton/azure-naming

As in bicep the 'name' property of the resources to be created has to be know compile-time, the naming module cannot be directly consumed to name a resource but only as parameter to a module, we are resorting to have a subscription-level deployment azure.deploy.bicep which is passing as input parameter to the main.bicep deployment the naming part.

targetScope = 'subscription'

param location string
param applicationName string
param environment string
param tags object = {}

var defaultTags = union({
  applicationName: applicationName
  environment: environment
}, tags)

resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
  name: 'rg-${applicationName}-${environment}'
  location: location
  tags: defaultTags
}

module naming 'modules/naming.module.bicep' = {
  scope: resourceGroup(rg.name)
  name: 'NamingDeployment'  
  params: {
    suffix: [
      applicationName
      environment
      '**location**' // location/region placeholder, it will be replaced with its abbreviation
    ]
    uniqueLength: 6
    uniqueSeed: rg.id
  }
}

module main 'main.bicep' = {
  scope: resourceGroup(rg.name)
  name: 'MainDeployment'
  params: {
    location: location
    naming: naming.outputs.names
    tags: defaultTags
  }
}

output resourceGroupName string = rg.name
output naming object = naming.outputs.names

The main deployment is handled by the main.bicep file, which dictates the resources to be created within the created resource group and is responsible to consume the naming module as input.

In the modules folder, there is a sample module implementation for a storage account named storage.module.bicep.

function-todo-api's People

Contributors

nianton avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.