Posts

Showing posts from March, 2020

How to work IaaC with Terraform integration Azure

How to work IaaC  with Terraform integration Azure Login in azure and go to Azure CLI and create a service principle: az account list --query "[].{name:name, subscriptionId:id, tenantId:tenantId}" set subscription in case you have many:  az account set --subscription="${SUBSCRIPTION_ID}" Now you can create a service principal for use with Terraform: az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/${SUBSCRIPTION_ID}" These values map to the Terraform variables like so: appId is the client_id defined above. password is the client_secret defined above. tenant is the tenant_id defined above. Now you can use local Terraform Client with below template: # Configure the Microsoft Azure Provider provider "azurerm" {   # The "feature" block is required for AzureRM provider 2.x.   # If you're using version 1.x, the "features" block is not allowed.   version = "~>2.0&qu

Code Review Checklist

Coding Style Use tabs to indent code, spaces to align within code Use the vertical pair-matching style of bracing System variables declared using system keyword aliases (e.g. int, float, string ) instead of base types ( e.g System.Int32, System.Single, System.String) Declare variables as closely as possible to first use and within the deepest possible scope Do not use public constants unless the value is truly a constant (e.g. Avogadro's Number but not our company name) Use static readonly for public "constants" Avoid using fully-qualified type names in your code Do not use using keywords inside a namespace declaration If an enumeration represents combinable settings (e.g. bitmasks), mark the enum with the [Flags] attribute  All switch statements must have a default case [ See Standards doc] Avoid compiling out methods using #if/#endif constructs (

Naming Conventions

Naming Conventions Variable Naming Variable names have the following structure: <scope><constructor><type><qualifier> Section Description Example <scope> Optional.   Indicates the scope and/or usage of the variable (eg. Global, Module, Static, Ref, Val) g_ arrstrStateName <constructor> Optional.   Base-type modifier arr sStateName <type> Required.   Indicates the base-type of the variable (eg. integer, string, double etc.) l StateidFirst <body> Required.   Describes the variable arrs StateName <qualifier> Optional.   Denotes a derivative of the variable sStateName Tmp Do not use the optional Visual Basic variable suffixes ($, %, & etc.). Scope Prefix <scope> The following table defines the standard scope and usage prefixes.

Coding Style

Coding Style Indentation Use tabs, not spaces, to indent your code.  Indent one tab with each deeper level of code block or construct.  In general, when you open a code block with a bracket “{“, the next line will likely be further indented by one tab. Example: Class TestClass {        // New indentation (tab) level public void SomeMethod() {                // New indentation (tab) level                       if (...)                {                       // New indentation (tab) level                } } } Braces Use the vertical pair-matching style of bracing.  Example: if (currentIndex >= INDEX_MAX) {        return _partNames[INDEX_MAX]; } else {        return _partNames[currentIndex]; } In addition, while braces are syntactically optional for constructs such as if and for having only one line to execute, include the braces for readability and maintainability (as in the above example.) Empty code regions can be