【发布时间】:2021-10-16 06:54:30
【问题描述】:
我想使用 Terraform 创建 Azure EventGrid 订阅。
resource "azurerm_eventgrid_system_topic_event_subscription" "function_app" {
name = "RunOnBlobUploaded"
system_topic = azurerm_eventgrid_system_topic.function_app.name
resource_group_name = azurerm_resource_group.rg.name
included_event_types = [
"Microsoft.Storage.BlobCreated"
]
subject_filter {
subject_begins_with = "/blobServices/default/containers/input"
}
webhook_endpoint {
url = "https://thumbnail-generator-function-app.azurewebsites.net/runtime/webhooks/blobs?functionName=Create-Thumbnail&code=<BLOB-EXTENSION-KEY>"
}
}
通过关注this doc,我成功部署了它并且它工作正常。但是,webhook_endpoint URL 需要 <BLOB-EXTENSION-KEY>,它现在是硬编码的,可以从门户中的以下位置找到:
为了不向 GitHub 提交秘密,我想通过引用获得这个值,最好使用 Terraform。
根据我的研究,Terraform 中似乎无法引用该值。
最接近的是 Terraform 中的这个数据源 azurerm_function_app_host_keys。但是,它不包括blobs_extension 键!
在没有硬编码值的情况下,有什么好的方法可以在 Terraform 中引用 blobs_extension?
提前致谢!
【问题讨论】:
标签: azure azure-functions terraform terraform-provider-azure azure-eventgrid