Skip to content

Commit

Permalink
Revert "hotfix(dns) use existing Azure AD application for Let's Encry…
Browse files Browse the repository at this point in the history
…pt instead of managing it(s)" (#32)

This reverts commit 77267a9.
  • Loading branch information
dduportal authored Jan 14, 2023
1 parent 77267a9 commit 9f0b938
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 11 additions & 3 deletions dns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,22 @@ resource "azurerm_dns_ns_record" "child_zone_ns_records" {
records = azurerm_dns_zone.child_zones[each.key].name_servers
}

data "azuread_application" "letsencrypt_dns_challenge" {
display_name = "letsencrypt-dns-challenge"
resource "azuread_application" "letsencrypt_dns_challenges" {
for_each = { for key, value in local.lets_encrypt_dns_challenged_domains : key => value if value == "service_principal" }

display_name = replace(each.key, ".", "_")
owners = [data.azuread_client_config.current.object_id]
tags = [for key, value in local.default_tags : "${key}:${value}"]

web {
homepage_url = "https://github.com/jenkins-infra/azure-net"
}
}

resource "azuread_service_principal" "child_zone_service_principals" {
for_each = { for key, value in local.lets_encrypt_dns_challenged_domains : key => value if value == "service_principal" }

application_id = data.azuread_application.letsencrypt_dns_challenge.application_id
application_id = azuread_application.letsencrypt_dns_challenges[each.key].application_id
}

resource "azuread_service_principal_password" "child_zone_service_principal_passwords" {
Expand Down
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This data source allows referencing the identity used by Terraform to connect to the Azure API
data "azuread_client_config" "current" {}

0 comments on commit 9f0b938

Please sign in to comment.