Deprecated! Please use the official provider.
launchdarkly_project
launchdarkly_environment
launchdarkly_feature_flag
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}"
}
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
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
...
- 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
andlaunchdarkly_environment
resources don't handle this case in a good way yet. As a workaround, it's possible to import these special environments viaterraform 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).