Skip to content

uon-drs/bicep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DRS Bicep

This repo contains reusable Bicep files for DRS projects, as well as documentation and other samples.

Everything in modules/ is published to a private repository either as a distinct module, or is a base dependency of a published module.

Published modules can then be referenced in your projects without being directly included.

Non-Module Documentation

The table below describes general documentation available, while below the table there are subheadings for further general documentation.

Doc Description
Intro Introduction to Bicep usage in DRS
Deployment QuickStart guide for deploying Bicep environments
KeyVaults Information about DRS use of Azure KeyVault in Bicep and Bicep created resources.

bicepconfig.json

This is an example config file suitable for use in projects that reference the modules in this repo.

PROJECT_DOCS_TEMPLATE.md

This is a template for the sort of details (including some common ones) it's useful to document in a project that might use the modules in this repo.

Copy it somewhere sensible in a project repo, such as .azure/bicep/README.md and modify the contents to suit your project.

Module Documentation

Components

These are modules which deploy resources.

  • Sometimes multiple related resources that are configured to work with each other.
  • Sometimes child resources, if it's appropriate for them to run in the same immediate deployment.
Name Description
app-service-plan Creates a Linux app service plan of a given SKU.
app-service Creates any kind of App Service. Does some value-add (e.g. AppInsights). Read the docs.
log-analytics-workspace Creates a Log Analytics Workspace e.g. for AppInsights.
managed-cert Creates a Managed SSL Certificate and binds it to a given hostname for an App Service.
storage-account Creates an Azure Storage Account for general use, or Function Apps.
vnet Creates a basic VNET, optionally suitable for VNET Integration.

Config

These are modules which deploy a modification or child resource against an already deployed resource.

Name Description
functionapp Specifies SiteConfig, AppSettings and ConnectionStrings with Function App defaults and valid App Frameworks.
webapp Specifies SiteConfig, AppSettings and ConnectionStrings with Web App defaults and valid App Frameworks.
keyvault-access Grants read access to KeyVault Secrets to a given app's Service Principal. This allows that app's AppSettings to reference KeyVault Secrets.

Utils

These are "non-deployment" modules, in that they don't deploy resources.

Typically they contain exported functions or variables only.

Name Description
app-service-kind Helpers for App Service kind strings
functions General helper functions for importing
types General type definitions

Using Modules

Full documentation:

Quick Start

  1. Use the bicepconfig.json in this repository for an example of defining aliases to the Bicep Registry
  2. Declare Modules as you would normally but instead of a relative path, use a Bicep Registry path:
    • e.g. module myModule 'br/Alias:module-name:v1' = {}
  3. Import Modules as you would normally but instead of a relative path, use a Bicep Registry path:
    • e.g. import { myExport } from 'br/Alias:module-name:v1'

Tip

Using the VS Code extension, everything should just work as it automatically restores Registry modules.

If it doesn't work:

  • wait a minute for the restore to complete
  • check that aliases are correctly configured and that you have appropriate access to the container registry.

If not using VS Code you may have to restore manually.

Publishing Modules

Important

Appropriate permissions are required on the Azure Container Registry in order to publish modules

Note

The use of git tags is encouraged to represent commits module versions have been published from. Such a commit should include updated modulex docs and changelog

Example publish command:

From the root of the repo:

az bicep publish \
--file ./modules/config/webapp.bicep \
--target br:<registry-url>/bicep/config/webapp:v1 \
--documentationUri https://github.com/uon-drs/bicep/blob/config/webapp@v1/docs/modules/config/webapp.md

Warning

Remember!

  • use the correct registry version tag on the target
  • point at the correct git tag (and module document!) for the docs link.

Publishing new modules

  1. Add the module to the correct folder.
  2. Add module docs based on the template.
  3. Add the module docs link to the README.
  4. Push to a branch, raise a PR.
  5. Once merged:
    1. git tag
    2. Publish as above.

Updating existing published Modules

  1. Amend the module.
  2. Update the module docs.
  3. Update the changelog in the module docs.
  4. Push to a branch, raise a PR.
  5. Once merged:
    1. git tag
    2. Publish as above.

About

Reusable bicep files for DRS projects

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages