Skip to content

Commit

Permalink
remove variables and assume values
Browse files Browse the repository at this point in the history
  • Loading branch information
Krusty93 committed Apr 18, 2024
1 parent b8064da commit 6d28e40
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
|------|-------------|------|---------|:--------:|
| <a name="input_container_app_environment"></a> [container\_app\_environment](#input\_container\_app\_environment) | n/a | <pre>object({<br> name = string<br> resource_group_name = string<br> })</pre> | n/a | yes |
| <a name="input_env_short"></a> [env\_short](#input\_env\_short) | Environment short name | `string` | n/a | yes |
| <a name="input_key_vault"></a> [key\_vault](#input\_key\_vault) | n/a | <pre>object({<br> name = string<br> resource_group_name = string<br> })</pre> | n/a | yes |
| <a name="input_prefix"></a> [prefix](#input\_prefix) | Project prefix | `string` | n/a | yes |
| <a name="input_repo_name"></a> [repo\_name](#input\_repo\_name) | n/a | `string` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | Resources tags | `map(any)` | n/a | yes |
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 6d28e40

Please sign in to comment.