Giter VIP home page Giter VIP logo

terraform-provider-ksql's Introduction

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
  3. Build the provider make build
  4. Run the tests make test

Distribuition

  1. Adjust the VERSION
  2. Run the build
    make -f Makefile all
    

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';"
}

the same with just ksql query string:

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

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

the same with just ksql query string:

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

ksql_source_connector

resource "ksql_source_connector" "jdbcconnector" {
  ksql = <<EOF
CREATE SOURCE CONNECTOR `jdbc-connector` WITH(
    "connector.class"='io.confluent.connect.jdbc.JdbcSourceConnector',
    "connection.url"='jdbc:postgresql://localhost:5432/my.db',
    "mode"='bulk',
    "topic.prefix"='jdbc-',
    "table.whitelist"='users',
    "key"='username');
EOF
  }
}

ksql_sink_connector

resource "ksql_sink_connector" "docs" {
  ksql = <<EOF
CREATE SINK CONNECTOR DOCS WITH (
   'connector.class'          = 'io.confluent.connect.jdbc.JdbcSinkConnector',
   'connection.url'           = 'jdbc:postgresql://localhost:5432/my_db',
   'connection.user'          = 'pguser',
   'connection.password'      = 'pgpass',
   'tasks.max'                = '1',
   'topics'                   = 'docs_avro',
   'batch.size'               = '3',
   'table.name.format'        = 'docs',
   'auto.create'              = 'true',
   'auto.evolve'              = 'true',
   'delete.enabled'           = 'false',
   'pk.mode'                  = 'record_key',
   'pk.fields'                = 'docId',
   'insert.mode'              = 'UPSERT'
);
EOF
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.