如何在 AWS Event Bridge 中创建自定义事件总线? [英] How do I create a custom Event Bus in AWS Event Bridge?

查看:42
本文介绍了如何在 AWS Event Bridge 中创建自定义事件总线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网上找不到文档或 Terraform 模块示例.

I can't find the documentation or an example Terraform module online.

如何在 AWS Event Bridge 中创建自定义事件总线?

How do I create a custom Event Bus in AWS Event Bridge?

推荐答案

截至撰写本文时,Terraform Provider for AWS 尚不支持创建 EventBridge 事件总线.

As of this writing, creating an EventBridge Event Bus isn't supported by the Terraform Provider for AWS yet.

我们必须使用默认事件总线或使用 AWS CLI 或控制台创建它.

We had to use the default Event Bus or create it with the AWS CLI or Console.

警告:EventBridge 目前有几个严重的 IAM 漏洞:您不能限制 IAM 委托人也可以发布事件的总线,它使用服务委托人而不是服务关联角色委托人来访问使用的 KMS 密钥等内容对总线进行加密.

Caveats: EventBridge has a couple of serious IAM gaps right now: you can't restrict what buses an IAM principal can publish events too and it uses a Service principal instead of a Service Linked Role principal to access things like KMS keys used to encrypt the buses.

您可以使用 null_resource 配置程序作为缺少提供程序资源的解决方法(假设您使用环境变量或 IAM 实例配置文件来验证您的 AWS 提供程序):

You can use a null_resource provisioner as a workaround for the missing provider resource (this assumes you are using environment variables or an IAM instance profile to authenticate your AWS provider):

resource "null_resource" "custom_event_bus" {
  triggers = {
    event_bus_name = var.event_bus_name
  }

  provisioner "local-exec" {
    command = "aws events create-event-bus --name ${var.event_bus_name}'"
  }
}

如果您使用命名的 AWS 配置文件而不是环境变量,则需要使用 --profile profile_name 指定它,就像在 shell 中运行它一样.

If you are using a named AWS configuration profile instead of environment variables, you'll need to specify that with --profile profile_name the same as you would if you ran it at your shell.

这篇关于如何在 AWS Event Bridge 中创建自定义事件总线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆