launchdarkly logo
Launch Darkly v0.0.6, Feb 19 23

launchdarkly.Segment

Provides a LaunchDarkly segment resource.

This resource allows you to create and manage segments within your LaunchDarkly organization.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Launchdarkly = Lbrlabs.PulumiPackage.Launchdarkly;

return await Deployment.RunAsync(() => 
{
    var example = new Launchdarkly.Segment("example", new()
    {
        Key = "example-segment-key",
        ProjectKey = launchdarkly_project.Example.Key,
        EnvKey = launchdarkly_environment.Example.Key,
        Description = "This segment is managed by Terraform",
        Tags = new[]
        {
            "segment-tag-1",
            "segment-tag-2",
        },
        Includeds = new[]
        {
            "user1",
            "user2",
        },
        Excludeds = new[]
        {
            "user3",
            "user4",
        },
        Rules = new[]
        {
            new Launchdarkly.Inputs.SegmentRuleArgs
            {
                Clauses = new[]
                {
                    new Launchdarkly.Inputs.SegmentRuleClauseArgs
                    {
                        Attribute = "country",
                        Op = "startsWith",
                        Values = new[]
                        {
                            "en",
                            "de",
                            "un",
                        },
                        Negate = false,
                    },
                },
            },
        },
    });

});
package main

import (
	"github.com/lbrlabs/pulumi-launchdarkly/sdk/go/launchdarkly"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := launchdarkly.NewSegment(ctx, "example", &launchdarkly.SegmentArgs{
			Key:         pulumi.String("example-segment-key"),
			ProjectKey:  pulumi.Any(launchdarkly_project.Example.Key),
			EnvKey:      pulumi.Any(launchdarkly_environment.Example.Key),
			Description: pulumi.String("This segment is managed by Terraform"),
			Tags: pulumi.StringArray{
				pulumi.String("segment-tag-1"),
				pulumi.String("segment-tag-2"),
			},
			Includeds: pulumi.StringArray{
				pulumi.String("user1"),
				pulumi.String("user2"),
			},
			Excludeds: pulumi.StringArray{
				pulumi.String("user3"),
				pulumi.String("user4"),
			},
			Rules: launchdarkly.SegmentRuleArray{
				&launchdarkly.SegmentRuleArgs{
					Clauses: launchdarkly.SegmentRuleClauseArray{
						&launchdarkly.SegmentRuleClauseArgs{
							Attribute: pulumi.String("country"),
							Op:        pulumi.String("startsWith"),
							Values: pulumi.StringArray{
								pulumi.String("en"),
								pulumi.String("de"),
								pulumi.String("un"),
							},
							Negate: pulumi.Bool(false),
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.launchdarkly.Segment;
import com.pulumi.launchdarkly.SegmentArgs;
import com.pulumi.launchdarkly.inputs.SegmentRuleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new Segment("example", SegmentArgs.builder()        
            .key("example-segment-key")
            .projectKey(launchdarkly_project.example().key())
            .envKey(launchdarkly_environment.example().key())
            .description("This segment is managed by Terraform")
            .tags(            
                "segment-tag-1",
                "segment-tag-2")
            .includeds(            
                "user1",
                "user2")
            .excludeds(            
                "user3",
                "user4")
            .rules(SegmentRuleArgs.builder()
                .clauses(SegmentRuleClauseArgs.builder()
                    .attribute("country")
                    .op("startsWith")
                    .values(                    
                        "en",
                        "de",
                        "un")
                    .negate(false)
                    .build())
                .build())
            .build());

    }
}
import pulumi
import lbrlabs_pulumi_launchdarkly as launchdarkly

example = launchdarkly.Segment("example",
    key="example-segment-key",
    project_key=launchdarkly_project["example"]["key"],
    env_key=launchdarkly_environment["example"]["key"],
    description="This segment is managed by Terraform",
    tags=[
        "segment-tag-1",
        "segment-tag-2",
    ],
    includeds=[
        "user1",
        "user2",
    ],
    excludeds=[
        "user3",
        "user4",
    ],
    rules=[launchdarkly.SegmentRuleArgs(
        clauses=[launchdarkly.SegmentRuleClauseArgs(
            attribute="country",
            op="startsWith",
            values=[
                "en",
                "de",
                "un",
            ],
            negate=False,
        )],
    )])
import * as pulumi from "@pulumi/pulumi";
import * as launchdarkly from "@lbrlabs/pulumi-launchdarkly";

const example = new launchdarkly.Segment("example", {
    key: "example-segment-key",
    projectKey: launchdarkly_project.example.key,
    envKey: launchdarkly_environment.example.key,
    description: "This segment is managed by Terraform",
    tags: [
        "segment-tag-1",
        "segment-tag-2",
    ],
    includeds: [
        "user1",
        "user2",
    ],
    excludeds: [
        "user3",
        "user4",
    ],
    rules: [{
        clauses: [{
            attribute: "country",
            op: "startsWith",
            values: [
                "en",
                "de",
                "un",
            ],
            negate: false,
        }],
    }],
});
resources:
  example:
    type: launchdarkly:Segment
    properties:
      key: example-segment-key
      projectKey: ${launchdarkly_project.example.key}
      envKey: ${launchdarkly_environment.example.key}
      description: This segment is managed by Terraform
      tags:
        - segment-tag-1
        - segment-tag-2
      includeds:
        - user1
        - user2
      excludeds:
        - user3
        - user4
      rules:
        - clauses:
            - attribute: country
              op: startsWith
              values:
                - en
                - de
                - un
              negate: false

Create Segment Resource

new Segment(name: string, args: SegmentArgs, opts?: CustomResourceOptions);
@overload
def Segment(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            env_key: Optional[str] = None,
            excludeds: Optional[Sequence[str]] = None,
            includeds: Optional[Sequence[str]] = None,
            key: Optional[str] = None,
            name: Optional[str] = None,
            project_key: Optional[str] = None,
            rules: Optional[Sequence[SegmentRuleArgs]] = None,
            tags: Optional[Sequence[str]] = None)
@overload
def Segment(resource_name: str,
            args: SegmentArgs,
            opts: Optional[ResourceOptions] = None)
func NewSegment(ctx *Context, name string, args SegmentArgs, opts ...ResourceOption) (*Segment, error)
public Segment(string name, SegmentArgs args, CustomResourceOptions? opts = null)
public Segment(String name, SegmentArgs args)
public Segment(String name, SegmentArgs args, CustomResourceOptions options)
type: launchdarkly:Segment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args SegmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args SegmentArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args SegmentArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args SegmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args SegmentArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Segment Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Segment resource accepts the following input properties:

EnvKey string

The segment's environment key. A change in this field will force the destruction of the existing resource and the creation of a new one.

Key string

The unique key that references the segment. A change in this field will force the destruction of the existing resource and the creation of a new one.

ProjectKey string

The segment's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

Description string

The description of the segment's purpose.

Excludeds List<string>

List of user keys excluded from the segment.

Includeds List<string>

List of user keys included in the segment.

Name string

The human-friendly name for the segment.

Rules List<Lbrlabs.PulumiPackage.Launchdarkly.Inputs.SegmentRuleArgs>

List of nested custom rule blocks to apply to the segment. To learn more, read Nested Rules Blocks.

Tags List<string>

Set of tags for the segment.

EnvKey string

The segment's environment key. A change in this field will force the destruction of the existing resource and the creation of a new one.

Key string

The unique key that references the segment. A change in this field will force the destruction of the existing resource and the creation of a new one.

ProjectKey string

The segment's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

Description string

The description of the segment's purpose.

Excludeds []string

List of user keys excluded from the segment.

Includeds []string

List of user keys included in the segment.

Name string

The human-friendly name for the segment.

Rules []SegmentRuleArgs

List of nested custom rule blocks to apply to the segment. To learn more, read Nested Rules Blocks.

Tags []string

Set of tags for the segment.

envKey String

The segment's environment key. A change in this field will force the destruction of the existing resource and the creation of a new one.

key String

The unique key that references the segment. A change in this field will force the destruction of the existing resource and the creation of a new one.

projectKey String

The segment's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

description String

The description of the segment's purpose.

excludeds List<String>

List of user keys excluded from the segment.

includeds List<String>

List of user keys included in the segment.

name String

The human-friendly name for the segment.

rules List<SegmentRuleArgs>

List of nested custom rule blocks to apply to the segment. To learn more, read Nested Rules Blocks.

tags List<String>

Set of tags for the segment.

envKey string

The segment's environment key. A change in this field will force the destruction of the existing resource and the creation of a new one.

key string

The unique key that references the segment. A change in this field will force the destruction of the existing resource and the creation of a new one.

projectKey string

The segment's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

description string

The description of the segment's purpose.

excludeds string[]

List of user keys excluded from the segment.

includeds string[]

List of user keys included in the segment.

name string

The human-friendly name for the segment.

rules SegmentRuleArgs[]

List of nested custom rule blocks to apply to the segment. To learn more, read Nested Rules Blocks.

tags string[]

Set of tags for the segment.

env_key str

The segment's environment key. A change in this field will force the destruction of the existing resource and the creation of a new one.

key str

The unique key that references the segment. A change in this field will force the destruction of the existing resource and the creation of a new one.

project_key str

The segment's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

description str

The description of the segment's purpose.

excludeds Sequence[str]

List of user keys excluded from the segment.

includeds Sequence[str]

List of user keys included in the segment.

name str

The human-friendly name for the segment.

rules Sequence[SegmentRuleArgs]

List of nested custom rule blocks to apply to the segment. To learn more, read Nested Rules Blocks.

tags Sequence[str]

Set of tags for the segment.

envKey String

The segment's environment key. A change in this field will force the destruction of the existing resource and the creation of a new one.

key String

The unique key that references the segment. A change in this field will force the destruction of the existing resource and the creation of a new one.

projectKey String

The segment's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

description String

The description of the segment's purpose.

excludeds List<String>

List of user keys excluded from the segment.

includeds List<String>

List of user keys included in the segment.

name String

The human-friendly name for the segment.

rules List<Property Map>

List of nested custom rule blocks to apply to the segment. To learn more, read Nested Rules Blocks.

tags List<String>

Set of tags for the segment.

Outputs

All input properties are implicitly available as output properties. Additionally, the Segment resource produces the following output properties:

CreationDate int

The segment's creation date represented as a UNIX epoch timestamp.

Id string

The provider-assigned unique ID for this managed resource.

CreationDate int

The segment's creation date represented as a UNIX epoch timestamp.

Id string

The provider-assigned unique ID for this managed resource.

creationDate Integer

The segment's creation date represented as a UNIX epoch timestamp.

id String

The provider-assigned unique ID for this managed resource.

creationDate number

The segment's creation date represented as a UNIX epoch timestamp.

id string

The provider-assigned unique ID for this managed resource.

creation_date int

The segment's creation date represented as a UNIX epoch timestamp.

id str

The provider-assigned unique ID for this managed resource.

creationDate Number

The segment's creation date represented as a UNIX epoch timestamp.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing Segment Resource

Get an existing Segment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: SegmentState, opts?: CustomResourceOptions): Segment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        creation_date: Optional[int] = None,
        description: Optional[str] = None,
        env_key: Optional[str] = None,
        excludeds: Optional[Sequence[str]] = None,
        includeds: Optional[Sequence[str]] = None,
        key: Optional[str] = None,
        name: Optional[str] = None,
        project_key: Optional[str] = None,
        rules: Optional[Sequence[SegmentRuleArgs]] = None,
        tags: Optional[Sequence[str]] = None) -> Segment
func GetSegment(ctx *Context, name string, id IDInput, state *SegmentState, opts ...ResourceOption) (*Segment, error)
public static Segment Get(string name, Input<string> id, SegmentState? state, CustomResourceOptions? opts = null)
public static Segment get(String name, Output<String> id, SegmentState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
CreationDate int

The segment's creation date represented as a UNIX epoch timestamp.

Description string

The description of the segment's purpose.

EnvKey string

The segment's environment key. A change in this field will force the destruction of the existing resource and the creation of a new one.

Excludeds List<string>

List of user keys excluded from the segment.

Includeds List<string>

List of user keys included in the segment.

Key string

The unique key that references the segment. A change in this field will force the destruction of the existing resource and the creation of a new one.

Name string

The human-friendly name for the segment.

ProjectKey string

The segment's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

Rules List<Lbrlabs.PulumiPackage.Launchdarkly.Inputs.SegmentRuleArgs>

List of nested custom rule blocks to apply to the segment. To learn more, read Nested Rules Blocks.

Tags List<string>

Set of tags for the segment.

CreationDate int

The segment's creation date represented as a UNIX epoch timestamp.

Description string

The description of the segment's purpose.

EnvKey string

The segment's environment key. A change in this field will force the destruction of the existing resource and the creation of a new one.

Excludeds []string

List of user keys excluded from the segment.

Includeds []string

List of user keys included in the segment.

Key string

The unique key that references the segment. A change in this field will force the destruction of the existing resource and the creation of a new one.

Name string

The human-friendly name for the segment.

ProjectKey string

The segment's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

Rules []SegmentRuleArgs

List of nested custom rule blocks to apply to the segment. To learn more, read Nested Rules Blocks.

Tags []string

Set of tags for the segment.

creationDate Integer

The segment's creation date represented as a UNIX epoch timestamp.

description String

The description of the segment's purpose.

envKey String

The segment's environment key. A change in this field will force the destruction of the existing resource and the creation of a new one.

excludeds List<String>

List of user keys excluded from the segment.

includeds List<String>

List of user keys included in the segment.

key String

The unique key that references the segment. A change in this field will force the destruction of the existing resource and the creation of a new one.

name String

The human-friendly name for the segment.

projectKey String

The segment's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

rules List<SegmentRuleArgs>

List of nested custom rule blocks to apply to the segment. To learn more, read Nested Rules Blocks.

tags List<String>

Set of tags for the segment.

creationDate number

The segment's creation date represented as a UNIX epoch timestamp.

description string

The description of the segment's purpose.

envKey string

The segment's environment key. A change in this field will force the destruction of the existing resource and the creation of a new one.

excludeds string[]

List of user keys excluded from the segment.

includeds string[]

List of user keys included in the segment.

key string

The unique key that references the segment. A change in this field will force the destruction of the existing resource and the creation of a new one.

name string

The human-friendly name for the segment.

projectKey string

The segment's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

rules SegmentRuleArgs[]

List of nested custom rule blocks to apply to the segment. To learn more, read Nested Rules Blocks.

tags string[]

Set of tags for the segment.

creation_date int

The segment's creation date represented as a UNIX epoch timestamp.

description str

The description of the segment's purpose.

env_key str

The segment's environment key. A change in this field will force the destruction of the existing resource and the creation of a new one.

excludeds Sequence[str]

List of user keys excluded from the segment.

includeds Sequence[str]

List of user keys included in the segment.

key str

The unique key that references the segment. A change in this field will force the destruction of the existing resource and the creation of a new one.

name str

The human-friendly name for the segment.

project_key str

The segment's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

rules Sequence[SegmentRuleArgs]

List of nested custom rule blocks to apply to the segment. To learn more, read Nested Rules Blocks.

tags Sequence[str]

Set of tags for the segment.

creationDate Number

The segment's creation date represented as a UNIX epoch timestamp.

description String

The description of the segment's purpose.

envKey String

The segment's environment key. A change in this field will force the destruction of the existing resource and the creation of a new one.

excludeds List<String>

List of user keys excluded from the segment.

includeds List<String>

List of user keys included in the segment.

key String

The unique key that references the segment. A change in this field will force the destruction of the existing resource and the creation of a new one.

name String

The human-friendly name for the segment.

projectKey String

The segment's project key. A change in this field will force the destruction of the existing resource and the creation of a new one.

rules List<Property Map>

List of nested custom rule blocks to apply to the segment. To learn more, read Nested Rules Blocks.

tags List<String>

Set of tags for the segment.

Supporting Types

SegmentRule

BucketBy string

The attribute by which to group users together.

Clauses List<Lbrlabs.PulumiPackage.Launchdarkly.Inputs.SegmentRuleClause>

List of nested custom rule clause blocks. To learn more, read Nested Clauses Blocks.

Weight int

The integer weight of the rule (between 1 and 100000).

BucketBy string

The attribute by which to group users together.

Clauses []SegmentRuleClause

List of nested custom rule clause blocks. To learn more, read Nested Clauses Blocks.

Weight int

The integer weight of the rule (between 1 and 100000).

bucketBy String

The attribute by which to group users together.

clauses List<SegmentRuleClause>

List of nested custom rule clause blocks. To learn more, read Nested Clauses Blocks.

weight Integer

The integer weight of the rule (between 1 and 100000).

bucketBy string

The attribute by which to group users together.

clauses SegmentRuleClause[]

List of nested custom rule clause blocks. To learn more, read Nested Clauses Blocks.

weight number

The integer weight of the rule (between 1 and 100000).

bucket_by str

The attribute by which to group users together.

clauses Sequence[SegmentRuleClause]

List of nested custom rule clause blocks. To learn more, read Nested Clauses Blocks.

weight int

The integer weight of the rule (between 1 and 100000).

bucketBy String

The attribute by which to group users together.

clauses List<Property Map>

List of nested custom rule clause blocks. To learn more, read Nested Clauses Blocks.

weight Number

The integer weight of the rule (between 1 and 100000).

SegmentRuleClause

Attribute string

The user attribute to operate on.

Op string

The operator associated with the rule clause. Available options are in, endsWith, startsWith, matches, contains, lessThan, lessThanOrEqual, greaterThanOrEqual, before, after, segmentMatch, semVerEqual, semVerLessThan, and semVerGreaterThan.

Values List<string>

The list of values associated with the rule clause.

Negate bool

Whether to negate the rule clause.

ValueType string

The type for each of the clause's values. Available types are boolean, string, and number. If omitted, value_type defaults to string.

Attribute string

The user attribute to operate on.

Op string

The operator associated with the rule clause. Available options are in, endsWith, startsWith, matches, contains, lessThan, lessThanOrEqual, greaterThanOrEqual, before, after, segmentMatch, semVerEqual, semVerLessThan, and semVerGreaterThan.

Values []string

The list of values associated with the rule clause.

Negate bool

Whether to negate the rule clause.

ValueType string

The type for each of the clause's values. Available types are boolean, string, and number. If omitted, value_type defaults to string.

attribute String

The user attribute to operate on.

op String

The operator associated with the rule clause. Available options are in, endsWith, startsWith, matches, contains, lessThan, lessThanOrEqual, greaterThanOrEqual, before, after, segmentMatch, semVerEqual, semVerLessThan, and semVerGreaterThan.

values List<String>

The list of values associated with the rule clause.

negate Boolean

Whether to negate the rule clause.

valueType String

The type for each of the clause's values. Available types are boolean, string, and number. If omitted, value_type defaults to string.

attribute string

The user attribute to operate on.

op string

The operator associated with the rule clause. Available options are in, endsWith, startsWith, matches, contains, lessThan, lessThanOrEqual, greaterThanOrEqual, before, after, segmentMatch, semVerEqual, semVerLessThan, and semVerGreaterThan.

values string[]

The list of values associated with the rule clause.

negate boolean

Whether to negate the rule clause.

valueType string

The type for each of the clause's values. Available types are boolean, string, and number. If omitted, value_type defaults to string.

attribute str

The user attribute to operate on.

op str

The operator associated with the rule clause. Available options are in, endsWith, startsWith, matches, contains, lessThan, lessThanOrEqual, greaterThanOrEqual, before, after, segmentMatch, semVerEqual, semVerLessThan, and semVerGreaterThan.

values Sequence[str]

The list of values associated with the rule clause.

negate bool

Whether to negate the rule clause.

value_type str

The type for each of the clause's values. Available types are boolean, string, and number. If omitted, value_type defaults to string.

attribute String

The user attribute to operate on.

op String

The operator associated with the rule clause. Available options are in, endsWith, startsWith, matches, contains, lessThan, lessThanOrEqual, greaterThanOrEqual, before, after, segmentMatch, semVerEqual, semVerLessThan, and semVerGreaterThan.

values List<String>

The list of values associated with the rule clause.

negate Boolean

Whether to negate the rule clause.

valueType String

The type for each of the clause's values. Available types are boolean, string, and number. If omitted, value_type defaults to string.

Import

LaunchDarkly segments can be imported using the segment’s ID in the form project_key/env_key/segment_key, e.g.

 $ pulumi import launchdarkly:index/segment:Segment example example-project/example-environment/example-segment-key

Package Details

Repository
launchdarkly lbrlabs/pulumi-launchdarkly
License
Notes

This Pulumi package is based on the launchdarkly Terraform Provider.