Mongey / terraform-provider-ksql

Terraform provider for managing KSQL queries
MIT License
10 stars 10 forks source link
ksql ksql-server terraform terraform-provider

terraform-provider-ksql

CircleCI

A Terraform plugin for managing Confluent KSQL Server.

Contents

Installation

Download and extract the latest release to your [terraform plugin directory][third-party-plugins] (typically ~/.terraform.d/plugins/)

Developing

  1. Install go

  2. Clone repository to: $GOPATH/src/github.com/Mongey/terraform-provider-ksql

    mkdir -p $GOPATH/src/github.com/Mongey/terraform-provider-ksql; cd $GOPATH/src/github.com/Mongey/
    git clone https://github.com/Mongey/terraform-provider-ksql.git
  3. Build the provider make build

  4. Run the tests make test

  5. Build the provider make build

Provider Configuration

Example

provider "ksql" {
  url = "http://localhost:8083"
}

Resources

ksql_stream

A resource for managing KSQL streams

resource "ksql_stream" "actions" {
  name = "vip_actions"
  query = "SELECT userid, page, action
              FROM clickstream c
              LEFT JOIN users u ON c.userid = u.user_id
              WHERE u.level =
              'Platinum';"
}

ksql_table

A resource for managing KSQL tables

resource "ksql_table" "users" {
  name = "users-thing"
  query = "SELECT error_code,
            count(*),
            FROM monitoring_stream
            WINDOW TUMBLING (SIZE 1 MINUTE)
            WHERE  type = 'ERROR'
            GROUP BY error_code;"
  }
}