Terraform provider for SQLite database engine

Overview

Terraform provider for SQLite database engine

!!! WARNING !!!
This is an educational project. Not intended for any production use!
!!! WARNING !!!

Here is my first implemetation of SQLite plugin (provider) for Terraform.

There's no many docs and tests yet. The code is intended for local development and use for now.

Plugin was tested on MacOS X, but should work on any other platform as well.

Prequisites:

  • Go >= 1.16
  • Terraform >= 1.0

Provider supports:

  • Creating database tables with basic constraints like NOT NULL, PRIMARY KEY and DEFAULT
  • Creating database basic indexes

Provider does not support:

  • Table/index schema upgrades (in case of schema changes resources will be recreated)
  • Resources import

Known issues:

  • If you delete/recreate table having any indexes on it, provider will not automatically recreate indexes; it will be recreated on the next run of terraform apply

How to build

  1. Clone repository and make Go download dependencies
    git clone https://github.com/Burmuley/terraform-provider-sqlite
    cd terraform-provider-sqlite
    go get
  2. Run script build.sh to build and install provider to the Terraform local cache, or run these commands to achieve the same
    go build -o terraform-provider-sqlite
    mkdir -p ~/.terraform.d/plugins/burmuley.com/edu/sqlite/0.1/darwin_amd64
    mv terraform-provider-sqlite ~/.terraform.d/plugins/burmuley.com/edu/sqlite/0.1/darwin_amd64

How to use

And example code is located in the example directory.

cd example
terraform init

Then Terraform should find local provider and successfully initialize the local module.

Initializing the backend...

Initializing provider plugins...
- Reusing previous version of burmuley.com/edu/sqlite from the dependency lock file
- Installing burmuley.com/edu/sqlite v0.1.0...
- Installed burmuley.com/edu/sqlite v0.1.0 (unauthenticated)

Terraform has been successfully initialized!

Simply run the apply command and confirm you want to provision "the infrastructure". :)

terraform apply
Terraform will perform the following actions:

  # sqlite_index.test_index1 will be created
  + resource "sqlite_index" "test_index1" {
      + columns = [
          + "id",
          + "name",
        ]
      + created = (known after apply)
      + id      = (known after apply)
      + name    = "users_index"
      + table   = "users"
    }

  # sqlite_table.test_table will be created
  + resource "sqlite_table" "test_table" {
      + created = (known after apply)
      + id      = (known after apply)
      + name    = "users"

      + column {
          + name = "id"
          + type = "INTEGER"

          + constraints {
              + not_null    = true
              + primary_key = true
            }
        }
      + column {
          + name = "name"
          + type = "TEXT"

          + constraints {
              + not_null    = true
              + primary_key = false
            }
        }
      + column {
          + name = "last_name"
          + type = "TEXT"

          + constraints {
              + not_null    = true
              + primary_key = false
            }
        }
      + column {
          + name = "password"
          + type = "TEXT"

          + constraints {
              + default     = "123"
              + not_null    = true
              + primary_key = false
            }
        }
    }

  # sqlite_table.test_table2 will be created
  + resource "sqlite_table" "test_table2" {
      + created = (known after apply)
      + id      = (known after apply)
      + name    = "projects"

      + column {
          + name = "id"
          + type = "INTEGER"

          + constraints {
              + not_null    = true
              + primary_key = true
            }
        }
      + column {
          + name = "user"
          + type = "INTEGER"

          + constraints {
              + not_null    = true
              + primary_key = false
            }
        }
      + column {
          + name = "name"
          + type = "TEXT"

          + constraints {
              + not_null    = true
              + primary_key = false
            }
        }
    }

Plan: 3 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

sqlite_table.test_table2: Creating...
sqlite_table.test_table: Creating...
sqlite_table.test_table2: Creation complete after 0s [id=projects]
sqlite_table.test_table: Creation complete after 0s [id=users]
sqlite_index.test_index1: Creating...
sqlite_index.test_index1: Creation complete after 0s [id=users_index]

Apply complete! Resources: 3 added, 0 changed, 0 destroyed.
Owner
Konstantin Vasilev
DevOps, Cloud Engineer, Golang beginner
Konstantin Vasilev
ACID key-value database.

Coffer Simply ACID* key-value database. At the medium or even low latency it tries to provide greater throughput without losing the ACID properties of

Eduard 27 Aug 31, 2021
An embedded key/value database for Go.

bbolt bbolt is a fork of Ben Johnson's Bolt key/value store. The purpose of this fork is to provide the Go community with an active maintenance and de

etcd-io 4.8k Sep 16, 2021
A MySQL-compatible relational database with a storage agnostic query engine. Implemented in pure Go.

go-mysql-server is a SQL engine which parses standard SQL (based on MySQL syntax) and executes queries on data sources of your choice. A simple in-memory database and table implementation are provided, and you can query any data source you want by implementing a few interfaces.

DoltHub 620 Sep 17, 2021
Graviton Database: ZFS for key-value stores.

Graviton Database: ZFS for key-value stores. Graviton Database is simple, fast, versioned, authenticated, embeddable key-value store database in pure

null 404 Aug 12, 2021
immudb - world’s fastest immutable database

immudb Note: The master branch is the joint point for all ongoing development efforts. Thus it may be in an unstable state and should not be used in p

CodeNotary 3.1k Sep 25, 2021
A decentralized, trusted, high performance, SQL database with blockchain features

中文简介 CovenantSQL(CQL) is a Byzantine Fault Tolerant relational database built on SQLite: ServerLess: Free, High Availabile, Auto Sync Database Service

CovenantSQL 1.2k Sep 19, 2021
A simple, fast, embeddable, persistent key/value store written in pure Go. It supports fully serializable transactions and many data structures such as list, set, sorted set.

NutsDB English | 简体中文 NutsDB is a simple, fast, embeddable and persistent key/value store written in pure Go. It supports fully serializable transacti

徐佳军 1.7k Sep 18, 2021
LBADD: An experimental, distributed SQL database

LBADD Let's build a distributed database. LBADD is an experimental distributed SQL database, written in Go. The goal of this project is to build a dat

Tom Arrell 375 Sep 12, 2021
BuntDB is an embeddable, in-memory key/value database for Go with custom indexing and geospatial support

BuntDB is a low-level, in-memory, key/value store in pure Go. It persists to disk, is ACID compliant, and uses locking for multiple readers and a sing

Josh Baker 3.5k Sep 25, 2021
pure golang key database support key have value. 非常高效实用的键值数据库。

orderfile32 pure golang key database support key have value The orderfile32 is standard alone fast key value database. It have two version. one is thi

null 5 Sep 20, 2021
Fast Database engine in Go.

gaeadb gaeadb is a pure Go Database engine designed by nnsgmsone. The goal of the project is to provide a database engine for table or other complex d

null 14 Mar 26, 2021
El Carro: The Oracle Operator for Kubernetes

El Carro is a new project that offers a way to run Oracle databases in Kubernetes as a portable, open source, community driven, no vendor lock-in container orchestration system. El Carro provides a powerful declarative API for comprehensive and consistent configuration and deployment as well as for real-time operations and monitoring.

Google Cloud Platform 172 Sep 24, 2021
Distributed cache and in-memory key/value data store.

Distributed cache and in-memory key/value data store. It can be used both as an embedded Go library and as a language-independent service.

Burak Sezer 1.9k Sep 17, 2021
"Go SQL DB" is a relational database that supports SQL queries for research purposes

A pure golang SQL database for database theory research

auxten 596 Sep 22, 2021
Fast specialized time-series database for IoT, real-time internet connected devices and AI analytics.

unitdb Unitdb is blazing fast specialized time-series database for microservices, IoT, and realtime internet connected devices. As Unitdb satisfy the

Saffat Technologies 74 Sep 16, 2021
EliasDB a graph-based database.

EliasDB EliasDB is a graph-based database which aims to provide a lightweight solution for projects which want to store their data as a graph. Feature

Matthias Ladkau 831 Sep 9, 2021
Fast key-value DB in Go.

BadgerDB BadgerDB is an embeddable, persistent and fast key-value (KV) database written in pure Go. It is the underlying database for Dgraph, a fast,

Dgraph 9.8k Sep 23, 2021
RadonDB is an open source, cloud-native MySQL database for building global, scalable cloud services

OverView RadonDB is an open source, Cloud-native MySQL database for unlimited scalability and performance. What is RadonDB? RadonDB is a cloud-native

RadonDB 1.6k Sep 24, 2021
Fast and simple key/value store written using Go's standard library

Table of Contents Description Usage Cookbook Disadvantages Motivation Benchmarks Test 1 Test 4 Description Package pudge is a fast and simple key/valu

Vadim Kulibaba 295 Sep 19, 2021