Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.22.9
1.23.5
37 changes: 37 additions & 0 deletions docs/data-sources/ai_config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "launchdarkly_ai_config Data Source - launchdarkly"
subcategory: ""
description: |-
Provides a LaunchDarkly AI config data source.
This data source allows you to retrieve AI config information from your LaunchDarkly project.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Provides a LaunchDarkly AI config data source.
This data source allows you to retrieve AI config information from your LaunchDarkly project.
Provides a LaunchDarkly AI Config data source.
This data source allows you to retrieve AI Config information from your LaunchDarkly project.

-> Note: AI Configs are currently in beta.
---

# launchdarkly_ai_config (Data Source)

Provides a LaunchDarkly AI config data source.

This data source allows you to retrieve AI config information from your LaunchDarkly project.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Provides a LaunchDarkly AI config data source.
This data source allows you to retrieve AI config information from your LaunchDarkly project.
Provides a LaunchDarkly AI Config data source.
This data source allows you to retrieve AI Config information from your LaunchDarkly project.


-> **Note:** AI Configs are currently in beta.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `key` (String) The unique key of the AI config.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `key` (String) The unique key of the AI config.
- `key` (String) The unique key of the AI Config.

- `project_key` (String) The project key.

### Read-Only

- `description` (String) The description of the AI config.
- `id` (String) The ID of this resource.
- `maintainer_id` (String) The ID of the member who maintains this AI config.
- `maintainer_team_key` (String) The key of the team that maintains this AI config.
- `name` (String) The human-readable name of the AI config.
- `tags` (Set of String) Tags associated with the AI config.
- `version` (Number) The version of the AI config.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `description` (String) The description of the AI config.
- `id` (String) The ID of this resource.
- `maintainer_id` (String) The ID of the member who maintains this AI config.
- `maintainer_team_key` (String) The key of the team that maintains this AI config.
- `name` (String) The human-readable name of the AI config.
- `tags` (Set of String) Tags associated with the AI config.
- `version` (Number) The version of the AI config.
- `description` (String) The description of the AI Config.
- `id` (String) The ID of this resource.
- `maintainer_id` (String) The ID of the member who maintains this AI Config.
- `maintainer_team_key` (String) The key of the team that maintains this AI Config.
- `name` (String) The human-readable name of the AI Config.
- `tags` (Set of String) Tags associated with the AI Config.
- `version` (Number) The version of the AI Config.

2 changes: 1 addition & 1 deletion docs/data-sources/audit_log_subscription.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ data "launchdarkly_audit_log_subscription" "test" {
### Required

- `id` (String) The audit log subscription ID.
- `integration_key` (String) The integration key. Supported integration keys are `chronosphere`, `cloudtrail`, `datadog`, `dynatrace`, `dynatrace-v2`, `elastic`, `grafana`, `honeycomb`, `kosli`, `last9`, `logdna`, `msteams`, `new-relic-apm`, `pagerduty`, `signalfx`, `slack`, and `splunk`.
- `integration_key` (String) The integration key. Supported integration keys are `slack`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `integration_key` (String) The integration key. Supported integration keys are `slack`.
- `integration_key` (String) The integration key. Supported integration key is `slack`.


### Read-Only

Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/flag_trigger.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Please note that if you did not save this upon creation of the resource, you wil

- `enabled` (Boolean) Whether the trigger is currently active or not.
- `instructions` (List of Object) Instructions containing the action to perform when invoking the trigger. Currently supported flag actions are `turnFlagOn` and `turnFlagOff`. This must be passed as the key-value pair `{ kind = "<flag_action>" }`. (see [below for nested schema](#nestedatt--instructions))
- `integration_key` (String) The unique identifier of the integration you intend to set your trigger up with. Currently supported are `generic-trigger`, `datadog`, `dynatrace`, `dynatrace-cloud-automation`, `honeycomb`, `new-relic-apm`, and `signalfx`. `generic-trigger` should be used for integrations not explicitly supported.
- `integration_key` (String) The unique identifier of the integration you intend to set your trigger up with. Currently supported are `generic-trigger`. `generic-trigger` should be used for integrations not explicitly supported.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `integration_key` (String) The unique identifier of the integration you intend to set your trigger up with. Currently supported are `generic-trigger`. `generic-trigger` should be used for integrations not explicitly supported.
- `integration_key` (String) The unique identifier of the integration you intend to set your trigger up with. Currently supported is `generic-trigger`. You should use `generic-trigger` for integrations not explicitly supported.

- `maintainer_id` (String) The ID of the member responsible for maintaining the flag trigger. If created via Terraform, this value will be the ID of the member associated with the API key used for your provider configuration.
- `trigger_url` (String, Sensitive) The unique URL used to invoke the trigger.

Expand Down
40 changes: 40 additions & 0 deletions docs/resources/ai_config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "launchdarkly_ai_config Resource - launchdarkly"
subcategory: ""
description: |-
Provides a LaunchDarkly AI config resource.
This resource allows you to create and manage AI configs within your LaunchDarkly project.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Provides a LaunchDarkly AI config resource.
This resource allows you to create and manage AI configs within your LaunchDarkly project.
Provides a LaunchDarkly AI Config resource.
This resource allows you to create and manage AI Configs within your LaunchDarkly project.

-> Note: AI Configs are currently in beta.
---

# launchdarkly_ai_config (Resource)

Provides a LaunchDarkly AI config resource.

This resource allows you to create and manage AI configs within your LaunchDarkly project.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Provides a LaunchDarkly AI config resource.
This resource allows you to create and manage AI configs within your LaunchDarkly project.
Provides a LaunchDarkly AI Config resource.
This resource allows you to create and manage AI Configs within your LaunchDarkly project.


-> **Note:** AI Configs are currently in beta.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `key` (String) The unique key of the AI config.
- `name` (String) The human-readable name of the AI config.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `key` (String) The unique key of the AI config.
- `name` (String) The human-readable name of the AI config.
- `key` (String) The unique key of the AI Config.
- `name` (String) The human-readable name of the AI Config.

- `project_key` (String) The project key.

### Optional

- `description` (String) The description of the AI config.
- `maintainer_id` (String) The ID of the member who maintains this AI config.
- `maintainer_team_key` (String) The key of the team that maintains this AI config.
- `tags` (Set of String) Tags associated with the AI config.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `description` (String) The description of the AI config.
- `maintainer_id` (String) The ID of the member who maintains this AI config.
- `maintainer_team_key` (String) The key of the team that maintains this AI config.
- `tags` (Set of String) Tags associated with the AI config.
- `description` (String) The description of the AI Config.
- `maintainer_id` (String) The ID of the member who maintains this AI Config.
- `maintainer_team_key` (String) The key of the team that maintains this AI Config.
- `tags` (Set of String) Tags associated with the AI Config.


### Read-Only

- `id` (String) The ID of this resource.
- `version` (Number) The version of the AI config.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `version` (Number) The version of the AI config.
- `version` (Number) The version of the AI Config.

2 changes: 1 addition & 1 deletion docs/resources/audit_log_subscription.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ resource "launchdarkly_audit_log_subscription" "example" {
### Required

- `config` (Map of String) The set of configuration fields corresponding to the value defined for `integration_key`. Refer to the `formVariables` field in the corresponding `integrations/<integration_key>/manifest.json` file in [this repo](https://github.com/launchdarkly/integration-framework/tree/master/integrations) for a full list of fields for the integration you wish to configure. **IMPORTANT**: Please note that Terraform will only accept these in snake case, regardless of the case shown in the manifest.
- `integration_key` (String) The integration key. Supported integration keys are `chronosphere`, `cloudtrail`, `datadog`, `dynatrace`, `dynatrace-v2`, `elastic`, `grafana`, `honeycomb`, `kosli`, `last9`, `logdna`, `msteams`, `new-relic-apm`, `pagerduty`, `signalfx`, `slack`, and `splunk`. A change in this field will force the destruction of the existing resource and the creation of a new one.
- `integration_key` (String) The integration key. Supported integration keys are `slack`. A change in this field will force the destruction of the existing resource and the creation of a new one.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `integration_key` (String) The integration key. Supported integration keys are `slack`. A change in this field will force the destruction of the existing resource and the creation of a new one.
- `integration_key` (String) The integration key. Supported integration key is `slack`. A change in this field will force the destruction of the existing resource and the creation of a new one.

- `name` (String) A human-friendly name for your audit log subscription viewable from within the LaunchDarkly Integrations page.
- `on` (Boolean) Whether or not you want your subscription enabled, i.e. to actively send events.
- `statements` (Block List, Min: 1) A block representing the resources to which you wish to subscribe. (see [below for nested schema](#nestedblock--statements))
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/flag_trigger.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ resource "launchdarkly_flag_trigger" "example" {
- `env_key` (String) The unique key of the environment the flag trigger will work in. A change in this field will force the destruction of the existing resource and the creation of a new one.
- `flag_key` (String) The unique key of the associated flag. A change in this field will force the destruction of the existing resource and the creation of a new one.
- `instructions` (Block List, Min: 1, Max: 1) Instructions containing the action to perform when invoking the trigger. Currently supported flag actions are `turnFlagOn` and `turnFlagOff`. This must be passed as the key-value pair `{ kind = "<flag_action>" }`. (see [below for nested schema](#nestedblock--instructions))
- `integration_key` (String) The unique identifier of the integration you intend to set your trigger up with. Currently supported are `generic-trigger`, `datadog`, `dynatrace`, `dynatrace-cloud-automation`, `honeycomb`, `new-relic-apm`, and `signalfx`. `generic-trigger` should be used for integrations not explicitly supported. A change in this field will force the destruction of the existing resource and the creation of a new one.
- `integration_key` (String) The unique identifier of the integration you intend to set your trigger up with. Currently supported are `generic-trigger`. `generic-trigger` should be used for integrations not explicitly supported. A change in this field will force the destruction of the existing resource and the creation of a new one.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `integration_key` (String) The unique identifier of the integration you intend to set your trigger up with. Currently supported are `generic-trigger`. `generic-trigger` should be used for integrations not explicitly supported. A change in this field will force the destruction of the existing resource and the creation of a new one.
- `integration_key` (String) The unique identifier of the integration you intend to set your trigger up with. Currently supported is `generic-trigger`. You should use `generic-trigger` for integrations not explicitly supported. A change in this field will force the destruction of the existing resource and the creation of a new one.

- `project_key` (String) The unique key of the project encompassing the associated flag. A change in this field will force the destruction of the existing resource and the creation of a new one.

### Read-Only
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
)

require (
github.com/launchdarkly/api-client-go/v17 v17.1.0
github.com/launchdarkly/api-client-go/v17 v17.2.0
golang.org/x/sync v0.16.0
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+
github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+sBqGZrRkMwPgg=
github.com/launchdarkly/api-client-go/v17 v17.1.0 h1:IbR5UDLKBmff0eRBSD3UgVDfgnifOepBIe4gqivMaec=
github.com/launchdarkly/api-client-go/v17 v17.1.0/go.mod h1:lMTmhEjepXfam8xm8b0ERBJbV9g8vdu9nbKueDXcB5o=
github.com/launchdarkly/api-client-go/v17 v17.2.0 h1:5CJxDaL7ZgqALAcohNUMlV7hfXR65s2czZ4XmZjW/qI=
github.com/launchdarkly/api-client-go/v17 v17.2.0/go.mod h1:lMTmhEjepXfam8xm8b0ERBJbV9g8vdu9nbKueDXcB5o=
github.com/ldez/gomoddirectives v0.2.2/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0=
github.com/ldez/tagliatelle v0.3.0/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88=
github.com/leonklingele/grouper v1.1.0/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY=
Expand Down
69 changes: 69 additions & 0 deletions launchdarkly/data_source_launchdarkly_ai_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package launchdarkly

import (
"context"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceAIConfig() *schema.Resource {
return &schema.Resource{
ReadContext: dataSourceAIConfigRead,
Schema: map[string]*schema.Schema{
PROJECT_KEY: {
Type: schema.TypeString,
Required: true,
Description: "The project key.",
},
KEY: {
Type: schema.TypeString,
Required: true,
Description: "The unique key of the AI config.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Description: "The unique key of the AI config.",
Description: "The unique key of the AI Config.",

},
NAME: {
Type: schema.TypeString,
Computed: true,
Description: "The human-readable name of the AI config.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Description: "The human-readable name of the AI config.",
Description: "The human-readable name of the AI Config.",

},
DESCRIPTION: {
Type: schema.TypeString,
Computed: true,
Description: "The description of the AI config.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Description: "The description of the AI config.",
Description: "The description of the AI Config.",

},
TAGS: {
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
Description: "Tags associated with the AI config.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Description: "Tags associated with the AI config.",
Description: "Tags associated with the AI Config.",

},
MAINTAINER_ID: {
Type: schema.TypeString,
Computed: true,
Description: "The ID of the member who maintains this AI config.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Description: "The ID of the member who maintains this AI config.",
Description: "The ID of the member who maintains this AI Config.",

},
MAINTAINER_TEAM_KEY: {
Type: schema.TypeString,
Computed: true,
Description: "The key of the team that maintains this AI config.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Description: "The key of the team that maintains this AI config.",
Description: "The key of the team that maintains this AI Config.",

},
VERSION: {
Type: schema.TypeInt,
Computed: true,
Description: "The version of the AI config.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Description: "The version of the AI config.",
Description: "The version of the AI Config.",

},
},
Description: `Provides a LaunchDarkly AI config data source.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Description: `Provides a LaunchDarkly AI config data source.
Description: `Provides a LaunchDarkly AI Config data source.

This data source allows you to retrieve AI config information from your LaunchDarkly project.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This data source allows you to retrieve AI config information from your LaunchDarkly project.
This data source allows you to retrieve AI Config information from your LaunchDarkly project.

-> **Note:** AI Configs are currently in beta.`,
}
}

func dataSourceAIConfigRead(ctx context.Context, d *schema.ResourceData, metaRaw interface{}) diag.Diagnostics {
projectKey := d.Get(PROJECT_KEY).(string)
key := d.Get(KEY).(string)
d.SetId(projectKey + "/" + key)
return resourceAIConfigRead(ctx, d, metaRaw)
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ func TestAccDataSourceFeatureFlagEnvironment_exists(t *testing.T) {
require.NoError(t, err)
}()

thisConfig := flag.Environments[envKey]
otherConfig := flag.Environments["production"]
thisConfig := (*flag.Environments)[envKey]
otherConfig := (*flag.Environments)["production"]

flagId := projectKey + "/" + flagKey
resourceName := "data.launchdarkly_feature_flag_environment.test"
Expand Down Expand Up @@ -283,8 +283,8 @@ func TestAccDataSourceFeatureFlagEnvironment_WithContextFields(t *testing.T) {
require.NoError(t, err)
}()

thisConfig := flag.Environments[envKey]
otherConfig := flag.Environments["production"]
thisConfig := (*flag.Environments)[envKey]
otherConfig := (*flag.Environments)["production"]

flagId := projectKey + "/" + flagKey
resourceName := "data.launchdarkly_feature_flag_environment.test"
Expand Down
12 changes: 11 additions & 1 deletion launchdarkly/feature_flag_environment_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,17 @@ func featureFlagEnvironmentRead(ctx context.Context, d *schema.ResourceData, raw
return diag.Errorf("failed to get flag %q of project %q: %s", flagKey, projectKey, handleLdapiErr(err))
}

environment, ok := flag.Environments[envKey]
if flag.Environments == nil {
log.Printf("[WARN] failed to find environments for flag %q, removing from state", flagKey)
diags = append(diags, diag.Diagnostic{
Severity: diag.Warning,
Summary: fmt.Sprintf("[WARN] failed to find environments for flag %q, removing from state", flagKey),
})
d.SetId("")
return diags
}

environment, ok := (*flag.Environments)[envKey]
if !ok {
log.Printf("[WARN] failed to find environment %q for flag %q, removing from state", envKey, flagKey)
diags = append(diags, diag.Diagnostic{
Expand Down
2 changes: 2 additions & 0 deletions launchdarkly/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func Provider() *schema.Provider {
"launchdarkly_audit_log_subscription": resourceAuditLogSubscription(),
"launchdarkly_relay_proxy_configuration": resourceRelayProxyConfig(),
"launchdarkly_metric": resourceMetric(),
"launchdarkly_ai_config": resourceAIConfig(),
},
DataSourcesMap: map[string]*schema.Resource{
"launchdarkly_team": dataSourceTeam(),
Expand All @@ -92,6 +93,7 @@ func Provider() *schema.Provider {
"launchdarkly_audit_log_subscription": dataSourceAuditLogSubscription(),
"launchdarkly_relay_proxy_configuration": dataSourceRelayProxyConfig(),
"launchdarkly_metric": dataSourceMetric(),
"launchdarkly_ai_config": dataSourceAIConfig(),
},
ConfigureContextFunc: providerConfigure,
}
Expand Down
Loading
Loading