From b8e57e7848d1e452d2e7f6d4c29d28555fe62eca Mon Sep 17 00:00:00 2001 From: sebastianlolv Date: Tue, 10 May 2022 13:58:31 +0200 Subject: [PATCH 1/6] feat: add file storage rentention policy block and variable --- main.tf | 4 ++++ variables.tf | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/main.tf b/main.tf index 8180dba..5e29f0e 100644 --- a/main.tf +++ b/main.tf @@ -33,6 +33,10 @@ resource "azurerm_storage_account" "this" { } } + share_properties { + retention_policy = var.file_storage_retention_policy + } + network_rules { default_action = length(var.network_ip_rules) == 0 ? "Allow" : "Deny" bypass = ["AzureServices"] diff --git a/variables.tf b/variables.tf index 03458b1..9b4831e 100644 --- a/variables.tf +++ b/variables.tf @@ -66,6 +66,12 @@ variable "blob_delete_retention_policy" { default = 30 } +variable "file_storage_retention_policy" { + description = "The number of days that files should be retained" + type = number + default = 30 +} + variable "network_ip_rules" { description = "The public IPs or IP ranges in CIDR format that should be able to access this Storage Account. Only IPv4 addresses are allowed." type = list(string) From 44bf81d98cd3b9f8f3049653bd9a4e6e0f369c6f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 10 May 2022 12:01:28 +0000 Subject: [PATCH 2/6] terraform-docs: automated action --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2893b1a..36825c3 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ No modules. | [environment](#input\_environment) | The environment to create the resources for. | `string` | n/a | yes | | [file\_contributors](#input\_file\_contributors) | The IDs of the Azure AD objects that should have Contributor access to this File Storage. | `list(string)` | `[]` | no | | [file\_readers](#input\_file\_readers) | The IDs of the Azure AD objects that should have Reader access to this File Storage. | `list(string)` | `[]` | no | +| [file\_storage\_retention\_policy](#input\_file\_storage\_retention\_policy) | The number of days that files should be retained | `number` | `30` | no | | [location](#input\_location) | The supported Azure location where the resources exist. | `string` | n/a | yes | | [network\_ip\_rules](#input\_network\_ip\_rules) | The public IPs or IP ranges in CIDR format that should be able to access this Storage Account. Only IPv4 addresses are allowed. | `list(string)` | `[]` | no | | [queue\_contributors](#input\_queue\_contributors) | The IDs of the Azure AD objects that should have Contributor access to this Queue Storage. | `list(string)` | `[]` | no | From 37726420c52fe455c0dc0a5bc4b60d16651b1aa9 Mon Sep 17 00:00:00 2001 From: sebastianlolv Date: Tue, 10 May 2022 15:18:33 +0200 Subject: [PATCH 3/6] fix: share properties block and retention policy block --- main.tf | 4 +++- variables.tf | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 5e29f0e..60a0fbf 100644 --- a/main.tf +++ b/main.tf @@ -34,7 +34,9 @@ resource "azurerm_storage_account" "this" { } share_properties { - retention_policy = var.file_storage_retention_policy + retention_policy { + days = var.file_retention_policy + } } network_rules { diff --git a/variables.tf b/variables.tf index 9b4831e..4110347 100644 --- a/variables.tf +++ b/variables.tf @@ -66,7 +66,7 @@ variable "blob_delete_retention_policy" { default = 30 } -variable "file_storage_retention_policy" { +variable "file_retention_policy" { description = "The number of days that files should be retained" type = number default = 30 From 6a87f20eda991a2dfa264158ac7be57c3e123fe6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 10 May 2022 13:19:51 +0000 Subject: [PATCH 4/6] terraform-docs: automated action --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 36825c3..103146b 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ No modules. | [environment](#input\_environment) | The environment to create the resources for. | `string` | n/a | yes | | [file\_contributors](#input\_file\_contributors) | The IDs of the Azure AD objects that should have Contributor access to this File Storage. | `list(string)` | `[]` | no | | [file\_readers](#input\_file\_readers) | The IDs of the Azure AD objects that should have Reader access to this File Storage. | `list(string)` | `[]` | no | -| [file\_storage\_retention\_policy](#input\_file\_storage\_retention\_policy) | The number of days that files should be retained | `number` | `30` | no | +| [file\_retention\_policy](#input\_file\_retention\_policy) | The number of days that files should be retained | `number` | `30` | no | | [location](#input\_location) | The supported Azure location where the resources exist. | `string` | n/a | yes | | [network\_ip\_rules](#input\_network\_ip\_rules) | The public IPs or IP ranges in CIDR format that should be able to access this Storage Account. Only IPv4 addresses are allowed. | `list(string)` | `[]` | no | | [queue\_contributors](#input\_queue\_contributors) | The IDs of the Azure AD objects that should have Contributor access to this Queue Storage. | `list(string)` | `[]` | no | From f9642d8f618cbd092324477f2931f4e8fef1cbac Mon Sep 17 00:00:00 2001 From: Sebastian Hana <43113824+sebastianlolv@users.noreply.github.com> Date: Wed, 11 May 2022 08:15:29 +0200 Subject: [PATCH 5/6] Update variables.tf Co-authored-by: Henrik Knutsen --- variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variables.tf b/variables.tf index 4110347..5340ad3 100644 --- a/variables.tf +++ b/variables.tf @@ -67,7 +67,7 @@ variable "blob_delete_retention_policy" { } variable "file_retention_policy" { - description = "The number of days that files should be retained" + description = "The number of days that files should be retained." type = number default = 30 } From d73fbcb58001fd7509b986df0d2b457e7de27fb5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 11 May 2022 06:15:46 +0000 Subject: [PATCH 6/6] terraform-docs: automated action --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 103146b..d361814 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ No modules. | [environment](#input\_environment) | The environment to create the resources for. | `string` | n/a | yes | | [file\_contributors](#input\_file\_contributors) | The IDs of the Azure AD objects that should have Contributor access to this File Storage. | `list(string)` | `[]` | no | | [file\_readers](#input\_file\_readers) | The IDs of the Azure AD objects that should have Reader access to this File Storage. | `list(string)` | `[]` | no | -| [file\_retention\_policy](#input\_file\_retention\_policy) | The number of days that files should be retained | `number` | `30` | no | +| [file\_retention\_policy](#input\_file\_retention\_policy) | The number of days that files should be retained. | `number` | `30` | no | | [location](#input\_location) | The supported Azure location where the resources exist. | `string` | n/a | yes | | [network\_ip\_rules](#input\_network\_ip\_rules) | The public IPs or IP ranges in CIDR format that should be able to access this Storage Account. Only IPv4 addresses are allowed. | `list(string)` | `[]` | no | | [queue\_contributors](#input\_queue\_contributors) | The IDs of the Azure AD objects that should have Contributor access to this Queue Storage. | `list(string)` | `[]` | no |