-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Rudra Gupta <[email protected]>
- Loading branch information
1 parent
290cd70
commit d3592a8
Showing
12 changed files
with
156 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
terraform { | ||
backend "azurerm" { | ||
resource_group_name = "cfi-tfs-rg-name" | ||
storage_account_name = "cfitfsstoragename" | ||
container_name = "cfi-tfs-container-name" | ||
key = "cfi-blob.tfstate" | ||
tenant_id = "aa7600f5-0d7c-4503-8da7-0513529847ac" | ||
subscription_id = "8f0829d1-a216-42ec-8609-b6c345b7bf4e" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,29 @@ | ||
resource "azurerm_resource_group" "this" { | ||
# Create a Resource Group if it doesn’t exist | ||
resource "azurerm_resource_group" "tfexample" { | ||
name = var.resource_group_name | ||
location = var.location | ||
tags = var.tags | ||
} | ||
|
||
resource "azurerm_storage_account" "this" { | ||
# Create a Storage account | ||
resource "azurerm_storage_account" "terraform_state" { | ||
name = var.storage_account_name | ||
resource_group_name = azurerm_resource_group.this.name | ||
location = azurerm_resource_group.this.location | ||
account_tier = var.account_tier | ||
account_replication_type = var.account_replication_type | ||
resource_group_name = azurerm_resource_group.tfexample.name | ||
location = azurerm_resource_group.tfexample.location | ||
account_tier = "Standard" | ||
account_replication_type = "LRS" | ||
|
||
blob_properties { | ||
versioning_enabled = var.enable_versioning | ||
} | ||
|
||
tags = var.tags | ||
} | ||
|
||
resource "azurerm_storage_container" "this" { | ||
count = length(var.container_names) | ||
name = var.container_names[count.index] | ||
storage_account_name = azurerm_storage_account.this.name | ||
container_access_type = var.container_access_type | ||
} | ||
|
||
# Create a Storage container | ||
resource "azurerm_storage_container" "terraform_state" { | ||
name = var.container_name | ||
storage_account_name = azurerm_storage_account.terraform_state.name | ||
container_access_type = "private" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,29 @@ | ||
# Output variable: Blob Storage container name | ||
# output "blob_storage_container" { | ||
# value = "https://${azurerm_storage_account.terraform_state.name}.blob.core.windows.net/${azurerm_storage_container.terraform_state.name}/" | ||
# } | ||
|
||
output "resource_group_name" { | ||
description = "Name of the created resource group" | ||
value = azurerm_resource_group.this.name | ||
value = azurerm_resource_group.tfexample.name | ||
} | ||
|
||
output "storage_account_id" { | ||
description = "ID of the created storage account" | ||
value = azurerm_storage_account.this.id | ||
value = azurerm_storage_account.terraform_state.id | ||
} | ||
|
||
output "storage_account_name" { | ||
description = "Name of the created storage account" | ||
value = azurerm_storage_account.this.name | ||
value = azurerm_storage_account.terraform_state.name | ||
} | ||
|
||
output "primary_blob_endpoint" { | ||
description = "Primary blob endpoint" | ||
value = azurerm_storage_account.this.primary_blob_endpoint | ||
value = azurerm_storage_account.terraform_state.primary_blob_endpoint | ||
} | ||
|
||
output "container_names" { | ||
output "container_name" { | ||
description = "Names of the created containers" | ||
value = azurerm_storage_container.this[*].name | ||
} | ||
value = azurerm_storage_container.terraform_state.name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
# Set the Azure Provider source and version being used | ||
terraform { | ||
required_version = ">= 0.13.0" | ||
required_version = ">= 0.14" | ||
|
||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = ">= 2.0" | ||
version = "~> 3.1.0" | ||
} | ||
} | ||
} | ||
|
||
provider "azurerm" { | ||
features {} | ||
subscription_id = "0000000-0000-00000-000000" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
RESOURCE_GROUP_NAME=cfi-tfs-rg-name #tfstate | ||
STORAGE_ACCOUNT_NAME=cfitfsstoragename #tfstate713 #Unique Name | ||
CONTAINER_NAME=cfi-tfs-container-name #tfstate | ||
|
||
# Create resource group | ||
az group create --name $RESOURCE_GROUP_NAME --location eastus | ||
|
||
# Create storage account | ||
az storage account create --resource-group $RESOURCE_GROUP_NAME --name $STORAGE_ACCOUNT_NAME --sku Standard_LRS --encryption-services blob | ||
|
||
# Create blob container | ||
az storage container create --name $CONTAINER_NAME --account-name $STORAGE_ACCOUNT_NAME | ||
|
||
# az ad sp create-for-rbac --name cfiSvcPrincipal --role reader --scopes /subscriptions/8f0829d1-a216-42ec-8609-b6c345b7bf4e | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters