DivvyCloud

Welcome to the DivvyCloud Docs!

DivvyCloud is a Cloud Security Posture Management (CSPM) platform that provides real-time analysis and automated remediation across leading cloud and container technologies.

For questions about documentation reach out to us [email protected]

Take Me to the Docs!    Release Notes

Overview

Jinja 2 is — "a template engine built with Python that can be used to create HTML, XML or other markup formats that are returned to the user via an HTTP response." To learn more, you can read about it here.

Within DivvyCloud, certain actions in BotFactory, have the ability to leverage Jinja2 templating in the message body. This capability enables Bot authors to insert a variety of useful data about resources into the message.

On this page we will walk you through some examples of configuring Jinja2 and the steps required to use these templates within your Bot. We also have a full page of Jinja2 - References that include details on syntax, sample custom messages, and some examples of more advanced policy.

Prerequisites

Before getting started with Jinja2 you will need to have the following:

  • the appropriate permissions to create a Bot
  • completed integrations for any external tools you may want to use to send messages (e.g. SMTP for email, Slack, or MS Teams)

Other Important Information

If you have additional questions reach out to our team through [email protected]

Supported Actions

The following Bot actions support the Jinja2 capabilities outlined here.

  • Send Delayed Email (see example messages below)
  • Post Request To URL
  • Send HipChat Message
  • Send Slack Message
  • Set Container Policy (see custom policies examples below)
  • Assign Tag to Resource
  • Send MS Teams Message

Jinja2 Examples

Using Jinja2 in a Slack Message

In this example we will walk through the steps required to set up a Slack notification with a customized message when new volumes are provisioned. The Slack message will use Jinja2 templating and contain the account name and availability zone where the volume resides.

Before you get started, make sure your Slack Integration is already configured.

1. From your DivvyCloud platform, navigate to the Automation --> BotFactory section.

2. Select "Create Bot" to launch the bot creation process. Complete your Bot details (About Bot, Resource Types & Groups, Conditions)

3. Under Actions select "Send Slack Message" and specify the following:

  • Slack Channel - where you want the message to be delivered within Slack
  • Username - this is who the message will be originating "from"
  • Tags (optional) - to assign recipients via tags
  • Badges (optional) - to assign recipients via badges

4. Under Actions include the contents of your Jinja2 template/message.

  • Note: Slack also includes the capability to "preview" this message before finalizing the creation of the Bot.
  • Check out example messages on the Jinja2 - References page.

5. Complete your message details, click "Next" to add any additional Run Options and when you're satisfied that your Bot is complete click "Save".

Bot for Slack Notification with Jinja2

Using Jinja2 in a Delayed Email

In this example we will walk through the steps required to use Jinja2 to configure a 'Send Delayed Email' notification. This action will send an email to the admin team when a new instance is provisioned, allowing the admin team to see any new resource that can impact the monthly bill.

Before you get started, make sure your SMTP (Email Notifications) is already configured.

1. From your DivvyCloud platform, navigate to the Automation --> BotFactory section.

2. Select "Create Bot" to launch the bot creation process. Complete your Bot details (About Bot, Resource Types & Groups, Conditions)

3. Under Actions select "Send Delayed Email" and specify the following:

  • Subject Line - the subject of the email
  • Contents of the message - the contents of the email (including Jijna2 templated details)
  • Email address for "from" - the email address that the message is being sent "from"
  • Recipients - the email address(es) for the contacts that will receive the message

Bot for Delayed Email Notification with Jinja2

4. Complete your message details, click "Next" to add any additional Run Options and when your satisfied that your Bot is complete click "Save".

What's Next?

Explore the Resource attributes and functions to understand the requirements for configuring your desired template attributes.

In addition, you can take advantage of existing custom messages and read through details around resource functions. Head over to the Jinja2 - References page to see those details.

Updated 3 months ago


Other Helpful Pages

Resources
Jinja2 - References

Jinja2


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.