Skip to content

Commit

Permalink
feat: add github domain challenge module
Browse files Browse the repository at this point in the history
  • Loading branch information
kahlstrm committed Jun 29, 2024
1 parent f3658eb commit 74ded11
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,15 @@ module "dns_staging" {
resource_group_location = local.resource_group_location
zone_name = "tietokila.fi"
}
module "dns_github" {
source = "./modules/dns/github"

resource_group_name = module.dns_prod.resource_group_name
zone_name = module.dns_prod.root_zone_name
challenge_name = "_github-challenge-Tietokilta-org"
challenge_value = module.keyvault.github_challenge_value

}
module "mailman" {
source = "./modules/dns/mailman"

Expand Down
22 changes: 22 additions & 0 deletions modules/dns/github/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
variable "resource_group_name" {
type = string
}

variable "zone_name" {
type = string
}
variable "challenge_name" {
type = string
}
variable "challenge_value" {
type = string
}
resource "azurerm_dns_txt_record" "github_challenge" {
name = var.challenge_name
resource_group_name = var.resource_group_name
zone_name = var.zone_name
ttl = 60
record {
value = var.challenge_value
}
}
5 changes: 5 additions & 0 deletions modules/keyvault/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,8 @@ data "azurerm_key_vault_secret" "mongodb_atlas_private_key" {
name = "mongodb-atlas-private-key"
key_vault_id = azurerm_key_vault.keyvault.id
}

data "azurerm_key_vault_secret" "github_challenge_value" {
name = "github-challenge-value"
key_vault_id = azurerm_key_vault.keyvault.id
}
5 changes: 5 additions & 0 deletions modules/keyvault/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,8 @@ output "mongodb_atlas_private_key" {
value = data.azurerm_key_vault_secret.mongodb_atlas_private_key.value
sensitive = true
}

output "github_challenge_value" {
value = data.azurerm_key_vault_secret.github_challenge_value.value
sensitive = true
}

0 comments on commit 74ded11

Please sign in to comment.