Conversation
S1009: len() for nil maps is defined as zero, so the nil check is unnecessary. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The AIConfigPost constructor sets description="" by default, which the API rejects as a 400. Clear it to nil so it's omitted from JSON unless explicitly set. Also add description to all test HCL templates and success_criteria to the evaluation metric test. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The GenericOpenAPIError.Error() only returns the HTTP status, not the body. Use handleLdapiErr which includes the body in the error string. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add "judge" to allowed mode values (API requires it for evaluation metrics) - Fix evaluation metric test: use $ld:ai:judge: prefixed key format - Fix is_inverted always being set on read (was nil when false, causing import state mismatch) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds Terraform provider support for LaunchDarkly AI Configs, including resources/data sources for AI configs, variations, tools, and model configs, plus acceptance tests, examples, generated docs, and CI updates to run the new acceptance test suites.
Changes:
- Introduces new resources/data sources for
ai_config,ai_config_variation,ai_tool, andmodel_configusing the v22 Go SDK AI Configs API. - Adds shared schema/read helpers and JSON validation/diff-suppression helpers for JSON-encoded fields.
- Adds acceptance tests, examples, generated docs, and expands the CI test matrix to execute the new acceptance tests.
Reviewed changes
Copilot reviewed 40 out of 42 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
launchdarkly/resource_launchdarkly_ai_config.go |
Implements launchdarkly_ai_config CRUD + import. |
launchdarkly/ai_config_helper.go |
Shared schema + read logic for AI Config resource/data source. |
launchdarkly/data_source_launchdarkly_ai_config.go |
Adds launchdarkly_ai_config data source. |
launchdarkly/resource_launchdarkly_ai_config_test.go |
Acceptance tests for AI Config resource scenarios. |
launchdarkly/data_source_launchdarkly_ai_config_test.go |
Acceptance tests for AI Config data source. |
launchdarkly/resource_launchdarkly_ai_config_variation.go |
Implements launchdarkly_ai_config_variation CRUD + import. |
launchdarkly/ai_config_variation_helper.go |
Schema + read/flatten/expand helpers for AI Config variations. |
launchdarkly/resource_launchdarkly_ai_config_variation_test.go |
Acceptance tests for AI Config variation scenarios. |
launchdarkly/resource_launchdarkly_ai_tool.go |
Implements launchdarkly_ai_tool CRUD + import. |
launchdarkly/ai_tool_helper.go |
Shared schema + read logic for AI tool resource/data source. |
launchdarkly/data_source_launchdarkly_ai_tool.go |
Adds launchdarkly_ai_tool data source. |
launchdarkly/resource_launchdarkly_ai_tool_test.go |
Acceptance tests for AI tool resource scenarios. |
launchdarkly/data_source_launchdarkly_ai_tool_test.go |
Acceptance tests for AI tool data source. |
launchdarkly/resource_launchdarkly_model_config.go |
Implements launchdarkly_model_config create/read/delete + import (immutable model config API). |
launchdarkly/model_config_helper.go |
Shared schema + read logic for model config resource/data source. |
launchdarkly/data_source_launchdarkly_model_config.go |
Adds launchdarkly_model_config data source. |
launchdarkly/resource_launchdarkly_model_config_test.go |
Acceptance tests for model config resource scenarios. |
launchdarkly/data_source_launchdarkly_model_config_test.go |
Acceptance tests for model config data source. |
launchdarkly/json_helper.go |
Adds JSON validation + semantic diff suppression helpers for JSON-encoded schema fields. |
launchdarkly/keys.go |
Adds new schema key constants used by the AI Configs resources/data sources. |
launchdarkly/provider.go |
Registers the new resources and data sources with the provider. |
examples/resources/launchdarkly_ai_config/resource.tf |
Example usage for AI Config resource. |
examples/resources/launchdarkly_ai_config/import.sh |
Import example for AI Config resource. |
examples/resources/launchdarkly_ai_config_variation/resource.tf |
Example usage for AI Config variation resource. |
examples/resources/launchdarkly_ai_config_variation/import.sh |
Import example for AI Config variation resource. |
examples/resources/launchdarkly_ai_tool/resource.tf |
Example usage for AI tool resource. |
examples/resources/launchdarkly_ai_tool/import.sh |
Import example for AI tool resource. |
examples/resources/launchdarkly_model_config/resource.tf |
Example usage for model config resource. |
examples/resources/launchdarkly_model_config/import.sh |
Import example for model config resource. |
examples/data-sources/launchdarkly_ai_config/data-source.tf |
Example usage for AI Config data source. |
examples/data-sources/launchdarkly_ai_tool/data-source.tf |
Example usage for AI tool data source. |
examples/data-sources/launchdarkly_model_config/data-source.tf |
Example usage for model config data source. |
docs/resources/ai_config.md |
Generated documentation for AI Config resource. |
docs/resources/ai_config_variation.md |
Generated documentation for AI Config variation resource. |
docs/resources/ai_tool.md |
Generated documentation for AI tool resource. |
docs/resources/model_config.md |
Generated documentation for model config resource. |
docs/data-sources/ai_config.md |
Generated documentation for AI Config data source. |
docs/data-sources/ai_tool.md |
Generated documentation for AI tool data source. |
docs/data-sources/model_config.md |
Generated documentation for model config data source. |
.github/workflows/test.yml |
Adds new acceptance test patterns to the CI matrix. |
.gitignore |
Ignores .claude/ and normalizes .DS_Store entry formatting. |
go.sum |
Updates module checksums due to dependency graph changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…st cleanup - Fix GetOk on bool/string zero-values in ai_config create+update - Add ConflictsWith on model vs model_config_key in variation schema - Add CustomizeDiff for is_inverted requiring evaluation_metric_key - Convert ValidateFunc to ValidateDiagFunc for JSON fields - Add sleep before read in variation create/update for version propagation - Create ai_config_variation data source with tests and docs - Add inline model acceptance test for variations - Deduplicate test project helper and cooldown into shared ai_test_helpers_test.go - Add CheckDestroy to all data source tests - Alphabetize provider.go registration
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 46 out of 47 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 46 out of 47 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This is an alternative PR to #402, made using Claude and the 'terraform-provider-add-resource' skill I created earlier.
Functionality is tested against a locally built version of the provider. You can see the stuff it's created in the Engineering Blitz Account here https://app.launchdarkly.com/projects/ai-config-local-test/ai-configs?env=test&selected-env=test
Bit more detail below in a writeup of the work done provided by Claude. And in the spirit of transparency - this fun little jaunt cost LaunchDarkly $74.90 (partly on me due to using big Opus)
Comparison overview of the branches by claude