Commit 9607ca6
feat: support AWS EventBridge (#4188)
## Description
This PR introduces the AWS EventBridge. The EventBridge can be enabled
with the options `webhook_mode`, which can be set to either `direct` or
`eventbridge`. In the direct mode the olds way of handling is still
applied. When setting the mode to `eventbridge` events will publshed on
the AWS EventBridge, which is not limited only to the event
`workflow_job` with statues `queued` via a target rule events relevant
for scaling a snet to the dispatcher lambda to distrute to a SQS queue
for sacling.
## Todo
- [x] Refactor lambda and add EventBridge
- [x] Refactor webhook module (TF) to support EventBridge
- [x] Test example default
- [x] Test example multi runner
- [x] Adjust docs
- [x] Reduce permissions on webhook and dispatcher lambda for
eventbridge mode
- [x] Add configuration for allowed events on the EventBridge
- [ ] Add support for CMK (encruption) to EventBridge #4192
## MIgration directions
The change is backwards compatible but will recreate resources managed
by the internal module webhook. The only resource contianing data is the
CloudWatch LogGroup. To retain the log geroup you can run a terraform
state move. Or add a `moved` block to your deployemnt.
### Migrating to this version
With module defaults or eventbridge is not eanavbled
```hcl
# log group
moved {
from = module.<runner-module-name>.module.webhook.aws_cloudwatch_log_group.webhook
to = module.<runner-module-name>.module.webhook.module.direct[0].aws_cloudwatch_log_group.webhook
}
# lambda
moved {
from = module.<runner-module-name>.module.webhook.aws_lambda_function.webhook
to = module.<runner-module-name>.module.webhook.module.direct[0].aws_lambda_function.webhook
}
```
Or with `webhook_mode = eventbridge`
```hcl
# log group
moved {
from = module.<runner-module-name>.module.webhook.aws_cloudwatch_log_group.webhook
to = module.<runner-module-name>.module.webhook.module.direct[0].aws_cloudwatch_log_group.webhook
}
# lambda
moved {
from = module.<runner-module-name>.module.webhook.aws_lambda_function.webhook
to = module.<runner-module-name>.module.webhook.module.direct[0].aws_lambda_function.webhook
}
```
### When switching between direct and eventbridge
When enable mode `eventbridge`
```hcl
# log group
moved {
from = module.runners.module.webhook.module.direct[0].aws_cloudwatch_log_group.webhook
to = module.runners.module.webhook.module.eventbridge[0].aws_cloudwatch_log_group.webhook
}
# lambda
moved {
from = module.runners.module.webhook.module.direct[0].aws_lambda_function.webhook
to = module.runners.module.webhook.module.eventbridge[0].aws_lambda_function.webhook
}
```
Or vice versa for moving from `eventbride` to `webhook`
---------
Co-authored-by: philips-labs-pr|bot <philips-labs-pr[bot]@users.noreply.github.com>
Co-authored-by: Marco Pas <[email protected]>
Co-authored-by: Stuart Pearson <[email protected]>1 parent 556f00b commit 9607ca6
File tree
60 files changed
+2540
-482
lines changed- docs
- assets
- examples
- default
- multi-runner
- lambdas
- functions
- ami-housekeeper
- control-plane
- gh-agent-syncer
- termination-watcher
- webhook
- src
- eventbridge
- runners
- sqs
- webhook
- modules
- multi-runner
- webhook
- direct
- eventbridge
- policies
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
60 files changed
+2540
-482
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
| 160 | + | |
160 | 161 | | |
161 | 162 | | |
162 | 163 | | |
| |||
Loading
Loading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
262 | 333 | | |
263 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
264 | 339 | | |
265 | 340 | | |
266 | 341 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
100 | 107 | | |
101 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
102 | 115 | | |
103 | 116 | | |
104 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
80 | 88 | | |
81 | 89 | | |
82 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
0 commit comments