@@ -17,25 +17,34 @@ To defines the kind of account, set the argument to `account_kind = "StorageV2"`
1717* [ Storage Queue] ( https://www.terraform.io/docs/providers/azurerm/r/storage_queue.html )
1818* [ Network Policies] ( https://www.terraform.io/docs/providers/azurerm/r/storage_account.html#network_rules )
1919* [ Azure Blob storage lifecycle] ( https://www.terraform.io/docs/providers/azurerm/r/storage_management_policy.html )
20+ * [ Managed Service Identity] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_account#identity )
2021
2122## Module Usage
2223
23- ``` hcl
24+ ``` terraform
2425# Azure Provider configuration
2526provider "azurerm" {
2627 features {}
2728}
2829
30+ resource "azurerm_user_assigned_identity" "example" {
31+ for_each = toset(["user-identity1", "user-identity2"])
32+ resource_group_name = "rg-shared-westeurope-01"
33+ location = "westeurope"
34+ name = each.key
35+ }
36+
2937module "storage" {
3038 source = "kumarvna/storage/azurerm"
3139 version = "2.5.0"
3240
3341 # By default, this module will not create a resource group
34- # proivde a name to use an existing resource group, specify the existing resource group name,
35- # and set the argument to `create_resource_group = false`. Location will be same as existing RG.
36- resource_group_name = "rg-demo-internal-shared-westeurope-002"
37- location = "westeurope"
38- storage_account_name = "mydefaultstorage"
42+ # proivde a name to use an existing resource group, specify the existing resource group name,
43+ # and set the argument to `create_resource_group = false`. Location will be same as existing RG.
44+ create_resource_group = true
45+ resource_group_name = "rg-demo-internal-shared-westeurope-002"
46+ location = "westeurope"
47+ storage_account_name = "mystorage"
3948
4049 # To enable advanced threat protection set argument to `true`
4150 enable_advanced_threat_protection = true
@@ -59,8 +68,32 @@ module "storage" {
5968 # Storage queues
6069 queues = ["queue1", "queue2"]
6170
71+ # Configure managed identities to access Azure Storage (Optional)
72+ # Possible types are `SystemAssigned`, `UserAssigned` and `SystemAssigned, UserAssigned`.
73+ managed_identity_type = "UserAssigned"
74+ managed_identity_ids = [for k in azurerm_user_assigned_identity.example : k.id]
75+
76+ # Lifecycle management for storage account.
77+ # Must specify the value to each argument and default is `0`
78+ lifecycles = [
79+ {
80+ prefix_match = ["mystore250/folder_path"]
81+ tier_to_cool_after_days = 0
82+ tier_to_archive_after_days = 50
83+ delete_after_days = 100
84+ snapshot_delete_after_days = 30
85+ },
86+ {
87+ prefix_match = ["blobstore251/another_path"]
88+ tier_to_cool_after_days = 0
89+ tier_to_archive_after_days = 30
90+ delete_after_days = 75
91+ snapshot_delete_after_days = 30
92+ }
93+ ]
94+
6295 # Adding TAG's to your Azure resources (Required)
63- # ProjectName and Env are already declared above, to use them here, create a varible.
96+ # ProjectName and Env are already declared above, to use them here, create a varible.
6497 tags = {
6598 ProjectName = "demo-internal"
6699 Env = "dev"
@@ -200,7 +233,7 @@ Regardless of the type of identity chosen a managed identity is a service princi
200233``` terraform
201234resource "azurerm_user_assigned_identity" "example" {
202235 for_each = toset(["user-identity1", "user-identity2"])
203- resource_group_name = "rg-demo-internal- shared-westeurope-002 "
236+ resource_group_name = "rg-shared-westeurope-01 "
204237 location = "westeurope"
205238 name = each.key
206239}
@@ -235,15 +268,15 @@ An effective naming convention assembles resource names by using important resou
235268
236269| Name | Version |
237270| ------| ---------|
238- | terraform | >= 0.13 |
239- | azurerm | >= 2.59 .0 |
271+ | terraform | >= 1.1.0 |
272+ | azurerm | >= 3.1 .0 |
240273
241274## Providers
242275
243276| Name | Version |
244277| ------| ---------|
245- | azurerm | >= 2.59 |
246- | random | n/a |
278+ | azurerm | >= 3.1.0 |
279+ | random | >= 3.1.0 |
247280
248281## Inputs
249282
0 commit comments