diff --git a/infra/modules/github_selfhosted_runner_on_container_app_jobs/README.md b/infra/modules/github_selfhosted_runner_on_container_app_jobs/README.md index 8471a3c..1c3674b 100644 --- a/infra/modules/github_selfhosted_runner_on_container_app_jobs/README.md +++ b/infra/modules/github_selfhosted_runner_on_container_app_jobs/README.md @@ -25,15 +25,13 @@ | Name | Type | |------|------| | [azurerm_container_app_environment.runner](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/container_app_environment) | data source | -| [azurerm_key_vault.common](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault) | data source | +| [azurerm_key_vault.kv](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault) | data source | ## Inputs | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [container\_app\_environment](#input\_container\_app\_environment) | n/a |
object({
name = string
resource_group_name = string
})
| n/a | yes | | [env\_short](#input\_env\_short) | Environment short name | `string` | n/a | yes | -| [key\_vault](#input\_key\_vault) | n/a |
object({
name = string
resource_group_name = string
})
| n/a | yes | | [prefix](#input\_prefix) | Project prefix | `string` | n/a | yes | | [repo\_name](#input\_repo\_name) | n/a | `string` | n/a | yes | | [tags](#input\_tags) | Resources tags | `map(any)` | n/a | yes | diff --git a/infra/modules/github_selfhosted_runner_on_container_app_jobs/data.tf b/infra/modules/github_selfhosted_runner_on_container_app_jobs/data.tf index 70ef3a4..6a04840 100644 --- a/infra/modules/github_selfhosted_runner_on_container_app_jobs/data.tf +++ b/infra/modules/github_selfhosted_runner_on_container_app_jobs/data.tf @@ -1,9 +1,9 @@ data "azurerm_container_app_environment" "runner" { - name = var.container_app_environment.name - resource_group_name = var.container_app_environment.resource_group_name + name = local.container_app_environment.name + resource_group_name = local.container_app_environment.resource_group_name } -data "azurerm_key_vault" "common" { - name = var.key_vault.name - resource_group_name = var.key_vault.resource_group_name +data "azurerm_key_vault" "kv" { + name = local.key_vault.name + resource_group_name = local.key_vault.resource_group_name } diff --git a/infra/modules/github_selfhosted_runner_on_container_app_jobs/locals.tf b/infra/modules/github_selfhosted_runner_on_container_app_jobs/locals.tf new file mode 100644 index 0000000..18c0c7b --- /dev/null +++ b/infra/modules/github_selfhosted_runner_on_container_app_jobs/locals.tf @@ -0,0 +1,11 @@ +locals { + key_vault = { + name = var.prefix == "io" ? "${var.prefix}-${var.env_short}-kv-common" : "${var.prefix}-${var.env_short}-kv" + resource_group_name = var.prefix == "io" ? "${var.prefix}-${var.env_short}-rg-common" : "${var.prefix}-${var.env_short}-sec-rg" + } + + container_app_environment = { + name = "${var.prefix}-${var.env_short}-github-runner-cae" + resource_group_name = "${var.prefix}-${var.env_short}-github-runner-cae" + } +} diff --git a/infra/modules/github_selfhosted_runner_on_container_app_jobs/main.tf b/infra/modules/github_selfhosted_runner_on_container_app_jobs/main.tf index 51d4b68..0823a0f 100644 --- a/infra/modules/github_selfhosted_runner_on_container_app_jobs/main.tf +++ b/infra/modules/github_selfhosted_runner_on_container_app_jobs/main.tf @@ -15,8 +15,8 @@ module "container_app_job_selfhosted_runner" { env_short = var.env_short key_vault = { - resource_group_name = data.azurerm_key_vault.common.resource_group_name - name = data.azurerm_key_vault.common.name + resource_group_name = data.azurerm_key_vault.kv.resource_group_name + name = data.azurerm_key_vault.kv.name secret_name = "github-runner-pat" } diff --git a/infra/modules/github_selfhosted_runner_on_container_app_jobs/variables.tf b/infra/modules/github_selfhosted_runner_on_container_app_jobs/variables.tf index cf5db4c..7f59981 100644 --- a/infra/modules/github_selfhosted_runner_on_container_app_jobs/variables.tf +++ b/infra/modules/github_selfhosted_runner_on_container_app_jobs/variables.tf @@ -13,20 +13,6 @@ variable "prefix" { description = "Project prefix" } -variable "container_app_environment" { - type = object({ - name = string - resource_group_name = string - }) -} - -variable "key_vault" { - type = object({ - name = string - resource_group_name = string - }) -} - variable "repo_name" { type = string }