Skip to content

Instantly share code, notes, and snippets.

View rollendxavier's full-sized avatar

Rollend Xavier rollendxavier

View GitHub Profile
@rollendxavier
rollendxavier / .tflint.hcl
Created February 1, 2022 07:19
A sample tflint hcl configuration file for terraform with Azure
config {
module = true
disabled_by_default = false
varfile = ["dev.tfvars", "prod.tfvars"]
}
plugin "azurerm" {
enabled = true
version = "0.14.0"
source = "github.com/terraform-linters/tflint-ruleset-azurerm"
@rollendxavier
rollendxavier / initialize.ps1
Created April 14, 2022 13:33
Powershell script to create the initial resource group, storage account & container for terraform state creation
param(
[Parameter(Mandatory=$True, Position=0, ValueFromPipeline=$false)]
[System.String]
$env,
[Parameter(Mandatory=$True, Position=1, ValueFromPipeline=$false)]
[System.String]
$client_id,
[Parameter(Mandatory=$True, Position=2, ValueFromPipeline=$false)]
[System.String]
$client_secret,
@rollendxavier
rollendxavier / azure-pipelines.yml
Last active April 14, 2022 13:52
Azure DevOps Job which will validates and create terraform pre-requisites such as resource group, storage account & container only if not exists.
stages:
- template: azure-tf-initialize.yml
parameters:
subscriptions:
- env: dev
code: "dev-subscription-code"
- env: test
code: "test-subscription-code"
- env: uat
code: "uat-subscription-code"
@rollendxavier
rollendxavier / container.tf
Created April 24, 2022 14:17
Manages an Azure Container Registry
resource "azurerm_resource_group" "container_rg" {
name = "container-${var.environment}-rg"
location = var.location
}
resource "azurerm_container_registry" "acr" {
name = "container${var.environment}acr"
resource_group_name = azurerm_resource_group.container_rg.name
location = var.location
sku = "Premium"
@rollendxavier
rollendxavier / app.tf
Last active April 24, 2022 17:25
Terraform scripts to create and app service with staged deployments.
resource "azurerm_resource_group" "application_rg" {
name = "${var.app_name}-${var.environment}-rg"
location = var.location
}
resource "azurerm_application_insights" "application_insights" {
name = "${var.app_name}-${var.environment}-ai"
location = var.location
resource_group_name = azurerm_resource_group.application_rg.name
application_type = "web"
trigger: none
pool:
vmImage: ubuntu-18.04
name: "$(Date:yyyyMMdd)$(Rev:.r)"
jobs:
- job: BuildAndPush
steps:
- task: Docker@2
inputs:
containerRegistry: 'app-service-connection'
trigger:
- main
resources:
- repo: self
variables:
# Container registry service connection established during pipeline creation
dockerRegistryServiceConnection: '{{ containerRegistryConnection.Id }}'
imageRepository: 'javascriptdocker'
@rollendxavier
rollendxavier / sqlcmdmigrator.ps1
Created June 9, 2022 06:01
Use the Invoke-Sqlcmd to run a script containing statements supported by the SQL Server SQLCMD utility.
param(
[Parameter(Mandatory=$True, Position=0)]
[System.String]
$Server,
[Parameter(Mandatory=$True, Position=1)]
[System.String]
$Database,
[Parameter(Mandatory=$True, Position=2)]
[System.String]
$UserName,
trigger:
branches:
include:
- main
- releases/*
paths:
include:
- /Scripts/Migration/*
variables:
@rollendxavier
rollendxavier / azure_role_resource_access.tsv
Last active August 3, 2022 01:25
Below are the role details of Microsoft Graph permissions including IDs which are required when using Terraform, PowerShell or Azure CLI.
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 4 columns, instead of 3. in line 5.
Role Name ID Display Name Description
APIConnectors.Read.All b86848a7-d5b1-41eb-a9b4-54a4e6306e97 Read API connectors for authentication flows Allows the app to read the API connectors used in user authentication flows, without a signed-in user.
APIConnectors.ReadWrite.All 1dfe531a-24a6-4f1b-80f4-7a0dc5a0a171 Read and write API connectors for authentication flows Allows the app to read, create and manage the API connectors used in user authentication flows, without a signed-in user.
AccessReview.Read.All d07a8cc0-3d51-4b77-b3b0-32704d1f69fa Read all access reviews Allows the app to read access reviews, reviewers, decisions and settings in the organization, without a signed-in user.
AccessReview.ReadWrite.All ef5f7d5c-338f-44b0-86c3-351f46c8bb5f Manage all access reviews Allows the app to read, update, delete and perform actions on access reviews, reviewers, decisions and settings in the organization, without a signed-in user.
AccessReview.ReadWrite.Membership 18228521-a591-40f1-b215-5fad4488c117 Manage access