This is a custom provider to allow managing Events and Relay Webhooks in SparkPost with Pulumi.
The package is published on NPM, as @aydrian/pulumi-sparkpost
.
-
Create a SparkPost API Key with the appropriate permissions.
-
Set the
sparkpost:api-key
Pulumi config variable
$ pulumi config set sparkpost:api-key --secret <YOUR-API-KEY>
If you are using SparkPost from the EU or have an Enterprise account, you'll need to set the appropriate endpoint. Otherwise, the default will be used.
- Set the
sparkpost:endpoint
Pulumi config variable
$ pulumi config set sparkpost:endpoint https://api.eu.sparkpost.com:443
import { SparkPostWebhookResource } from "@aydrian/pulumi-sparkpost";
const url = "https://some.endpoint.com";
const webhook = new SparkPostWebhookResource("sparkpost-webhook", {
name: "My Event Webhook",
target: url,
events: ["delivery", "initial_open", "click"]
});
import {
SparkPostInboundDomainResource,
SparkPostRelayWebhookResource
} from "@aydrian/pulumi-sparkpost";
const domain = "inbound.domain.com";
const target = "https://some.endpoint.com";
const inbound_domain = new SparkPostInboundDomainResource(
"sparkpost-inbound-domain",
{
domain
}
);
const relay_webhook = new SparkPostRelayWebhookResource(
"sparkpost-rely-webhook",
{
domain: inbound_domain.domain,
target
}
);