Skip to content

Commit f5f04b8

Browse files
authored
Merge pull request #12 from Internet2/slshew-iss-azure
enabled versioning, access time
2 parents 200d9c9 + 44479fa commit f5f04b8

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

Usecases/Intelligent Storage Solution/azure/Readme.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This is a nascent implementation of an intelligent storage solution on Microsoft Azure,
44
managed by Terraform.
5-
The current feature set is limited to lifecycle management, in which the the access tier
5+
The current feature set is limited to lifecycle management, in which the access tier
66
of blob storage is automatically changed
77
from hot to cool to archive based on the last modified time of the blob.
88

@@ -31,14 +31,10 @@ resource "azurerm_resource_group" "i2c23proj" {
3131

3232
## Create storage account and its management policy
3333

34-
Using the last access time of a blob rather than the modification time as the determinant of
35-
when to move a blob to a cooler tier might make more sense.
36-
However, this apparently requires that the
37-
"last access time based tracking policy must be enabled before using its specific actions
38-
in object lifecycle management policy," (the error message returned from `tf apply`),
39-
but it's not obvious how to do that.
34+
Disabling public network access interfered with creating a storage container.
35+
Need to look into that.
4036

41-
Also, Azure storage has hot, cool, cold and archive tiers, but the strings to set these
37+
Azure storage has hot, cool, cold and archive tiers, but the strings to set these
4238
values in Terraform (such as `tier_to_cool_after_days_since_modification_greater_than`)
4339
seem not to have a cold analog.
4440

@@ -56,7 +52,11 @@ resource "azurerm_storage_account" "i2c23proj" {
5652
access_tier = "Hot"
5753
# public_network_access_enabled = false
5854
allow_nested_items_to_be_public = true
59-
# enable_last_access_tracking = true
55+
56+
blob_properties {
57+
versioning_enabled = true
58+
last_access_time_enabled = true
59+
}
6060
}
6161
6262
@@ -71,9 +71,9 @@ resource "azurerm_storage_management_policy" "i2c23proj" {
7171
}
7272
actions {
7373
base_blob {
74-
tier_to_cool_after_days_since_modification_greater_than = var.time_to_cool
75-
tier_to_archive_after_days_since_modification_greater_than = var.time_to_archive
76-
delete_after_days_since_modification_greater_than = var.time_to_delete
74+
tier_to_cool_after_days_since_last_access_time_greater_than = var.time_to_cool
75+
tier_to_archive_after_days_since_last_access_time_greater_than = var.time_to_archive
76+
delete_after_days_since_last_access_time_greater_than = var.time_to_delete
7777
}
7878
snapshot {
7979
delete_after_days_since_creation_greater_than = var.snapshot_retention

Usecases/Intelligent Storage Solution/azure/main.tf

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ resource "azurerm_storage_account" "i2c23proj" {
2424
access_tier = "Hot"
2525
# public_network_access_enabled = false
2626
allow_nested_items_to_be_public = true
27-
# enable_last_access_tracking = true
27+
28+
blob_properties {
29+
versioning_enabled = true
30+
last_access_time_enabled = true
31+
}
2832
}
2933

3034
#resource "azurerm_role_assignment" "role_assignment" {
@@ -44,13 +48,13 @@ resource "azurerm_storage_management_policy" "i2c23proj" {
4448
}
4549
actions {
4650
base_blob {
47-
# I'd rather use last_access_time than modification, but can't figure out
48-
# how to set that up (`tf apply` tells me "Last access time based tracking policy
49-
# must be enabled before using its specific actions in object lifecycle management policy."
51+
# Note that to use days since last_access_time to move blobs to cooler storage,
52+
# last_access_time_enabled must be set to true in the blob_properties block in
53+
# the storage account above.
5054
#
51-
tier_to_cool_after_days_since_modification_greater_than = var.time_to_cool
52-
tier_to_archive_after_days_since_modification_greater_than = var.time_to_archive
53-
delete_after_days_since_modification_greater_than = var.time_to_delete
55+
tier_to_cool_after_days_since_last_access_time_greater_than = var.time_to_cool
56+
tier_to_archive_after_days_since_last_access_time_greater_than = var.time_to_archive
57+
delete_after_days_since_last_access_time_greater_than = var.time_to_delete
5458
}
5559
snapshot {
5660
delete_after_days_since_creation_greater_than = var.snapshot_retention

0 commit comments

Comments
 (0)