Skip to content

Files

Latest commit

 

History

History

usage-examples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

terraform-provider-launchdarkly examples

Example LaunchDarkly project configured using the LaunchDarkly Terraform provider

Overview

This repository contains a series of directories containing detailed examples of how to configure LaunchDarkly via the Terraform provider. Click here for the official documentation on the Terraform website. A description of the examples included here can be found in the Contents section.

! TAKE NOTE! Running terraform apply on any of these directories with your auth credentials will result in real resources being created that may cost real money. These are meant to be used as examples only and LaunchDarkly is not responsible for any costs incurred via testing.

Before getting started with the LaunchDarkly Terraform provider, make sure you have Terraform correctly installed and configured. For more on this, see the Setup section.

Contents

Setup

Install Terraform

First and foremost, you need to make sure you have Terraform installed on the machine you will be applying the configurations from and that you meet the requirements listed on the project readme. For instructions on how to install Terraform, see here.

Configure LD Credentials

Before getting started with the LaunchDarkly provider, you need to ensure you have your LaunchDarkly credentials properly set up. All you will need for this is a LaunchDarkly access token, which you can create via the LaunchDarkly platform under Account settings > Authorization.

Once you have your access token in hand, there are several ways to set variables within your Terraform context. For the sake of ease, we've set the access token as an environmental variable named LAUNCHDARKLY_ACCESS_TOKEN. The provider configuration will then automatically access it from your environment so that your provider config should only have to contain

provider "launchdarkly" {
    version     = "~> 1.0"
}

! TAKE NOTE! If you are using Terraform version 0.13 or above, your provider block will be nested inside of your terraform block as seen below.

terraform {
  required_providers {
    launchdarkly = {
      source  = "launchdarkly/launchdarkly"
      version = "~> 1.5"
    }
  }
  required_version = ">= 0.13"
}

Some resources or attributes, such as webhook policy_statements, that were added later may require a provider version later than 1.0; check the changelog for more information on versions.

If you would prefer to define your variables some other way, see Terraform's documentation on input variables for some other ways to do so.