diff --git a/azure/terraform/gitlab.tf b/azure/terraform/gitlab.tf --- a/azure/terraform/gitlab.tf +++ b/azure/terraform/gitlab.tf @@ -13,10 +13,16 @@ # } module "gitlab-staging" { - source = "./modules/gitlab" - name = "euwest-gitlab-staging" + source = "./modules/gitlab" + name = "euwest-gitlab-staging" + blob_storage_name = "swheuwestgitlabstaging" } -output "gitlab-staging_summary" { - value = module.gitlab-staging.summary +output "gitlab-staging_aks_summary" { + value = module.gitlab-staging.aks_summary +} + +output "gitlab-staging_storage_summary" { + value = module.gitlab-staging.blob_storage_summary + sensitive = true } diff --git a/azure/terraform/modules/gitlab/main.tf b/azure/terraform/modules/gitlab/main.tf --- a/azure/terraform/modules/gitlab/main.tf +++ b/azure/terraform/modules/gitlab/main.tf @@ -7,6 +7,7 @@ } } +# kubernetes cluster for compute and storage module "gitlab_aks_cluster" { source = "../kubernetes" cluster_name = var.name @@ -20,3 +21,31 @@ azurerm_resource_group.gitlab_rg ] } + +# Storage account for the assets +# git lfs / backups / artifacts / pages +# terraform states / registry / ... +resource "azurerm_storage_account" "gitlab_storage" { + name = var.blob_storage_name + resource_group_name = var.name + location = var.location + account_tier = "Standard" + account_replication_type = "LRS" + + blob_properties { + delete_retention_policy { + days = 7 + } + } + + tags = { + environment = "gitlab" + } +} + +resource "azurerm_storage_container" "gitlab_storage_container" { + name = "gitlab-content" + storage_account_name = azurerm_storage_account.gitlab_storage.name + container_access_type = "private" +} + diff --git a/azure/terraform/modules/gitlab/outputs.tf b/azure/terraform/modules/gitlab/outputs.tf --- a/azure/terraform/modules/gitlab/outputs.tf +++ b/azure/terraform/modules/gitlab/outputs.tf @@ -1,3 +1,14 @@ -output "summary" { +output "aks_summary" { value = module.gitlab_aks_cluster.summary } + +output "blob_storage_summary" { + value = <