A Pulumi package for creating and managing Checkly monitoring resources.
Project description
Checkly Pulumi Provider
The Checkly Pulumi provider enables you to create and configure Checkly resources using your favourite programming language. Note that this project is in its early stages and breaking changes could happen.
Installation
- To use this package, please install the Pulumi CLI first.
- This package is only available for JavaScript and TypeScript but support for other languages will be available soon.
Node.js (JavaScript/TypeScript)
To use from JavaScript or TypeScript in Node.js, install using either npm
or yarn
:
$ npm install @checkly/pulumi
$ yarn add @checkly/pulumi
Python, Go & .NET
TBA
Authentication
The Pulumi Checkly Provider needs to be configured with a Checkly API Key
and Account ID
before it can be used to create resources.
If you don't have an
API Key
, you can create one here.
Once you generated the API Key
there are two ways to communicate your authorization tokens to Pulumi:
-
Set the environment variables
CHECKLY_API_KEY
andCHECKLY_ACCOUNT_ID
:$ export CHECKLY_API_KEY=cu_xxx $ export CHECKLY_ACCOUNT_ID=xxx
-
Set them using
pulumi config
command, if you prefer that they be stored alongside your Pulumi stack for easy multi-user access:$ pulumi config set checkly:apiKey cu_xxx --secret $ pulumi config set checkly:accountId xxx
Remember to pass
--secret
when settingcheckly:apiKey
so it is properly encrypted.
Getting Started
-
Open your terminal and run
$ pulumi new javascript
to create a new Pulumi project with thejavascript
template. -
Install the Checkly Pulumi provider using npm:
$ npm i @checkly/pulumi
. -
Look for
index.js
file in the root of your project and replace content with the following code:const checkly = require("@checkly/pulumi") new checkly.Check("api-check", { type: "API", name: "Public SpaceX API", activated: true, frequency: 10, locations: ["us-east-1"], request: { method: "GET", url: "https://api.spacexdata.com/v3", assertions: [ { source: 'STATUS_CODE', comparison: 'EQUALS', target: 200 }, { source: 'JSON_BODY', property: '$.project_name', comparison: 'EQUALS', target: 'SpaceX-API' } ] } }) new checkly.Check("browser-check", { type: "BROWSER", name: "Google.com Playwright check", activated: true, frequency: 10, locations: ["us-east-1"], script: `const { chromium } = require('playwright') async function run () { const browser = await chromium.launch() const page = await browser.newPage() const response = await page.goto('https://google.com') if (response.status() > 399) { throw new Error('Failed with response code \${response.status()}') } await page.screenshot({ path: 'screenshot.jpg' }) await page.close() await browser.close() } run()` })
-
Setup you Checkly API Key and Account id:
$ pulumi config set checkly:apiKey cu_xxx --secret $ pulumi config set checkly:accountId xxx
-
You are ready to go, run
$ pulumi up
to deploy your stack 🚀
Examples
Find working JavaScript and TypeScript code samples in the ./examples
directory.
Learn More
For documentation and example usage see:
Questions
For questions and support please open a new discussion. The issue list of this repo is exclusively for bug reports and feature/docs requests.
Issues
Please make sure to respect issue requirements and choose the proper issue template when opening an issue. Issues not conforming to the guidelines may be closed.
Contribution
Please make sure to read the Contributing Guide before making a pull request.
License
Delightful Active Monitoring for Developers
From Checkly with ♥️
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pulumi_checkly-1.1.4.tar.gz
.
File metadata
- Download URL: pulumi_checkly-1.1.4.tar.gz
- Upload date:
- Size: 37.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f686d5c3af9d59c865bc509d9c50bf791a43d98738229fed00e7d606fa4d23b |
|
MD5 | 1d13e29be93af6b25836f2b3257ba439 |
|
BLAKE2b-256 | 3cfa5b99b5bd8be55288ceaf648d9dd7034b7c90938e969ae0553cadfeccb062 |