Skip to content

Commit

Permalink
add github runner to common itn
Browse files Browse the repository at this point in the history
  • Loading branch information
Krusty93 committed Sep 17, 2024
1 parent 7800b2a commit c63a949
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 0 deletions.
Empty file.
26 changes: 26 additions & 0 deletions src/common/_modules/github_runner/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
resource "azurerm_subnet" "github_runner" {
name = "${var.project}-github-runner-snet-01"
resource_group_name = var.vnet_common.resource_group_name
virtual_network_name = var.vnet_common.name
address_prefixes = [var.cidr_subnet]

service_endpoints = [
"Microsoft.Web"
]

private_endpoint_network_policies_enabled = true
}

resource "azurerm_container_app_environment" "github_runner" {
name = "${var.project}-github-runner-cae-01"
location = var.location
resource_group_name = var.resource_group_name

log_analytics_workspace_id = var.log_analytics_workspace_id

infrastructure_subnet_id = azurerm_subnet.github_runner.id
zone_redundancy_enabled = false
internal_load_balancer_enabled = true

tags = var.tags
}
37 changes: 37 additions & 0 deletions src/common/_modules/github_runner/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
variable "project" {
type = string
description = "IO prefix, short environment and short location"
}

variable "location" {
type = string
description = "Azure region"
}

variable "tags" {
type = map(any)
description = "Resource tags"
}

variable "resource_group_name" {
type = string
description = "Resource group name"
}

variable "cidr_subnet" {
type = string
description = "Azure DevOps agent network address space"
}

variable "vnet_common" {
type = object({
id = string
name = string
resource_group_name = string
})
description = "Information of the common VNet"
}

variable "log_analytics_workspace_id" {
type = string
}
8 changes: 8 additions & 0 deletions src/common/_modules/monitoring/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ output "appi_instrumentation_key" {
value = azurerm_application_insights.appi.instrumentation_key
sensitive = true
}

output "log" {
value = {
id = azurerm_log_analytics_workspace.log.id
name = azurerm_log_analytics_workspace.log.name
resource_group_name = azurerm_log_analytics_workspace.log.resource_group_name
}
}
2 changes: 2 additions & 0 deletions src/common/prod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
| <a name="module_application_gateway_weu"></a> [application\_gateway\_weu](#module\_application\_gateway\_weu) | ../_modules/application_gateway | n/a |
| <a name="module_assets_cdn_weu"></a> [assets\_cdn\_weu](#module\_assets\_cdn\_weu) | ../_modules/assets_cdn | n/a |
| <a name="module_event_hubs_weu"></a> [event\_hubs\_weu](#module\_event\_hubs\_weu) | ../_modules/event_hubs | n/a |
| <a name="module_github_runner_itn"></a> [github\_runner\_itn](#module\_github\_runner\_itn) | ../_modules/github_runner | n/a |
| <a name="module_global"></a> [global](#module\_global) | ../_modules/global | n/a |
| <a name="module_monitoring_weu"></a> [monitoring\_weu](#module\_monitoring\_weu) | ../_modules/monitoring | n/a |

## Resources

| Name | Type |
|------|------|
| [azurerm_resource_group.github_runner](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_api_management.apim_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management) | data source |
| [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/client_config) | data source |
| [azurerm_linux_function_app.function_assets_cdn](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/linux_function_app) | data source |
Expand Down
22 changes: 22 additions & 0 deletions src/common/prod/italynorth.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
resource "azurerm_resource_group" "github_runner" {
name = "${local.project_itn}-github-runner-rg-01"
location = "italynorth"

tags = local.tags
}

module "github_runner_itn" {
source = "../_modules/github_runner"

project = local.project_itn
location = azurerm_resource_group.github_runner.location
resource_group_name = azurerm_resource_group.github_runner.name

vnet_common = local.core.networking.itn.vnet_common

cidr_subnet = "10.20.14.0/23"

log_analytics_workspace_id = module.monitoring_weu.log.id

tags = local.tags
}

0 comments on commit c63a949

Please sign in to comment.