Skip to content
This repository has been archived by the owner on Nov 28, 2019. It is now read-only.

mlafeldt/terraform-provider-launchdarkly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Provider for LaunchDarkly

Deprecated! Please use the official provider.

Using the Provider

Supported Resources

  • launchdarkly_project
  • launchdarkly_environment
  • launchdarkly_feature_flag

Example

resource "launchdarkly_project" "example" {
  name = "Example Project"
  key  = "example"
}

resource "launchdarkly_environment" "staging" {
  name  = "Staging"
  key   = "staging"
  color = "0000ff"

  project = "${launchdarkly_project.example.key}"
}

resource launchdarkly_feature_flag "example" {
  key  = "some.example.flag"
  name = "Some example flag"

  tags = [
    "hello",
    "world",
  ]

  project = "${launchdarkly_project.example.key}"
}

output "staging_api_key" {
  value = "${launchdarkly_environment.staging.api_key}"
}

Installing the Provider

You'll first need Go installed on your machine (version 1.9+ is required). You'll also need to correctly set up a GOPATH.

To build and install the provider from source, do the following:

mkdir -p $GOPATH/src/github.com/mlafeldt
cd $GOPATH/src/github.com/mlafeldt
git clone https://github.com/mlafeldt/terraform-provider-launchdarkly
cd terraform-provider-launchdarkly
make install-deps
make install

Developing the Provider

To compile the provider, run make build. This will build the provider and put the provider binary in the current directory.

cd $GOPATH/src/github.com/mlafeldt/terraform-provider-launchdarkly
make install-deps
make build
...
./terraform-provider-launchdarkly
...

In order to test the binary with Terraform, create a .tf file in the current directory and run make apply or make destroy.

vim example.tf
...
make apply
...
make destroy
...

Known Issues

  • Creating a new project via the LaunchDarkly API will, unfortunately, also create two environments by default (Production and Test). It's not possible to delete both since at least one must exist. The launchdarkly_project and launchdarkly_environment resources don't handle this case in a good way yet. As a workaround, it's possible to import these special environments via terraform import. See launchdarkly/ld-openapi#7.
  • Even if we could solve the previous issue, there would still be the problem that there must be at least one project, making it impossible to have a clean slate using Terraform.
  • launchdarkly_feature_flag doesn't support custom variations yet (bool only).