我希望从gcloud-> slack设置一些警报,到目前为止,已经按照以下说明进行了测试并正在运行:
但是,理想情况下,我会将这些通知的配置存储在terraform脚本中,这样,如果需要再次设置,则无需遵循手动步骤。看起来这应该可行:https://www.terraform.io/docs/providers/google/r/monitoring_notification_channel.html
我已经运行了gcloud alpha monitoring channel-descriptors describe projects/<My Project>/notificationChannelDescriptors/slack,它会为labels + type产生以下输出:
labels:
- description: A permanent authentication token provided by Slack. This field is obfuscated
by returning only a few characters of the key when fetched.
key: auth_token
- description: The Slack channel to which to post notifications.
key: channel_name
type: slack
Run Code Online (Sandbox Code Playgroud)
因此,我认为通知渠道的Terraform配置希望是:
resource "google_monitoring_notification_channel" "basic" {
display_name = "My slack notifications"
type = "slack"
labels = {
auth_token = "????????"
channel_name = …Run Code Online (Sandbox Code Playgroud)