Skip to content

Commit

Permalink
Merge pull request #77 from clouddrove/feat/update
Browse files Browse the repository at this point in the history
feat: Added new resource & fixed deprications
  • Loading branch information
d4kverma authored Nov 26, 2024
2 parents bf70b87 + cb86e52 commit ba7c70b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 38 deletions.
4 changes: 2 additions & 2 deletions examples/complete/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
provider "azurerm" {
features {}
storage_use_azuread = true
subscription_id = "01111111111110-11-11-11-11"
subscription_id = "000001-11111-1223-XXX-XXXXXXXXXXXX"
}

provider "azurerm" {
features {}
alias = "peer"
subscription_id = "01111111111110-11-11-11-11"
subscription_id = "000001-11111-1223-XXX-XXXXXXXXXXXX"
}


Expand Down
79 changes: 43 additions & 36 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -131,36 +131,6 @@ resource "azurerm_storage_account" "storage" {
choice = routing.value.choice
}
}
dynamic "queue_properties" {
for_each = var.queue_properties_logging != null && contains(["Storage", "StorageV2"], var.account_kind) ? [1] : []
content {
logging {
delete = var.queue_properties_logging.delete
read = var.queue_properties_logging.read
write = var.queue_properties_logging.write
version = var.queue_properties_logging.version
retention_policy_days = var.queue_properties_logging.retention_policy_days
}
dynamic "hour_metrics" {
for_each = var.enable_hour_metrics ? var.hour_metrics : {}
content {
enabled = hour_metrics.value.enabled
version = hour_metrics.value.version
include_apis = hour_metrics.value.include_apis
retention_policy_days = hour_metrics.value.retention_policy_days
}
}
dynamic "minute_metrics" {
for_each = var.enable_minute_metrics ? toset(var.minute_metrics) : []
content {
enabled = minute_metrics.value.enabled
version = minute_metrics.value.version
include_apis = minute_metrics.value.include_apis
retention_policy_days = minute_metrics.value.retention_policy_days
}
}
}
}
dynamic "share_properties" {
for_each = var.file_share_cors_rules != null && var.file_share_retention_policy_in_days != null && var.file_share_properties_smb != null ? [1] : []
content {
Expand Down Expand Up @@ -208,6 +178,43 @@ resource "azurerm_storage_account" "storage" {
}
}

##-----------------------------------------------------------------------------
## Below resource will create queue properties for storage account
##-----------------------------------------------------------------------------

resource "azurerm_storage_account_queue_properties" "queue_properties" {
count = var.queue_properties_logging != null && contains(["Storage", "StorageV2"], var.account_kind) ? 1 : 0
storage_account_id = azurerm_storage_account.storage[0].id

dynamic "logging" {
for_each = var.queue_properties_logging != null && contains(["Storage", "StorageV2"], var.account_kind) ? [1] : []
content {
delete = var.queue_properties_logging.delete
read = var.queue_properties_logging.read
write = var.queue_properties_logging.write
version = var.queue_properties_logging.version
retention_policy_days = var.queue_properties_logging.retention_policy_days
}
}

dynamic "hour_metrics" {
for_each = var.enable_hour_metrics ? var.hour_metrics : {}
content {
include_apis = hour_metrics.value.include_apis
version = hour_metrics.value.version
retention_policy_days = hour_metrics.value.retention_policy_days
}
}
dynamic "minute_metrics" {
for_each = var.enable_minute_metrics ? toset(var.minute_metrics) : []
content {
version = minute_metrics.value.version
include_apis = minute_metrics.value.include_apis
retention_policy_days = minute_metrics.value.retention_policy_days
}
}
}

##-----------------------------------------------------------------------------
## Below resource will create user assigned identity in your azure environment.
## This user assigned identity will be created when storage account with cmk is created.
Expand Down Expand Up @@ -359,19 +366,19 @@ resource "azurerm_storage_container" "container" {
provider = azurerm.main_sub
count = var.enabled ? length(var.containers_list) : 0
name = var.containers_list[count.index].name
storage_account_name = azurerm_storage_account.storage[0].name
storage_account_id = azurerm_storage_account.storage[0].id
container_access_type = var.containers_list[count.index].access_type
}

##-----------------------------------------------------------------------------
## Below resource will create file share in storage account.
##-----------------------------------------------------------------------------
resource "azurerm_storage_share" "fileshare" {
provider = azurerm.main_sub
count = var.enabled ? length(var.file_shares) : 0
name = var.file_shares[count.index].name
storage_account_name = azurerm_storage_account.storage[0].name
quota = var.file_shares[count.index].quota
provider = azurerm.main_sub
count = var.enabled ? length(var.file_shares) : 0
name = var.file_shares[count.index].name
storage_account_id = azurerm_storage_account.storage[0].id
quota = var.file_shares[count.index].quota
}

##-----------------------------------------------------------------------------
Expand Down

0 comments on commit ba7c70b

Please sign in to comment.