Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

private blobstorage to store party contracts #33

Merged
merged 12 commits into from
Nov 4, 2021
40 changes: 40 additions & 0 deletions src/core/storage.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
resource "azurerm_resource_group" "rg_storage" {
name = format("%s-storage-rg", local.project)
location = var.location
tags = var.tags
}

## Storage account to save blob
#tfsec:ignore:azure-storage-default-action-deny
module "selc-blob-storage" {
source = "git::https://github.com/pagopa/azurerm.git//storage_account?ref=v1.0.79"

name = replace(format("%s-blobstorage", local.project), "-", "")
account_kind = "StorageV2"
account_tier = "Standard"
account_replication_type = "LRS"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since in this storage will be stored contracts I suggest to use RA-GZRS for production env (LRS for dev,uat)
https://docs.microsoft.com/en-us/azure/storage/common/storage-redundancy#durability-and-availability-parameters

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iwoak how much days should we configure the delete retention period in prod? in other environment it'sok to set 1 day?

access_tier = "Hot"
enable_versioning = false
resource_group_name = azurerm_resource_group.rg_storage.name
location = var.location
advanced_threat_protection = false
allow_blob_public_access = false

tags = var.tags
}

# Container parties contracts
resource "azurerm_storage_container" "selc-contracts" {
name = format("%s-contracts-blob", local.project)
storage_account_name = module.selc-blob-storage.name
container_access_type = "private"
}

#tfsec:ignore:AZU023
resource "azurerm_key_vault_secret" "selc_blobstorage_key" {
name = "blobstorage-access-key"
value = module.selc-blob-storage.primary_access_key
content_type = "text/plain"

key_vault_id = module.key_vault.id
}