Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

monsagri
Copy link
Contributor

@monsagri monsagri commented Jul 3, 2025

Add LaunchDarkly Views Resource Support

Adds

  • View Resource
  • View Linkage Resource
  • Data sources for above
  • Tests
  • Examples

Related Jira issue: REL-8140: Add View features to TF Provider

devin-ai-integration bot and others added 18 commits July 2, 2025 12:04
Co-Authored-By: ffeldberg@launchdarkly.com <ffeldberg@launchdarkly.com>
Co-Authored-By: ffeldberg@launchdarkly.com <ffeldberg@launchdarkly.com>
Co-Authored-By: ffeldberg@launchdarkly.com <ffeldberg@launchdarkly.com>
Co-Authored-By: ffeldberg@launchdarkly.com <ffeldberg@launchdarkly.com>
Co-Authored-By: ffeldberg@launchdarkly.com <ffeldberg@launchdarkly.com>
Co-Authored-By: ffeldberg@launchdarkly.com <ffeldberg@launchdarkly.com>
Co-Authored-By: ffeldberg@launchdarkly.com <ffeldberg@launchdarkly.com>
- Use endpoint construction pattern from access token implementation
- Check if endpoint starts with 'http' and prepend 'https://' if not
- This should resolve malformed URLs like 'https:///api/v2/projects/...'
- Applied to all four HTTP functions: getViewRaw, createView, patchView, deleteView

Co-Authored-By: ffeldberg@launchdarkly.com <ffeldberg@launchdarkly.com>
- Replace malformed URL construction that created 'https:///api/v2/...'
- Add fallback to 'app.launchdarkly.com' when client.apiHost is empty
- Apply fix to all four HTTP functions: getViewRaw, createView, patchView, deleteView
- Remove unused 'strings' import
- This should resolve TestAccDataSourceView_exists and TestAccDataSourceView_noMatchReturnsError failures

Co-Authored-By: ffeldberg@launchdarkly.com <ffeldberg@launchdarkly.com>
- Update Views tests to use newBetaClient pattern like metrics
- Modify Views helper functions to use beta client for API calls
- Update resource and data source to create and use beta client
- Add LD-API-Version: beta header to all Views API requests
- This should resolve HTTP 403 errors in TestAccDataSourceView tests

Co-Authored-By: ffeldberg@launchdarkly.com <ffeldberg@launchdarkly.com>
- Replace client.fallbackClient.Do() with client.ld.GetConfig().HTTPClient.Do()
- This ensures proper authentication and headers are applied to Views API requests
- Should resolve TestAccDataSourceView_exists HTTP 403 errors

Co-Authored-By: ffeldberg@launchdarkly.com <ffeldberg@launchdarkly.com>
- Change error format from 'HTTP 404' to '404 Not Found'
- Ensures TestAccDataSourceView_noMatchReturnsError passes
- Maintains consistency with other data source error patterns

Co-Authored-By: ffeldberg@launchdarkly.com <ffeldberg@launchdarkly.com>
@launchdarkly-upra launchdarkly-upra bot changed the title Ffeldberg/rel 8140/add view features to tf provider [REL-8140] Ffeldberg/rel 8140/add view features to tf provider Jul 3, 2025
@monsagri monsagri changed the title [REL-8140] Ffeldberg/rel 8140/add view features to tf provider feat: add LaunchDarkly Views resource and data source Jul 3, 2025
@launchdarkly-upra launchdarkly-upra bot changed the title feat: add LaunchDarkly Views resource and data source feat: [REL-8140] add LaunchDarkly Views resource and data source Jul 3, 2025
@monsagri monsagri requested a review from sloloris July 9, 2025 11:08
@monsagri
Copy link
Contributor Author

monsagri commented Jul 9, 2025

@sloloris I've just re-requested review, I think I've addressed all of your feedback and added more tests (good shout!)

I left one comment unresolved, the deletion of flag links is working as expected right now, is there something that I'm missing?

launchdarkly/resource_launchdarkly_view.go Show resolved Hide resolved
resource.TestCheckResourceAttr(resourceName, ARCHIVED, "false"),
resource.TestCheckResourceAttr(resourceName, "tags.#", "1"),
),
},
Copy link
Member

Choose a reason for hiding this comment

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

sorryyyy can we add the import verify step on these

Copy link
Member

Choose a reason for hiding this comment

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

i think that the maintainer thing may cause strange plan outputs. but i think probably easy to remedy by adding maintainer to the config - we expect ot see strange plan outputs if none is defined

.github/workflows/test.yml Outdated Show resolved Hide resolved
@monsagri monsagri merged commit e2a5e68 into preview Jul 9, 2025
26 checks passed
@monsagri monsagri deleted the ffeldberg/REL-8140/add-view-features-to-tf-provider branch July 9, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.