Open SZGAN26 opened 1 month ago
Thanks for raising this issue. Seems I can't reproduce it. Could you try below tf config and latest azurerm provider to see if the issue still exists? Please check if the parameters you set are unexpected/incorrect. Thanks.
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-dns-test01"
location = "eastus"
}
resource "azurerm_dns_zone" "test" {
name = "acctestzonetest01.com"
resource_group_name = azurerm_resource_group.test.name
}
resource "azurerm_dns_cname_record" "cnameweb" {
name = "app-bgapi-tst-001"
resource_group_name = azurerm_resource_group.test.name
zone_name = azurerm_dns_zone.test.name
ttl = 300
record = "az.oneiig.com"
}
resource "azurerm_dns_txt_record" "dnstxt" {
name = "asuid.app-bgapi-tst-001.az"
resource_group_name = azurerm_resource_group.test.name
zone_name = azurerm_dns_zone.test.name
ttl = 300
record {
value = "Test Text"
}
}
resource "azurerm_app_service_plan" "test" {
name = "acctestASP-test01"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku {
tier = "Standard"
size = "S1"
}
}
resource "azurerm_app_service" "test" {
name = "<Replace it with existing APP Service>"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
app_service_plan_id = azurerm_app_service_plan.test.id
}
resource "azurerm_app_service_custom_hostname_binding" "custdom" {
hostname = "<Replace it with existing Domain>"
app_service_name = azurerm_app_service.test.name
resource_group_name = azurerm_resource_group.test.name
}
I have tried custom domain alone as you mentioned, still getting below error
╷ │ Error: creating/updating Custom Hostname Binding "app-bgapi-stg-001.az.oneiig.com" (App Service "app-bgapi-stg-001" / Resource Group "RG-TEST-TRF"): web.AppsClient#CreateOrUpdateHostNameBinding: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="ParentResourceNotFound" Message="Failed to perform 'write' on resource(s) of type 'sites/hostNameBindings', because the parent resource '/subscriptions/***/resourceGroups/RG-TEST-TRF/providers/Microsoft.Web/sites/app-bgapi-stg-001' could not be found." │ │ with azurerm_app_service_custom_hostname_binding.custdom, │ on main.tf line 29, in resource "azurerm_app_service_custom_hostname_binding" "custdom": │ 29: resource "azurerm_app_service_custom_hostname_binding" "custdom" {
My coding is here
resource "azurerm_resource_group" "rg" { name = var.resource_group_name location = var.location }
resource "azurerm_service_plan" "appserviceplan" { name = var.app_service_plan location = var.location resource_group_name = var.resource_group_name os_type = var.os_name sku_name = var.sku_name }
resource "azurerm_linux_web_app" "appservicewebapp" { name = var.app_service_name location = var.location resource_group_name = var.resource_group_name service_plan_id = azurerm_service_plan.appserviceplan.id
site_config { application_stack { dotnet_version = "8.0" } } }
resource "azurerm_app_service_custom_hostname_binding" "custdom" { hostname = "app-bgapi-stg-001.az.oneiig.com" app_service_name = var.app_service_name resource_group_name = var.resource_group_name }
Hi Neil,
I have tried custom domain alone as you mentioned, still getting below error ╷ │ Error: creating/updating Custom Hostname Binding "app-bgapi-stg-001.az.oneiig.com" (App Service "app-bgapi-stg-001" / Resource Group "RG-TEST-TRF"): web.AppsClient#CreateOrUpdateHostNameBinding: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="ParentResourceNotFound" Message="Failed to perform 'write' on resource(s) of type 'sites/hostNameBindings', because the parent resource '/subscriptions/***/resourceGroups/RG-TEST-TRF/providers/Microsoft.Web/sites/app-bgapi-stg-001' could not be found." │ │ with azurerm_app_service_custom_hostname_binding.custdom, │ on main.tf line 29https://github.com/Inter-IKEA-Digital/IIG-DataCatalog-BGAPI-Infra/actions/runs/9297923071/job/25588920024#step:8:30, in resource "azurerm_app_service_custom_hostname_binding" "custdom": │ 29: resource "azurerm_app_service_custom_hostname_binding" "custdom" { My coding is here Create Resource Group for test resource "azurerm_resource_group" "rg" { name = var.resource_group_name location = var.location } Create the Linux App Service Plan resource "azurerm_service_plan" "appserviceplan" { name = var.app_service_plan location = var.location resource_group_name = var.resource_group_name os_type = var.os_name sku_name = var.sku_name } resource "azurerm_linux_web_app" "appservicewebapp" { name = var.app_service_name location = var.location resource_group_name = var.resource_group_name service_plan_id = azurerm_service_plan.appserviceplan.id site_config { application_stack { dotnet_version = "8.0" } } } resource "azurerm_app_service_custom_hostname_binding" "custdom" { hostname = "app-bgapi-stg-001.az.oneiig.com" app_service_name = var.app_service_name resource_group_name = var.resource_group_name }
Regards, Surya G
From: Neil Ye @.> Sent: Thursday, May 30, 2024 3:25 AM To: hashicorp/terraform-provider-azurerm @.> Cc: Surya Ganesan (External - Tata Consultancy Services Limited) @.>; Author @.> Subject: Re: [hashicorp/terraform-provider-azurerm] Unable to created Custom Domain and CNAMe (Issue #26124)
Thanks for raising this issue. Seems I can't reproduce it. Could you try below tf config and latest azurerm provider to see if the issue still exists? Please check if the parameters you set are unexpected/incorrect. Thanks.
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-dns-test01"
location = "eastus"
}
resource "azurerm_dns_zone" "test" {
name = "acctestzonetest01.com"
resource_group_name = azurerm_resource_group.test.name
}
resource "azurerm_dns_cname_record" "cnameweb" {
name = "app-bgapi-tst-001"
resource_group_name = azurerm_resource_group.test.name
zone_name = azurerm_dns_zone.test.name
ttl = 300
record = "az.oneiig.com"
}
resource "azurerm_dns_txt_record" "dnstxt" {
name = "asuid.app-bgapi-tst-001.az"
resource_group_name = azurerm_resource_group.test.name
zone_name = azurerm_dns_zone.test.name
ttl = 300
record {
value = "Test Text"
}
}
resource "azurerm_app_service_plan" "test" {
name = "acctestASP-test01"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku {
tier = "Standard"
size = "S1"
}
}
resource "azurerm_app_service" "test" {
name = "
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
app_service_plan_id = azurerm_app_service_plan.test.id
}
resource "azurerm_app_service_custom_hostname_binding" "custdom" {
hostname = "
app_service_name = azurerm_app_service.test.name
resource_group_name = azurerm_resource_group.test.name
}
— Reply to this email directly, view it on GitHubhttps://github.com/hashicorp/terraform-provider-azurerm/issues/26124#issuecomment-2138504008, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BEWDMCBJAWXL2LTHYCX7NL3ZEZ5VPAVCNFSM6AAAAABINELFTOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZYGUYDIMBQHA. You are receiving this because you authored the thread.Message ID: @.**@.>>
Hi Neil, Could you please reply to above request?
Regards, Surya G
Is there an existing issue for this?
Community Note
Run cd '/home/runner/work/IIG-DataCatalog-BGAPI-Infra/IIG-DataCatalog-BGAPI-Infra/azure' && terraform apply -auto-approve tfplan Acquiring state lock. This may take a few moments... azurerm_dns_cname_record.cnameweb: Creating... azurerm_app_service_custom_hostname_binding.custdom: Creating... azurerm_dns_txt_record.dnstxt: Creating... azurerm_key_vault_access_policy.access-policy-tf: Modifying... [id=/subscriptions//resourceGroups/RG-TEST-TRF/providers/Microsoft.KeyVault/vaults/kv-euwe-bgapi-nonprod/objectId/af734bb2-2a3c-4cd6-b88e-82bf59535799] azurerm_key_vault_access_policy.access-policy-tf: Modifications complete after 7s [id=/subscriptions//resourceGroups/RG-TEST-TRF/providers/Microsoft.KeyVault/vaults/kv-euwe-bgapi-nonprod/objectId/af734bb2-2a3c-4cd6-b88e-82bf59535799] ╷ │ Error: creating/updating Record Type (Subscription: "" │ Resource Group Name: "RG-TEST-TRF" │ Dns Zone Name: "az.oneiig.com" │ Record Type: "CNAME" │ Relative Record Set Name: "app-bgapi-tst-001"): unexpected status 404 (404 Not Found) with error: ParentResourceNotFound: Failed to perform 'write' on resource(s) of type 'dnszones/CNAME', because the parent resource '/subscriptions//resourceGroups/RG-TEST-TRF/providers/Microsoft.Network/dnszones/az.oneiig.com' could not be found. │ │ with azurerm_dns_cname_record.cnameweb, │ on main.tf line 29, in resource "azurerm_dns_cname_record" "cnameweb": │ 29: resource "azurerm_dns_cname_record" "cnameweb" { │ ╵ ╷ │ Error: creating/updating Custom Hostname Binding "app-bgapi-tst-001.az.oneiig.com" (App Service "app-bgapi-tst-001" / Resource Group "RG-TEST-TRF"): web.AppsClient#CreateOrUpdateHostNameBinding: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="A TXT record pointing from asuid.app-bgapi-tst-001.az.oneiig.com to bbc8b75243d8117b0bd8aba86cd923591db9739e6aeed68496f2cb89bfa389e8 was not found." Details=[{"Message":"A TXT record pointing from asuid.app-bgapi-tst-001.az.oneiig.com to bbc8b75243d8117b0bd8aba86cd923591db9739e6aeed68496f2cb89bfa389e8 was not found."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","ExtendedCode":"04006","Message":"A TXT record pointing from asuid.app-bgapi-tst-001.az.oneiig.com to bbc8b75243d8117b0bd8aba86cd923591db9739e6aeed68496f2cb89bfa389e8 was not found.","MessageTemplate":"A TXT record pointing from asuid.{0} to {1} was not found.","Parameters":["app-bgapi-tst-001.az.oneiig.com","bbc8b75243d8117b0bd8aba86cd923591db9739e6aeed68496f2cb89bfa389e8"]}}] │ │ with azurerm_app_service_custom_hostname_binding.custdom, │ on main.tf line 37, in resource "azurerm_app_service_custom_hostname_binding" "custdom": │ 37: resource "azurerm_app_service_custom_hostname_binding" "custdom" { │ ╵ ╷ │ Error: creating/updating Record Type (Subscription: "" │ Resource Group Name: "RG-TEST-TRF" │ Dns Zone Name: "az.oneiig.com" │ Record Type: "TXT" │ Relative Record Set Name: "asuid.app-bgapi-tst-001.az"): unexpected status 404 (404 Not Found) with error: ParentResourceNotFound: Failed to perform 'write' on resource(s) of type 'dnszones/TXT', because the parent resource '/subscriptions//resourceGroups/RG-TEST-TRF/providers/Microsoft.Network/dnszones/az.oneiig.com' could not be found. │ │ with azurerm_dns_txt_record.dnstxt, │ on main.tf line 43, in resource "azurerm_dns_txt_record" "dnstxt": │ 43: resource "azurerm_dns_txt_record" "dnstxt" { │ ╵ Releasing state lock. This may take a few moments... Error: Terraform exited with code 1. Error: Process completed with exit code 1.
Terraform Version
3.103.0..
AzureRM Provider Version
3.103.0..
Affected Resource(s)/Data Source(s)
azurerm v3.103.0..
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
Need to create CNAMe and Binding the Cutom domain and txt name
Actual Behaviour
Getting error
Steps to Reproduce
No response
Important Factoids
No response
References
No response