/pulumi-sparkpost

A custom provider to allow managing Event and Relay Webhooks in SparkPost

Primary LanguageTypeScriptApache License 2.0Apache-2.0

SparkPost Provider for Pulumi

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.

Configure SparkPost API Key

  1. Create a SparkPost API Key with the appropriate permissions.

  2. Set the sparkpost:api-key Pulumi config variable

$ pulumi config set sparkpost:api-key --secret <YOUR-API-KEY>

Configure SparkPost API Endpoint (Optional)

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.

  1. Set the sparkpost:endpoint Pulumi config variable
$ pulumi config set sparkpost:endpoint https://api.eu.sparkpost.com:443

Examples

Event Webhook

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"]
});

Relay Webhook

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
  }
);