Skip to content

Commit

Permalink
terraform-module: Container App storage (#36)
Browse files Browse the repository at this point in the history
* Add storage

* Update outputs and variables

* Update account kind
  • Loading branch information
simongottschlag authored Mar 3, 2023
1 parent f5e7ce8 commit 363cbd2
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
15 changes: 15 additions & 0 deletions terraform-module/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,18 @@ output "azcagit_trigger_group_object_id" {
description = "The Object ID for the azcagit trigger permission"
value = azuread_group.azcagit_trigger.id
}

output "container_app_environment" {
description = "The Container App Environment"
value = azurerm_container_app_environment.this
}

output "platform_resource_group" {
description = "The platform resource group"
value = azurerm_resource_group.platform
}

output "tenant_resource_group" {
description = "The tenant resource group"
value = azurerm_resource_group.tenant
}
25 changes: 25 additions & 0 deletions terraform-module/platform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,31 @@ resource "azurerm_container_app_environment" "this" {
internal_load_balancer_enabled = false
}

resource "azurerm_storage_account" "this" {
name = "sa${replace(local.eln, "-", "")}${var.unique_suffix}"
resource_group_name = azurerm_resource_group.platform.name
location = azurerm_resource_group.platform.location
account_tier = "Premium"
account_kind = "FileStorage"
account_replication_type = var.storage_configuration.account_replication_type

}

resource "azurerm_storage_share" "this" {
name = "containerapps"
storage_account_name = azurerm_storage_account.this.name
quota = var.storage_configuration.share_quota
}

resource "azurerm_container_app_environment_storage" "this" {
name = "storage"
container_app_environment_id = azurerm_container_app_environment.this.id
account_name = azurerm_storage_account.this.name
share_name = azurerm_storage_share.this.name
access_key = azurerm_storage_account.this.primary_access_key
access_mode = "ReadWrite"
}

resource "azurerm_servicebus_namespace" "azcagit_trigger" {
name = "sb${replace(local.eln, "-", "")}${var.unique_suffix}"
location = azurerm_resource_group.platform.location
Expand Down
12 changes: 12 additions & 0 deletions terraform-module/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,15 @@ variable "aad_resource_owner_object_ids" {
type = list(string)
default = []
}

variable "storage_configuration" {
description = "The storage configuration"
type = object({
account_replication_type = string
share_quota = string
})
default = {
account_replication_type = "ZRS"
share_quota = 128
}
}

0 comments on commit 363cbd2

Please sign in to comment.