Skip to content

Commit

Permalink
fix: Ja fix errors found during testing (#4)
Browse files Browse the repository at this point in the history
* fix: use resource group data source

* fix: remove unused runner resources

* Revert "fix: remove unused runner resources"

This reverts commit 01956d2.

* fix: availbility zones not supported in all regions
  • Loading branch information
jordan-acosta authored Apr 1, 2024
1 parent 671255f commit 3100167
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 20 deletions.
14 changes: 7 additions & 7 deletions aks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ module "aks" {
source = "Azure/aks/azurerm"

prefix = var.nuon_id
resource_group_name = azurerm_resource_group.rg.name
resource_group_name = data.azurerm_resource_group.rg.name
kubernetes_version = var.cluster_version
automatic_channel_upgrade = "patch"
agents_availability_zones = ["1", "2"]
agents_count = null
agents_max_count = 2
agents_max_pods = 100
agents_min_count = 1
agents_pool_name = "agents"
# agents_availability_zones = ["1", "2"]
agents_count = null
agents_max_count = 2
agents_max_pods = 100
agents_min_count = 1
agents_pool_name = "agents"
agents_pool_linux_os_configs = [
{
transparent_huge_page_enabled = "always"
Expand Down
4 changes: 2 additions & 2 deletions dns.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
resource "azurerm_dns_zone" "public" {
name = var.public_root_domain
resource_group_name = azurerm_resource_group.rg.name
resource_group_name = data.azurerm_resource_group.rg.name
}

resource "azurerm_private_dns_zone" "internal" {
name = var.internal_root_domain
resource_group_name = azurerm_resource_group.rg.name
resource_group_name = data.azurerm_resource_group.rg.name
}
2 changes: 1 addition & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ output "account" {
"location" = var.location
"subscription_id" = data.azurerm_client_config.current.subscription_id
"client_id" = data.azurerm_client_config.current.client_id
"resource_group_name" = azurerm_resource_group.rg.name
"resource_group_name" = data.azurerm_resource_group.rg.name
}
description = "A map of Azure account attributes: location, subscription_id, client_id, resource_group_name."
}
Expand Down
8 changes: 4 additions & 4 deletions registry.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
resource "azurerm_container_registry" "acr" {
name = var.nuon_id
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
resource_group_name = data.azurerm_resource_group.rg.name
location = data.azurerm_resource_group.rg.location
sku = "Premium"
admin_enabled = false
}

resource "azurerm_container_registry_scope_map" "acr" {
name = var.nuon_id
container_registry_name = azurerm_container_registry.acr.name
resource_group_name = azurerm_resource_group.rg.name
resource_group_name = data.azurerm_resource_group.rg.name
actions = [
"repositories/${var.nuon_id}/content/read",
"repositories/${var.nuon_id}/content/write"
Expand All @@ -24,7 +24,7 @@ resource "random_pet" "token_name" {
resource "azurerm_container_registry_token" "runner" {
name = random_pet.token_name.id
container_registry_name = azurerm_container_registry.acr.name
resource_group_name = azurerm_resource_group.rg.name
resource_group_name = data.azurerm_resource_group.rg.name
scope_map_id = azurerm_container_registry_scope_map.acr.id
}

Expand Down
5 changes: 2 additions & 3 deletions resource_group.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
resource "azurerm_resource_group" "rg" {
location = var.location
name = var.nuon_id
data "azurerm_resource_group" "rg" {
name = var.resource_group_name
}
2 changes: 1 addition & 1 deletion runner.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ resource "azurerm_role_definition" "runner" {
resource "azurerm_user_assigned_identity" "runner" {
name = "${var.nuon_id}-runner"
location = var.location
resource_group_name = azurerm_resource_group.rg.name
resource_group_name = data.azurerm_resource_group.rg.name
}

resource "azurerm_role_assignment" "role_assignment" {
Expand Down
4 changes: 2 additions & 2 deletions ssh.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ resource "azapi_resource_action" "ssh_public_key_gen" {
resource "azapi_resource" "ssh_public_key" {
type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
name = random_pet.ssh_key_name.id
location = azurerm_resource_group.rg.location
parent_id = azurerm_resource_group.rg.id
location = data.azurerm_resource_group.rg.location
parent_id = data.azurerm_resource_group.rg.id
}

0 comments on commit 3100167

Please sign in to comment.