Skip to content

Commit

Permalink
Cost Report - Tag Gitea shared service (#1941)
Browse files Browse the repository at this point in the history
* Tag gitea shared service

* Fix format

* Upgrade mysql

* Ignore tflint error due to a bug in it.

* CR changes

* Move tflint ignore comment.

* Fix TF fmt.

* Fix TF lint.

* Upgrade gitea version

Co-authored-by: Liza Shakury <lizashakury@Lizas-MacBook-Pro.local>
  • Loading branch information
LizaShak and Liza Shakury committed Jun 2, 2022
1 parent b11954c commit 2d6caa7
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion templates/shared_services/gitea/porter.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: tre-shared-service-gitea
version: 0.3.1
version: 0.3.4
description: "A Gitea shared service"
registry: azuretre
dockerfile: Dockerfile.tmpl
Expand Down
2 changes: 2 additions & 0 deletions templates/shared_services/gitea/terraform/gitea-webapp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ resource "random_password" "gitea_passwd" {
resource "azurerm_user_assigned_identity" "gitea_id" {
resource_group_name = local.core_resource_group_name
location = data.azurerm_resource_group.rg.location
tags = local.tre_shared_service_tags

name = "id-gitea-${var.tre_id}"

Expand All @@ -23,6 +24,7 @@ resource "azurerm_app_service" "gitea" {
app_service_plan_id = data.azurerm_app_service_plan.core.id
https_only = true
key_vault_reference_identity_id = azurerm_user_assigned_identity.gitea_id.id
tags = local.tre_shared_service_tags

app_settings = {
APPINSIGHTS_INSTRUMENTATIONKEY = data.azurerm_application_insights.core.instrumentation_key
Expand Down
4 changes: 4 additions & 0 deletions templates/shared_services/gitea/terraform/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ locals {
keyvault_name = "kv-${var.tre_id}"
version = replace(replace(replace(data.local_file.version.content, "__version__ = \"", ""), "\"", ""), "\n", "")
gitea_allowed_fqdns_list = distinct(compact(split(",", replace(var.gitea_allowed_fqdns, " ", ""))))
tre_shared_service_tags = {
tre_id = var.tre_id
tre_shared_service_id = var.tre_resource_id
}
}
20 changes: 13 additions & 7 deletions templates/shared_services/gitea/terraform/mysql.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ resource "random_password" "password" {
}

resource "azurerm_mysql_server" "gitea" {
name = "mysql-${var.tre_id}"
resource_group_name = local.core_resource_group_name
location = data.azurerm_resource_group.rg.location
administrator_login = "mysqladmin"
administrator_login_password = random_password.password.result
sku_name = "GP_Gen5_2"
storage_mb = 5120
name = "mysql-${var.tre_id}"
resource_group_name = local.core_resource_group_name
location = data.azurerm_resource_group.rg.location
administrator_login = "mysqladmin"
administrator_login_password = random_password.password.result
sku_name = "GP_Gen5_2"
storage_mb = 5120
# Ignoring tflint due to a bug in it.
# TODO: https://github.com/microsoft/AzureTRE/issues/1944
# tflint-ignore: azurerm_mysql_server_invalid_version
version = "8.0"
auto_grow_enabled = true
backup_retention_days = 7
Expand All @@ -22,6 +25,7 @@ resource "azurerm_mysql_server" "gitea" {
public_network_access_enabled = false
ssl_enforcement_enabled = true
ssl_minimal_tls_version_enforced = "TLS1_2"
tags = local.tre_shared_service_tags

lifecycle { ignore_changes = [tags] }
}
Expand All @@ -39,6 +43,7 @@ resource "azurerm_private_endpoint" "private-endpoint" {
location = data.azurerm_resource_group.rg.location
resource_group_name = local.core_resource_group_name
subnet_id = data.azurerm_subnet.shared.id
tags = local.tre_shared_service_tags

private_service_connection {
private_connection_resource_id = azurerm_mysql_server.gitea.id
Expand All @@ -59,6 +64,7 @@ resource "azurerm_key_vault_secret" "db_password" {
name = "${azurerm_mysql_server.gitea.name}-administrator-password"
value = random_password.password.result
key_vault_id = data.azurerm_key_vault.keyvault.id
tags = local.tre_shared_service_tags

depends_on = [
azurerm_key_vault_access_policy.gitea_policy
Expand Down
2 changes: 1 addition & 1 deletion templates/shared_services/gitea/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.3"
__version__ = "0.3.4"

0 comments on commit 2d6caa7

Please sign in to comment.