Slide 26
Slide 26 text
AzAPIでリソースの詳細情報を取得する
check "nginx" {
data "azapi_resource" "ci_check_nginx" {
depends_on = [azurerm_container_group.check_nginx]
name = "ci-check-nginx"
parent_id = azurerm_resource_group.apc_tf_meetup.id
type = "Microsoft.ContainerInstance/containerGroups@2023-05-01"
response_export_values = ["properties.instanceView.state"]
}
assert {
condition = jsondecode(data.azapi_resource.ci_check_nginx.output).properties.instanceView.state == "Succeeded"
error_message = "curl check failed: to nginx. if state is Running, it is possible that the test just did not finish in time,
please re-run it!"
}
}
AzureRMプロバイダではACIコンテナの実行結
果を取得できないが、AzAPIなら可能
curlコンテナの実行が
成功したかをチェック