英文:
Can't create event rule on custom event bus using Pulumi
问题
我在我的堆栈中有以下的Pulumi资源:
....
var eventBus = new Aws.CloudWatch.EventBus("WebhookEventBus", new EventBusArgs()
{
Name = "WebhookEventBus"
});
var sendToApiRule = new Aws.CloudWatch.EventRule("SendToApi", new EventRuleArgs()
{
EventBusName = eventBus.Name,
EventPattern = @"{
""source"": [{ ""prefix"": ""xxxx"" }]
}"
});
var devTarget = new Aws.CloudWatch.EventTarget("DevTarget", new EventTargetArgs()
{
Rule = sendToApiRule.Name,
Arn = apiDestination.Arn,
RoleArn = apiDestinationRole.Arn
});
在创建我的Pulumi堆栈时,我收到以下错误:
creating EventBridge Target (SendToApi-30d74a6-DevTarget-1b917a0): ResourceNotFoundException: Rule SendToApi-30d74a6 does not exist on EventBus default.
事实上,CloudTrail似乎证实了这个错误来自于events.amazonaws.com
:
...
"errorCode": "InternalFailure",
"errorMessage": "An unknown error occurred",
"requestParameters": {
"rule": "SendToApi-8e734a8",
"eventBusName": "default",
"targets": [
{
"id": "DevTarget-eb8e26d",
"arn": "xxxx",
"roleArn": "xxxx"
}
]
},
...
我尝试过在EventBusName
中使用静态字符串“WebhookEventBus”。我也尝试过将这些事件包装在.Apply(x => )
语句中,但总是收到这个错误。你有任何可能的原因吗?
英文:
I have the following Pulumi resources in my stack:
....
var eventBus = new Aws.CloudWatch.EventBus("WebhookEventBus", new EventBusArgs()
{
Name = "WebhookEventBus"
});
var sendToApiRule = new Aws.CloudWatch.EventRule("SendToApi", new EventRuleArgs()
{
EventBusName = eventBus.Name,
EventPattern = @"{
""source"": [{ ""prefix"": ""xxxx"" }]
}"
});
var devTarget = new Aws.CloudWatch.EventTarget("DevTarget", new EventTargetArgs()
{
Rule = sendToApiRule.Name,
Arn = apiDestination.Arn,
RoleArn = apiDestinationRole.Arn
});
When creating my Pulumi Stack, I get the error:
creating EventBridge Target (SendToApi-30d74a6-DevTarget-1b917a0): ResourceNotFoundException: Rule SendToApi-30d74a6 does not exist on EventBus default.
Indeed, CloudTrail seems to confirm this error originating from events.amazonaws.com
:
...
"errorCode": "InternalFailure",
"errorMessage": "An unknown error occurred",
"requestParameters": {
"rule": "SendToApi-8e734a8",
"eventBusName": "default",
"targets": [
{
"id": "DevTarget-eb8e26d",
"arn": "xxxx",
"roleArn": "xxxx"
}
]
},
...
I've tried using a static string "WebhookEventBus" in EventBusName
. I've also tried wrapping these events in .Apply(x => )
statements, but always receive this error. Any idea why this might be?
答案1
得分: 1
你需要根据以下链接中的说明指定EventBusName属性:
https://www.pulumi.com/registry/packages/aws/api-docs/cloudwatch/eventtarget/#eventbusname_csharp
目前它正在使用"default"事件总线,因此无法找到规则。
英文:
You need to specify the EventBusName property as per:
https://www.pulumi.com/registry/packages/aws/api-docs/cloudwatch/eventtarget/#eventbusname_csharp
Currently, it's using the "default" event bus and so can't find the rule.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论