Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a specialized callback function to make it easer to connect with Pulumi.
- Loading branch information
1 parent
416ea55
commit b71b2b8
Showing
3 changed files
with
75 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as gcp from '@pulumi/gcp'; | ||
import * as pulumi from '@pulumi/pulumi'; | ||
import { makePulumiCallback } from 'gcl-slack'; | ||
|
||
const name = 'slack'; | ||
|
||
export const topic = new gcp.pubsub.Topic(name, {}, { provider }); | ||
|
||
const config = new pulumi.Config(name); | ||
|
||
topic.onMessagePublished(name, { | ||
region: 'europe-west1', | ||
runtime: 'nodejs14', | ||
environmentVariables: { | ||
SLACK_TOKEN: config.require('token'), | ||
}, | ||
callback: makePulumiCallback('api'), | ||
}); | ||
|
||
const logSink = new gcp.logging.ProjectSink(name, { | ||
filter: 'operation.producer="github.com/bjerkio/nestjs-slack@v1"', | ||
destination: pulumi.interpolate`pubsub.googleapis.com/${topic.id}`, | ||
}); | ||
|
||
new gcp.pubsub.TopicIAMMember(name, { | ||
topic: topic.name, | ||
role: 'roles/pubsub.publisher', | ||
member: logSink.writerIdentity, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters