円安ですなぁ。
JAZUG
Azure Updates (2022.09.01)
9月だわ。
Azure Updates (2022.08.25)
今週はちょっと控えめ。8月も終わりですね。。
Azure Updates (2022.08.18)
気が付けば夏休みも終わり。
Azure Updates (2022.08.11)
夏季休暇ってやつですね。
Azure Updates (2022.08.04)
夏休み感ある
Azure Updates (2022.07.28)
7月も終わってしまいそう。
Azure Update (2022.07.21)
Inspireですなぁ。(今年のInspireはBook of Newsがないようです)
TerraformでWeb Appsにカスタムドメイン名を設定したい
TerraformでAzure App ServiceのWeb Appsにカスタムドメイン名(特にネイキッドドメイン)を設定したい場合、AレコードにIPアドレスを設定する必要がありますが、App Serviceの受信IPアドレスを簡単にとれません。
Azure Resource Manager(ARM)上は一応 inbound_ip_address があるんですけどTerraform上で扱えないんですよね。以前は無理やりoutbound_ip_address (送信IPアドレス)の最初の要素を使ったりしてましたが(受信IPアドレスが最初に入ってた)不確かで実際最近はそんなことはないのでうまく設定できない状況でした。
で、どうしたものか悩んでたら ‘web apps名’.azurewebsites.net を正引きしてIPアドレスを取得すれば確実、ということらしく hashicorp/dns で取得したIPアドレスを使えばいいようです。
resource "azurerm_linux_web_app" "example" { name = "example" resource_group_name = azurerm_resource_group.example.name location = azurerm_service_plan.example.location service_plan_id = azurerm_service_plan.example.id site_config {} } data "dns_a_record_set" "app_ip_address" { host = azurerm_linux_web_app.example.default_hostname } resource "azurerm_dns_a_record" "dns_a" { # ... target_resource_id = data.dns_a_record_set.app_ip_address.addrs[0] }
他にはTraffic ManagerのAzureリソースのエンドポイントでApp Serviceが使えたらそもそもこんな苦労しなくていいのに、とか思いますけど。。
たまにTerraform触るたびにいろいろ嵌りますね。
追記
しばやん氏からのタレコミによるとそもそもAzure REST API Specからしてinbound IP addressは欠落してるぽい。(resource Explorerとかで見るとちゃんとあるのでSpec側のミス)
- Missing readonly `inboundIpAddress` property from Microsoft.Web/sites type definitions · Issue #12974 · Azure/azure-rest-api-specs (github.com)
- azure-rest-api-specs/WebApps.json at main · Azure/azure-rest-api-specs (github.com)
APIの実装って大変ですね
Azure Updates (2022.07.14)
なんだかいろいろ不安な空気ですね。