terraform-provider-azurerm icon indicating copy to clipboard operation
terraform-provider-azurerm copied to clipboard

feature request output hostname of azurerm_cdn_endpoint

Open dc232 opened this issue 3 years ago • 3 comments

Description

Add ability to export hostname from azure cdn endpoint hostname via output currently there doesn't seem to be a good way to do this current methods suggest (assuming azurerm_cdn_profile is defined)

resource "azurerm_cdn_endpoint" "example" {
  name                = var.cdn_endpoint_name
  profile_name        = azurerm_cdn_profile.example.name
  location            = "global"
}

then outputting

output "static_website_cdn_endpoint_hostname" {
  value       = azurerm_cdn_endpoint.example.name
  description = "CDN endpoint URL for Static website"
}

however, if we were to parse an argument into Cloudflare to create CNAME record to allow us to create a custom domain it would result in

│ Error: failed to create DNS record: HTTP status 400: DNS Validation Error (1004)

whilst there does seem to be an attribute called host_name as shown below

output "static_website_cdn_endpoint_hostname" {
  value       = azurerm_cdn_endpoint.example.host_name
}

it's not very clear as to what hostname it's outputting

The ideal one for Cloudflare would be along these lines

$test_var=(az cdn profile list -g test --query [].name -o tsv)
az cdn endpoint list -g test  --profile-name $test_var --query [].hostName -o tsv

to produce the needed Cloudflare CNAME to create a custom domain

az cdn endpoint list -g test  --profile-name $test_var --query [].hostName -o tsv
testingendpont.azureedge.net

New or Affected Resource(s)

affected resource would be azurerm_cdn_endpoint

Can't think of a decent terraform config at the moment and it's not very good practice to use local-exec commands however there probably a better solution, open to suggestion

dc232 avatar Jan 27 '22 10:01 dc232

hi @dc232

Thanks for opening this issue.

As you've mentioned the field host_name is available which (I'd agree is unclear) does contain the FQDN here (e.g. {contoso}.azureedge.net) - so it could be worth renaming this in 3.0 to fqdn instead of host_name to make this clearer.

Thanks!

tombuildsstuff avatar Jan 27 '22 10:01 tombuildsstuff

Ah I see thanks for the speedy reply @tombuildsstuff

dc232 avatar Jan 27 '22 10:01 dc232

This functionality has been released in v3.4.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

github-actions[bot] avatar Apr 22 '22 00:04 github-actions[bot]

Closing since per this comment this was released in v3.4.0

tombuildsstuff avatar Oct 11 '22 19:10 tombuildsstuff

This functionality has been released in v3.27.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

github-actions[bot] avatar Oct 14 '22 01:10 github-actions[bot]

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Nov 13 '22 02:11 github-actions[bot]