diff --git a/azure/terraform/gitlab.tf b/azure/terraform/gitlab.tf index 5ec6f85..3f9c8b7 100644 --- a/azure/terraform/gitlab.tf +++ b/azure/terraform/gitlab.tf @@ -1,22 +1,28 @@ # create a kubernetes cluster for a given environment # and deploy a gitlab instance on it # The cluster is deployed in its own resource group # suffixed by the environment # module "gitlab-production" { # source = "./modules/gitlab" # name = "euwest-gitlab-production" # } # output "gitlab-production_summary" { # value = module.gitlab-production.summary # } 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 index 02d1146..5ce67c3 100644 --- a/azure/terraform/modules/gitlab/main.tf +++ b/azure/terraform/modules/gitlab/main.tf @@ -1,22 +1,51 @@ resource "azurerm_resource_group" "gitlab_rg" { name = var.name location = var.location tags = { environment = "gitlab" } } +# kubernetes cluster for compute and storage module "gitlab_aks_cluster" { source = "../kubernetes" cluster_name = var.name resource_group = var.name minimal_pool_count = 1 maximal_pool_count = 5 node_type = "Standard_B2ms" depends_on = [ 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 index 7a53952..0914fd4 100644 --- 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 = <