Skip to content

awsiv/terraform-provider-rdsdataservice

Repository files navigation

terraform-provider-rdsdataservice

Manage AWS DB resources using the AWS Data API. Connect using methods supported by Data API(secrets manager) and manage a variety of resources using a single provider without having to use multiple providers for different DB types.

Heavily inspired by the following:

AWS Data API allows us to run SQL using HTTP endpoint and AWS SDK. This is awesome because it means that we no longer need to manage connections. This also uses secretsmanager secret so we no longer have to worry about secrets ending up in terraform state.

Since it uses AWS SDK, it might as well belong to terraform-provider-aws itself, but then, the CRUD operations are SQL statements instead of actual API calls - so maybe it has its own place? I am working on porting more resources and more importantly the acceptance tests. Let me know what you think about it :)

API documentation: package rdsdataservice

Requirements

Terraform 0.12+ Go 1.13 (to build the provider plugin)

Install

You will need to install the binary as a terraform third party plugin. Terraform will then pick up the binary from the local filesystem when you run terraform init.

curl -s https://raw.githubusercontent.com/awsiv/terraform-provider-rdsdataservice/master/install.sh | bash

Usage

provider "rdsdataservice" {
  version = "1.0.2"
  region  = var.aws_region
  profile = var.aws_profile
}
resource "rdsdataservice_postgres_database" "test" {
  name         = "test"
  resource_arn = var.db_arn
  secret_arn   = var.secret_arn
  owner        = "postgres"
}
resource "rdsdataservice_postgres_role" "test" {
  name         = "test"
  resource_arn = var.db_arn
  secret_arn   = var.secret_arn
  login        = true
}

Building The Provider

$ git clone [email protected]:awsiv/terraform-provider-rdsdataservice.git
$ cd terraform-provider-rdsdataservice
$ go build