Skip to content

Instantly share code, notes, and snippets.

💭
Microservices, Azure, Containers, Kubernetes, Infrastructure, Polyglot, etc

rahul sahay rahulsahay19

💭
Microservices, Azure, Containers, Kubernetes, Infrastructure, Polyglot, etc
Block or report user

Report or block rahulsahay19

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View terraform-init.sh
terraform init -backend-config="storage_account_name=tfseries" -backend-config="container_name=tfstate" -backend-config="access_key=$(az keyvault secret show --name tfstate-storage-key --vault-name tRahulKeyVault --query value -o tsv)" -backend-config="key=terraform.tfstate.cli"
View main.tf
terraform {
backend "azurerm" {}
}
resource "azurerm_resource_group" "state-demo-secure-cli" {
name = "state-demo-cli"
location = "eastus"
}
View main.tf
terraform {
backend "azurerm" {
resource_group_name = "tstate"
storage_account_name = "tstate4656"
container_name = "tstate"
key = "terraform.tfstate"
}
}
resource "azurerm_resource_group" "state-demo-secure" {
View remote-backend.sh
#!/bin/bash
RESOURCE_GROUP_NAME=tstate
STORAGE_ACCOUNT_NAME=tstate$RANDOM
CONTAINER_NAME=tstate
KEYVAULT_NAME=tRahulKeyVault
# Create resource group
echo "Creating $RESOURCE_GROUP_NAME resource group..."
az group create --name $RESOURCE_GROUP_NAME --location eastus
View dependencies.json
{
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2019-02-01",
"name": "[parameters('networkSecurityGroupName')]",
"location": "[parameters('location')]",
"tags": {
"demo": "azure"
},
"properties": {
"securityRules": "[parameters('networkSecurityGroupRules')]"
View nic.json
{
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2019-07-01",
"name": "[parameters('networkInterfaceName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]",
"[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]",
"[concat('Microsoft.Network/publicIpAddresses/', parameters('publicIpAddressName'))]"
],
View template.json
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "String"
},
"networkInterfaceName": {
"type": "String"
},
View parameter.json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"value": "eastus"
},
"networkInterfaceName": {
"value": "azvmdemo711"
},
View main.tf
provider "azurerm" {
version = "=2.0.0"
features {}
}
resource "azurerm_resource_group" "terraform-rg" {
name = "terraform-basic"
location = "eastus"
tags = {
env = "dev"
View main.tf
provider "azurerm" {
version = "=2.0.0"
}
resource "azurerm_resource_group" "terraform-basic" {
name = "terraform-basic"
location = "eastus"
}
You can’t perform that action at this time.