Skip to content

Commit 42df775

Browse files
authored
Merge pull request #8 from kumarvna/develop
Identity and blob properties update
2 parents 9d9becd + 3f92c28 commit 42df775

File tree

11 files changed

+67
-30
lines changed

11 files changed

+67
-30
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# .tfstate files
66
*.tfstate
77
*.tfstate.*
8+
*.terraform.lock.hcl
89

910
# Crash log files
1011
crash.log

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Terraform Module to create an Azure storage account with a set of containers (an
44

55
To defines the kind of account, set the argument to `account_kind = "StorageV2"`. Account kind defaults to `StorageV2`. If you want to change this value to other storage accounts kind, then this module automatically computes the appropriate values for `account_tier`, `account_replication_type`. The valid options are `BlobStorage`, `BlockBlobStorage`, `FileStorage`, `Storage` and `StorageV2`. `static_website` can only be set when the account_kind is set to `StorageV2`.
66

7-
> **[NOTE]**
7+
> **[!NOTE]**
88
> **This module now supports the meta arguments including `providers`, `depends_on`, `count`, and `for_each`.**
99
10-
## resources are supported:
10+
## resources are supported
1111

1212
* [Storage Account](https://www.terraform.io/docs/providers/azurerm/r/storage_account.html)
1313
* [Storage Advanced Threat Protection](https://www.terraform.io/docs/providers/azurerm/r/advanced_threat_protection.html)
@@ -28,7 +28,7 @@ provider "azurerm" {
2828
2929
module "storage" {
3030
source = "kumarvna/storage/azurerm"
31-
version = "2.3.0"
31+
version = "2.4.0"
3232
3333
# By default, this module will not create a resource group
3434
# proivde a name to use an existing resource group, specify the existing resource group name,
@@ -75,7 +75,8 @@ module "storage" {
7575

7676
By default, this module will not create a resource group and the name of an existing resource group to be given in an argument `resource_group_name`. If you want to create a new resource group, set the argument `create_resource_group = true`.
7777

78-
*If you are using an existing resource group, then this module uses the same resource group location to create all resources in this module.*
78+
> [!NOTE]
79+
> *If you are using an existing resource group, then this module uses the same resource group location to create all resources in this module.*
7980
8081
## BlockBlobStorage accounts
8182

@@ -105,11 +106,16 @@ Azure Files offers fully managed file shares in the cloud that are accessible vi
105106

106107
This module creates the SMB file shares based on your input within an Azure Storage Account. Configure the `quota` for this file share as per your preference. The maximum size of the share, in gigabytes. For Standard storage accounts, this must be greater than `0` and less than `5120` GB (5 TB). For Premium FileStorage storage accounts, this must be greater than `100` GB and less than `102400` GB (100 TB).
107108

108-
## Soft delete for Blob storage
109+
## Soft delete for Blobs or Containers
109110

110-
Soft delete protects blob data from being accidentally or erroneously modified or deleted. When soft delete is enabled for a storage account, blobs, blob versions (preview), and snapshots in that storage account may be recovered after they are deleted, within a retention period that you specify.
111+
Soft delete protects blob data from being accidentally or erroneously modified or deleted. When soft delete is enabled for a storage account, containers, blobs, blob versions, and snapshots in that storage account may be recovered after they are deleted, within a retention period that you specify.
111112

112-
This module allows you to specify the number of days that the blob should be retained period using `soft_delete_retention` argument between 1 and 365 days.
113+
This module allows you to specify the number of days that the blob or container should be retained period using `blob_soft_delete_retention_days` and `container_soft_delete_retention_days` arguments between 1 and 365 days. Default is `7` days.
114+
115+
> [!WARNING]
116+
> Container soft delete can restore only whole containers and their contents at the time of deletion. You cannot restore a deleted blob within a container by using container soft delete. Microsoft recommends also enabling blob soft delete and blob versioning to protect individual blobs in a container.
117+
>
118+
> When you restore a container, you must restore it to its original name. If the original name has been used to create a new container, then you will not be able to restore the soft-deleted container.
113119
114120
## Configure Azure Storage firewalls and virtual networks
115121

@@ -120,7 +126,7 @@ The default action set to `Allow` when no network rules matched. A `subnet_ids`
120126
```hcl
121127
module "storage" {
122128
source = "kumarvna/storage/azurerm"
123-
version = "2.3.0"
129+
version = "2.4.0"
124130
125131
# .... omitted
126132
@@ -153,7 +159,7 @@ This module supports the implementation of storage lifecycle management. If spec
153159
```hcl
154160
module "storage" {
155161
source = "kumarvna/storage/azurerm"
156-
version = "2.3.0"
162+
version = "2.4.0"
157163
158164
# .... omitted
159165
@@ -185,8 +191,8 @@ module "storage" {
185191
Applying tags to your Azure resources, resource groups, and subscriptions to logically organize them into a taxonomy. Each tag consists of a name and a value pair. For example, you can apply the name `Environment` and the value `Production` to all the resources in production.
186192
For recommendations on how to implement a tagging strategy, see Resource naming and tagging decision guide.
187193

188-
>**Important** :
189-
Tag names are case-insensitive for operations. A tag with a tag name, regardless of the casing, is updated or retrieved. However, the resource provider might keep the casing you provide for the tag name. You'll see that casing in cost reports. **Tag values are case-sensitive.**
194+
> [!IMPORTANT]
195+
> Tag names are case-insensitive for operations. A tag with a tag name, regardless of the casing, is updated or retrieved. However, the resource provider might keep the casing you provide for the tag name. You'll see that casing in cost reports. **Tag values are case-sensitive.**
190196
191197
An effective naming convention assembles resource names by using important resource information as parts of a resource's name. For example, using these [recommended naming conventions](https://docs.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/naming-and-tagging#example-names), a public IP resource for a production SharePoint workload is named like this: `pip-sharepoint-prod-westus-001`.
192198

@@ -215,8 +221,11 @@ Name | Description | Type | Default
215221
`skuname`|The SKUs supported by Microsoft Azure Storage. Valid options are Premium_LRS, Premium_ZRS, Standard_GRS, Standard_GZRS, Standard_LRS, Standard_RAGRS, Standard_RAGZRS, Standard_ZRS|string|`Standard_RAGRS`
216222
`access_tier`|Defines the access tier for BlobStorage and StorageV2 accounts. Valid options are Hot and Cool.|string|`"Hot"`
217223
`min_tls_version`|The minimum supported TLS version for the storage account. Possible values are `TLS1_0`, `TLS1_1`, and `TLS1_2` |string|`"TLS1_2"`
218-
`assign_identity`|Set to `true` to enable system-assigned managed identity, or `false` to disable it.|string|`true`
219-
`soft_delete_retention`|Number of retention days for soft delete. If set to null it will disable soft delete all together.|number|`30`
224+
`blob_soft_delete_retention_days`|Specifies the number of days that the blob should be retained, between `1` and `365` days.|number|`7`
225+
`container_soft_delete_retention_days`|Specifies the number of days that the blob should be retained, between `1` and `365` days.|number|`7`
226+
`enable_versioning`|Is versioning enabled?|string|`false`
227+
`last_access_time_enabled`|Is the last access time based tracking enabled?|string|`false`
228+
`change_feed_enabled`|Is the blob service properties for change feed events enabled?|string|`false`
220229
`enable_advanced_threat_protection`|Controls Advance threat protection plan for Storage account!string|`false`
221230
`network_rules`|Configure Azure storage firewalls and virtual networks|list|`null`
222231
`containers_list`| List of container|list|`[]`

examples/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ provider "azurerm" {
1414
1515
module "storage" {
1616
source = "kumarvna/storage/azurerm"
17-
version = "2.3.0"
17+
version = "2.4.0"
1818
1919
# By default, this module will not create a resource group
2020
# proivde a name to use an existing resource group, specify the existing resource group name,
@@ -54,7 +54,7 @@ provider "azurerm" {
5454
5555
module "storage" {
5656
source = "kumarvna/storage/azurerm"
57-
version = "2.3.0"
57+
version = "2.4.0"
5858
5959
# By default, this module will not create a resource group
6060
# proivde a name to use an existing resource group, specify the existing resource group name,
@@ -94,7 +94,7 @@ provider "azurerm" {
9494
9595
module "storage" {
9696
source = "kumarvna/storage/azurerm"
97-
version = "2.3.0"
97+
version = "2.4.0"
9898
9999
# By default, this module will not create a resource group
100100
# proivde a name to use an existing resource group, specify the existing resource group name,

examples/complete/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ provider "azurerm" {
1010
1111
module "storage" {
1212
source = "kumarvna/storage/azurerm"
13-
version = "2.3.0"
13+
version = "2.4.0"
1414
1515
# By default, this module will not create a resource group
1616
# proivde a name to use an existing resource group, specify the existing resource group name,

examples/complete/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ provider "azurerm" {
55

66
module "storage" {
77
source = "kumarvna/storage/azurerm"
8-
version = "2.3.0"
8+
version = "2.4.0"
99

1010
# By default, this module will not create a resource group
1111
# proivde a name to use an existing resource group, specify the existing resource group name,

examples/storage_account_with_containers/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ provider "azurerm" {
1212
1313
module "storage" {
1414
source = "kumarvna/storage/azurerm"
15-
version = "2.3.0"
15+
version = "2.4.0"
1616
1717
# By default, this module will not create a resource group
1818
# proivde a name to use an existing resource group, specify the existing resource group name,

examples/storage_account_with_containers/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ provider "azurerm" {
55

66
module "storage" {
77
source = "kumarvna/storage/azurerm"
8-
version = "2.3.0"
8+
version = "2.4.0"
99

1010
# By default, this module will not create a resource group
1111
# proivde a name to use an existing resource group, specify the existing resource group name,

examples/storage_account_with_fileshares/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ provider "azurerm" {
1212
1313
module "storage" {
1414
source = "kumarvna/storage/azurerm"
15-
version = "2.3.0"
15+
version = "2.4.0"
1616
1717
# By default, this module will not create a resource group
1818
# proivde a name to use an existing resource group, specify the existing resource group name,

examples/storage_account_with_fileshares/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ provider "azurerm" {
55

66
module "storage" {
77
source = "kumarvna/storage/azurerm"
8-
version = "2.3.0"
8+
version = "2.4.0"
99

1010
# By default, this module will not create a resource group
1111
# proivde a name to use an existing resource group, specify the existing resource group name,

main.tf

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,20 @@ resource "azurerm_storage_account" "storeacc" {
4545
tags = merge({ "ResourceName" = substr(format("sta%s%s", lower(replace(var.storage_account_name, "/[[:^alnum:]]/", "")), random_string.unique.result), 0, 24) }, var.tags, )
4646

4747
identity {
48-
type = var.assign_identity ? "SystemAssigned" : null
48+
type = var.identity_ids != null ? "SystemAssigned, UserAssigned" : "SystemAssigned"
49+
identity_ids = var.identity_ids
4950
}
5051

5152
blob_properties {
5253
delete_retention_policy {
53-
days = var.soft_delete_retention
54+
days = var.blob_soft_delete_retention_days
5455
}
56+
container_delete_retention_policy {
57+
days = var.container_soft_delete_retention_days
58+
}
59+
versioning_enabled = var.enable_versioning
60+
last_access_time_enabled = var.last_access_time_enabled
61+
change_feed_enabled = var.change_feed_enabled
5562
}
5663

5764
dynamic "network_rules" {

0 commit comments

Comments
 (0)