Skip to content

Commit 4371dac

Browse files
storage account tf module azure DEVOPS-264
1 parent 8d085d7 commit 4371dac

File tree

4 files changed

+133
-0
lines changed

4 files changed

+133
-0
lines changed

storage-account/output.tf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
output "azurerm_resource_group" {
2+
value = azurerm_resource_group.storage_rg.name
3+
}
4+
5+
output "storage_account_name" {
6+
value = azurerm_storage_account.storage.name
7+
}
8+
9+
output "storage_account_location" {
10+
value = azurerm_storage_account.storage.location
11+
}
12+
13+
output "storage_account_delete_retention_policy" {
14+
value = azurerm_storage_account.storage.blob_properties[0].delete_retention_policy
15+
}
16+
17+
output "storage_account_tier" {
18+
value = azurerm_storage_account.storage.access_tier
19+
}
20+
21+
output "storage_account_replication_type" {
22+
value = azurerm_storage_account.storage.account_replication_type
23+
}
24+
25+
output "storage_account_tags" {
26+
value = azurerm_storage_account.storage.tags
27+
}

storage-account/providers.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
terraform {
2+
required_version = "~> 1.3"
3+
required_providers {
4+
azurerm = {
5+
source = "hashicorp/azurerm"
6+
version = "~> 3.0"
7+
}
8+
random = {
9+
source = "hashicorp/random"
10+
version = ">= 3.1"
11+
}
12+
}
13+
}
14+
provider "azurerm" {
15+
features {}
16+
}

storage-account/storageaccount.tf

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
resource "azurerm_resource_group" "storage_rg" {
2+
name = var.resource_group_name
3+
location = var.location
4+
tags = {
5+
Environment = upper(var.environment)
6+
Orchestrator = "Terraform"
7+
DisplayName = upper(var.resource_group_name)
8+
ApplicationName = lower(var.application_name)
9+
}
10+
}
11+
12+
resource "azurerm_storage_account" "storage" {
13+
name = var.storage_account_name
14+
resource_group_name = azurerm_resource_group.storage_rg.name
15+
location = azurerm_resource_group.storage_rg.location
16+
account_tier = var.account_tier
17+
account_replication_type = var.account_replication_type
18+
account_kind = var.account_kind
19+
cross_tenant_replication_enabled = var.cross_tenant_replication_enabled
20+
public_network_access_enabled = var.public_network_access_enabled
21+
22+
blob_properties {
23+
delete_retention_policy {
24+
days = var.delete_retention_policy
25+
}
26+
}
27+
28+
tags = {
29+
Environment = upper(var.environment)
30+
Orchestrator = "Terraform"
31+
DisplayName = upper(var.storage_account_name)
32+
ApplicationName = lower(var.application_name)
33+
}
34+
}

storage-account/variables.tf

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
variable "resource_group_name" {
2+
type = string
3+
description = "Azure Storage Account Rg"
4+
}
5+
6+
variable "location" {
7+
type = string
8+
description = "Azure storage account location"
9+
default = "centralindia"
10+
}
11+
12+
variable "storage_account_name" {
13+
description = "Azure Storage Account name"
14+
type = string
15+
16+
}
17+
18+
variable "account_tier" {
19+
default = "Standard"
20+
description = "Tier to use for this storage account. Valid options are Standard and Premium"
21+
}
22+
23+
variable "account_kind" {
24+
default = "StorageV2"
25+
description = "Kind of account. Valid options are BlobStorage, BlockBlobStorage, FileStorage, Storage and StorageV2"
26+
}
27+
28+
variable "account_replication_type" {
29+
description = "type of replication to use for this storage account. Valid options are LRS, GRS, RAGRS, ZRS, GZRS and RAGZRS"
30+
default = "LRS"
31+
}
32+
33+
variable "cross_tenant_replication_enabled" {
34+
default = false
35+
description = "Should cross Tenant replication be enabled"
36+
}
37+
38+
variable "public_network_access_enabled" {
39+
default = true
40+
description = "Whether the public network access is enabled"
41+
}
42+
43+
variable "delete_retention_policy" {
44+
default = 10
45+
description = "Specifies the number of days that the blob should be retained"
46+
}
47+
48+
variable "environment" {
49+
default = "DEV"
50+
description = "Environment tag value in Azure"
51+
}
52+
53+
variable "application_name" {
54+
default = "devwithkrishna"
55+
description = "Azure application name tag"
56+
}

0 commit comments

Comments
 (0)