/terraflicks

An API to test run tasks

Primary LanguageClojure

terraflicks

A simple API to test the integration of the Terraform Cloud Run tasks feature. To get started set up a Task event Hook. Go to Settings > Task event hooks > Add Event Hook.

Give an appropriate name that describes your task use case scenario.

Choose the event hook url that fits your use case.

Save the event hook. You can also create multiple, one per scenario.

Go to your workspace Settings > Tasks and create tasks for the event hooks you've just created. Queue a run and see what happens.

Note:

This API is hosted on Heroku, and Heroku will shut down this service after a period of inactivity. To make sure the event hooks will respond in time when testing out the run tasks feature, visit http://floating-caverns-48130.herokuapp.com/ first and wait for the Swagger UI to load. Then you are ready for testing.

Swagger

A swagger UI describing the API can be found here http://floating-caverns-48130.herokuapp.com/

Prerequisites

You will need Leiningen 2.0 or above installed.

Running

To start a web server for the application, run:

lein run 

You can also use docker-compose to run the server locally:

docker-compose up

lein run exposes a port 3000 on localhost, running docker-compose will have it running on port 3006

In order to use the local server for event hooks, you need to also create an url with ngrok

ngrok http 3006

This will create an url to your local, e.g. http://e28bfacd28ab.ngrok.io

Deployment

The app runs on Heroku. You need to have the heroku cli installed.

Once you've installed the cli and created a Heroku account:

heroku login
git push heroku main

To view the logs:

heroku logs