Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepare 2.2.0 release #75

Merged
merged 23 commits into from
Dec 23, 2021
Merged

prepare 2.2.0 release #75

merged 23 commits into from
Dec 23, 2021

Conversation

monsagri
Copy link
Contributor

[2.2.0] (December 23, 2021)

ENHANCEMENTS:

  • Upgraded the LaunchDarkly API client to version 7.
  • Flag resource creation respects project level SDK availability defaults.

FEATURES:

  • Added client_side_availability block to the launchdarkly_feature_flag resource to allow setting whether this flag should be made available to the client-side JavaScript SDK using the client-side ID, mobile key, or both.

NOTES:

  • The launchdarkly_feature_flag resource's argument include_in_snippet has been deprecated in favor of client_side_availability. Please update your config to use client_side_availability in order to maintain compatibility with future versions.

sloloris and others added 23 commits August 2, 2021 17:41
fix error in changelog
…s to targets (#131)

* add fallthrough and deprecate message to flag_fallthrough

* update doc

* conflicts with

* handle

* update a test

* update changelog

* fix typos in docs

* add targets attribute

* fix linter complaint

* handle in create

* update

* handle read

* update commetn

* update tests

* hack remove user_targets from plan

* set both computed attributes in read

* update changelog

* always set

* simplify helper

* fix data source test

* add test for deprecated field updates

* fix fromResourceData functions

* check renamed on as well

* Update data source d oc

* update data source tests
* should fix it

* add test case

* update changelog and doc
Release v1.7.1
BUG FIXES:

Fixes a bug where attempts to create resource_launchdarkly_feature_flag variations with an empty string value were throwing a panic.
NOTES:

The launchdarkly_feature_flag_environment resource and data source's flag_fallthrough argument has been deprecated in favor of fallthrough. Please update your config to use fallthrough in order to maintain compatibility with future versions.

The launchdarkly_feature_flag_environment resource and data source's user_targets argument has been deprecated in favor of targets. Please update your config to use targets in order to maintain compatibility with future versions.

Co-authored-by: Isabelle Miller <[email protected]>
Somehow the changelog test was duplicated. Removing, and we can fix the changelog on our next release.
* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch115579/fix include in snippet bug (#129)

* all it needed was a default val

* add test to ensure optional attributes get set correctly when removed

* fix test

* use TestCheckNoResourceAttr instead of TestCheckResourceAttr

* update changelog

* Imiller/ch113419/upgrade terraform client to v2 (#114)

* run v2 helper

* replace hashcode.String() with schema.HashString()

* replace terraform.ResourceProvider with *schema.Provider

* fix data source TypeMaps

* bump v2 sdk to latest (#116)

* merge

* Remove versions.tf (#119)

* Imiller/ch114162/upgrade resource launchdarkly environment (#121)

* make project_key required

* update descriptions

* update changelog

* Imiller/ch114165/v1 project audit (#120)

* add descriptions

* update doc dscription

* audit team member for v1 (#122)

* update descriptions

* add import instructions to team member docs

* add team member examples

* ForceNew when email is updated

* update test file structure to better reflect provider pattern

* add AtLeastOneOf for role and custom_roles

* oops wrong doc

* use validation.StringInSlice()

* refactor key conversion functions into helper file

* remove owner

* forgot changelog

* Imiller/ch114163/v1 feature flag env (#112)

* add descriptions for everything

* fix dangling default values

* fix bug where creating a non-bool flag with no variations creates a bool flag

* add bug fixes to changelog

* built in an idiotic bug, fixed now

* see if this fixes all of the tests

* found typo:

* fix broken tests

* add descriptions

* update some descriptions for clarity

* make clauses RequiredWith on variations to preempt api error

* fix error in doc

* fix docs properly

* deprecated targeting_enabled in favor of on

* remove ReuqiredWith because it's causing a bug

* fix plan bug

* hopefully this will fix it

* ughhhhh it was that it needed to be computed

* forgot the doc oops

* forgot the changelog too meep

* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch114160/v1 custom role (#125)

* add descriptions

* reformat tests to match pattern

* check removal of optional attributes removes

* holy crap how did this not break earlier

* not sure how that one stuck around either

* somehow we were not actually setting the flag_id

* fix feature flag read

* fix csa on project read

* apparently errors are different too

* remove lingering merge conflict text from changelog

* fix noMatchReturnsError errors

* remove hash indices on type set

* remove hash function for custom role policy

* fix destination tests

* fix feature flag tests

* fix env tests

* fix project tests

* fix segment tests

* fix segment tests and remove unused testAccTagKey function

* revert computed

* define CSA inline

* update changelog

* remove MaxItems property from data sources

* fix forProject

Co-authored-by: Henry Barrow <[email protected]>

* Imiller/ch115576/revert feature flag env optional attributes (#130)

* remove deprecated attribute targeting_enabled (replaced by on)

* on should default to false when removed

* forgot to fix data source tests

* fix test to handle on reversion

* make rules not computed

* make user_targets not computed

* update comments

* finally got fallthrough working

* fix test

* clarify

* fix more tests

* remove deprecated user_targets and flag_fallthrough from schema

* update read

* revert helpers

* update create

* update tests

* update example

* update doc

* remove deprecated fields from keys

* update changelog

* fix fallthrough and fix test

* update changelog

* missed a bit on the docs'

* make prerequisite not computed

* udate changelog again

* add test case for removing prereqs

* update flag_id description for clarity

* add defaults for optional fields

* update test again

* update changelog again

* handle off_variation defaults

* fix data source test

* have to use GetOkExists instead of GetOk to be able to set 0 off_variation on create

* remove commented-out code

* Imiller/ch115576/make fallthrough off variation required (#134)

* make required in schemas

* fix some test configs

* add required attributes to rest of tests. tests all failing

* always set both on read

* no need to check if fallthrough not set because tf will enforce

* update CRU functions

* fix data source tests

* update changelog and docs for new required attributes

* remove comment no longer applicable

* fix typo

* remove `enabled` on webhooks

* removed `policy_statements` on webhooks

* removed `targeting_enabled` on feature flag environment

* update change log

* Change schema function to use recommended one.

* Imiller/ch119139/make env configs required on project resource (#137)

* make required

* delete envs that were previously in state and have been removed

* remove redundant test & add required envs

* ImportSTateVerifyIgnore envs

* update docs

* move full_config example into v1_full_config

* add v2 full config

* update example

* update test project scaffolding function

* change State to StateContext function

* update comment

* fix destination test bug

* add test case for when we fix env defaults

* add note to import about envs

* update changelog

* remove debug bin

* add debug_bin to gitignore

* address pr comments by adding back stuff to docs

* update all example versions to 1.7

* Added logic to delete remote webhook statements when statements block… (#133)

* Added logic to delete remote webhook statements when statements block is removed

* refactored tests

* Added has changes check around the webhook policy statements

* Reverted changes in version file

* Removed check for deprecated policy_statements

* Removed deprecated fields and refactored helper functions using those deprecated fields

* Removed ConflictsWith for the webhook ON schema since ENABLED no longer exists in the schema

* Fixed test cases

* Updated changelog, refactored getWebhookOn and updated the docs

* Updated version in example and added default config for webhook ON element

* Imiller/ch119137/make segment clause negate field optional (#136)

* make oiptional and default to false + update test

* add example segment config for 2.0

* this should be v2.0.0

* Do not require fallthrough and off_variation in ff_env data source (#142)

* added version to versions.tf file for webhook

* v2 for custom_role and destination. Update read me

* Change targets schema to set and add 'variation' attribute (#141)

* Revise targets schema

* update docs

* Make target values required

* Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

* Change List to Set in description

* remove debug_bin

Co-authored-by: Isabelle Miller <[email protected]>

* Imiller/ch115572/restructure default flag variations (#146)

* add new defaults to schema

* update tests to expected configs / outcomes

* add default on

* restructure defaultVariationsFromResourceData

* update test cases

* hitting a non-empty plan error in test

* ffs just needed to be Computed

* update tests

* update docs and changelog

* fix test

* lost a brace

* fix variation helper

* fix changelog

* small doc fixes (#147)

* remove enabled from destination docs

* update webhook doc

* update doc on name issue (#151)

* environment and data_source_webhook examples (#149)

* added more examples

* added comments

* Imiller/ch120560/feature flag maintainer id should be removed (#150)

* make computed and update tes

* update doc

* update changelog

* Imiller/ch119620/audit examples (#152)

* make separate v1 and v2 feature flag examples

* ensure v2 ff example works

* move some stuff around

* some more reorg

* more reorg

* update toc in readme

* update v2 feature flag readme

* Bug Fix: Revert optional env attributes to defaults (#148)

* Fixed and tests passing

* improve env update test

* default_ttl default, and create new test

* default_ttl should reset to 0

* update docs and changelog

Co-authored-by: Isabelle Miller <[email protected]>

* remove test examples shouldn't have been checked in

* add terraform version note to changelog

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>
* start importing all environments

* Preserve environment order

* Update changelog

* Add ignore_changes to withRandomProject
* add archived to ff env schema

* make it a global property

* put it in the wrong schema doh

* attempt archive before deleting so we can return an error if there are dependencies

* prelim test

* some syntax issues

* gotta figure out error bit

* remove failing test

* forgot to set archived in read function

* actually no need to archive first
* Update index of docs with recommended version

* Show how to configure the access token
* prelim schema

* tweak approval schema

* draft conversion functions

* i forgot you can't use conflictswith with nested attributes

* a mess of things

* fixed up patches

* handle patch remove

* okay i think this should handle all cases

* unused transformation function since no setting

* forgot to handle most obvious case

* need to set but only sometimes

* min num approvals cannot exceed 5

* make min num approvals required

* project test

* fix helper function for project - first pass

* make entire approvals schema computed

* projet tests working

* NOW project tests working

* remove dead code

* update docs

* update changelog

* simplify approval helper function

* switch old and new afunc arguments
* update error message

* change default in schema

* update tests

* update docs'

* update changelog
* Start updating go client

* Continue updating resources

* feature flag resource

* feature flag resource test

* approval settings and custom role policies

* destination resource

* environment

* feature flag environment

* project

* segment

* team member

* webhook

* rule, segment rule, segments, and team member helpers

* variations helper

* data source tests

* webhooks helper

* resource tests

* variations helper test

* policy helpers and tests probably will all fail

* custom role and access token probably also broken

* policy statements helper update

* instantiate config prior to setting other values on it

* fix 401

* vendor v7

* update all imports to v7

* missed one

* fix nil pointer dereference

* instantiate with var instead of make to fix non-empty slice bu

* custom roles now complains if you try to set more than one of Role, InlineRole, or CustomRoleIds

* fix webhook statemetns

* webhook read check if statements are nil & webhook create only set secret if defined

* update changelog

* fix webhook data source tests

* new pointers in client FeatureFlagConfig breaking ff env data source tests

* fix negative expiry thing (apparently the api no longer handles it so we have to)

* move reset into helper function

* hackily handle token reset requests until client bug is fixed

* fix variation transformation - can no longer point to empty string

* fix notResource and notActions

* fix policy helper tests

* fix the weird empty string value in variations issue

* strip protocol from host if provided

* go mod tidy && vendor

* update all go packages

* clean up commentsg

* clean up comment

* Ffeldberg/sc 130551/add the ability to adjust the sdks using (#161)

* chore: first attempts

* feat: updating flag resources works, reading/creating plan is a bit iffy

* chore: clean up comments a bit

* chore: add TODO as reminder

* chore: add more todos

* chore: use ConflictsWith to ensure users dont use both includeInSnippet and clientSideAvailablity

* chore: pr feedback - update deprecation message, always read both sdk client values

* feat: set both includeInSnippet and clientSideAvailability to computed properties

* wip: attempt to use computed and update/create logic blocks

* add comment

* use getOk instead of getOkExists for nested, rename vars

* wip: use getOk instead of getOkExists for nested, test modified read

* temp: temporary test changes for local debugging

* chore: add some comments

* feat: working apart from switching back to deprecated option in edge case

* chore: remove commented out code

* fix: fix issue with read

* test: reset tests

* fix: fix typo in read

* fix: account for datasources in featureflag read

* test: add tests for clientSideAvailability changes

* docs: update example docs

* docs: add include_in_snippet to website docs and add deprecation notice

* docs: update docs

* chore: update CHANGELOG

* fix: fix most issues caused by go client v7 merge

* fix: fix other merge issues

* chore: update CHANGELOG

* chore: apply codereview keys suggestions

Co-authored-by: Isabelle Miller <[email protected]>

* chore: Update launchdarkly/feature_flags_helper.go

keys

Co-authored-by: Isabelle Miller <[email protected]>

* chore: update keys.go to reflect clientsideavailablity keys

* chore: go fmt

* test: add tests for switching between CSA and IIS, clean up

* chore: go fmt

* test: remove pure create tests

* chore: add TODOs where required

* test: add new test case for reverting to default CSA

* feat: set clientSideAvailability according to project defaults for flags

* test: update tests accordingly and add comments

* chore: fmt

* refactor project default get into its own function

* test: account for default project CSA settings

* feat: basic working implementation of resetting to defaults using customizeDiff

* feat: attempted changes to customdiff to support CSA

* chore: clean up flag resource read

* chore: clean up comments and todos

* docs: update docs to mention project level defaults for flag sdk settings

* chore: remove prints to clean up test logs

* chore: go mod vendor

* chore: Update CHANGELOG.md

Co-authored-by: Isabelle Miller <[email protected]>

* chore: address pr feedback

* docs: update changelog

Co-authored-by: Isabelle Miller <[email protected]>

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Fabian <[email protected]>
@monsagri monsagri merged commit c68e914 into master Dec 23, 2021
ldhenry added a commit that referenced this pull request Jan 5, 2022
* Update CHANGELOG.md

fix error in changelog

* Imiller/ch117193/rename flag_fallthrough to fallthrough & user_targets to targets (#131)

* add fallthrough and deprecate message to flag_fallthrough

* update doc

* conflicts with

* handle

* update a test

* update changelog

* fix typos in docs

* add targets attribute

* fix linter complaint

* handle in create

* update

* handle read

* update commetn

* update tests

* hack remove user_targets from plan

* set both computed attributes in read

* update changelog

* always set

* simplify helper

* fix data source test

* add test for deprecated field updates

* fix fromResourceData functions

* check renamed on as well

* Update data source d oc

* update data source tests

* Imiller/ch117375/GitHub issue empty string variation (#135)

* should fix it

* add test case

* update changelog and doc

* Fix duplicate text in CHANGELOG.md

Somehow the changelog test was duplicated. Removing, and we can fix the changelog on our next release.

* V2 main (#128)

* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch115579/fix include in snippet bug (#129)

* all it needed was a default val

* add test to ensure optional attributes get set correctly when removed

* fix test

* use TestCheckNoResourceAttr instead of TestCheckResourceAttr

* update changelog

* Imiller/ch113419/upgrade terraform client to v2 (#114)

* run v2 helper

* replace hashcode.String() with schema.HashString()

* replace terraform.ResourceProvider with *schema.Provider

* fix data source TypeMaps

* bump v2 sdk to latest (#116)

* merge

* Remove versions.tf (#119)

* Imiller/ch114162/upgrade resource launchdarkly environment (#121)

* make project_key required

* update descriptions

* update changelog

* Imiller/ch114165/v1 project audit (#120)

* add descriptions

* update doc dscription

* audit team member for v1 (#122)

* update descriptions

* add import instructions to team member docs

* add team member examples

* ForceNew when email is updated

* update test file structure to better reflect provider pattern

* add AtLeastOneOf for role and custom_roles

* oops wrong doc

* use validation.StringInSlice()

* refactor key conversion functions into helper file

* remove owner

* forgot changelog

* Imiller/ch114163/v1 feature flag env (#112)

* add descriptions for everything

* fix dangling default values

* fix bug where creating a non-bool flag with no variations creates a bool flag

* add bug fixes to changelog

* built in an idiotic bug, fixed now

* see if this fixes all of the tests

* found typo:

* fix broken tests

* add descriptions

* update some descriptions for clarity

* make clauses RequiredWith on variations to preempt api error

* fix error in doc

* fix docs properly

* deprecated targeting_enabled in favor of on

* remove ReuqiredWith because it's causing a bug

* fix plan bug

* hopefully this will fix it

* ughhhhh it was that it needed to be computed

* forgot the doc oops

* forgot the changelog too meep

* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch114160/v1 custom role (#125)

* add descriptions

* reformat tests to match pattern

* check removal of optional attributes removes

* holy crap how did this not break earlier

* not sure how that one stuck around either

* somehow we were not actually setting the flag_id

* fix feature flag read

* fix csa on project read

* apparently errors are different too

* remove lingering merge conflict text from changelog

* fix noMatchReturnsError errors

* remove hash indices on type set

* remove hash function for custom role policy

* fix destination tests

* fix feature flag tests

* fix env tests

* fix project tests

* fix segment tests

* fix segment tests and remove unused testAccTagKey function

* revert computed

* define CSA inline

* update changelog

* remove MaxItems property from data sources

* fix forProject

Co-authored-by: Henry Barrow <[email protected]>

* Imiller/ch115576/revert feature flag env optional attributes (#130)

* remove deprecated attribute targeting_enabled (replaced by on)

* on should default to false when removed

* forgot to fix data source tests

* fix test to handle on reversion

* make rules not computed

* make user_targets not computed

* update comments

* finally got fallthrough working

* fix test

* clarify

* fix more tests

* remove deprecated user_targets and flag_fallthrough from schema

* update read

* revert helpers

* update create

* update tests

* update example

* update doc

* remove deprecated fields from keys

* update changelog

* fix fallthrough and fix test

* update changelog

* missed a bit on the docs'

* make prerequisite not computed

* udate changelog again

* add test case for removing prereqs

* update flag_id description for clarity

* add defaults for optional fields

* update test again

* update changelog again

* handle off_variation defaults

* fix data source test

* have to use GetOkExists instead of GetOk to be able to set 0 off_variation on create

* remove commented-out code

* Imiller/ch115576/make fallthrough off variation required (#134)

* make required in schemas

* fix some test configs

* add required attributes to rest of tests. tests all failing

* always set both on read

* no need to check if fallthrough not set because tf will enforce

* update CRU functions

* fix data source tests

* update changelog and docs for new required attributes

* remove comment no longer applicable

* fix typo

* remove `enabled` on webhooks

* removed `policy_statements` on webhooks

* removed `targeting_enabled` on feature flag environment

* update change log

* Change schema function to use recommended one.

* Imiller/ch119139/make env configs required on project resource (#137)

* make required

* delete envs that were previously in state and have been removed

* remove redundant test & add required envs

* ImportSTateVerifyIgnore envs

* update docs

* move full_config example into v1_full_config

* add v2 full config

* update example

* update test project scaffolding function

* change State to StateContext function

* update comment

* fix destination test bug

* add test case for when we fix env defaults

* add note to import about envs

* update changelog

* remove debug bin

* add debug_bin to gitignore

* address pr comments by adding back stuff to docs

* update all example versions to 1.7

* Added logic to delete remote webhook statements when statements block… (#133)

* Added logic to delete remote webhook statements when statements block is removed

* refactored tests

* Added has changes check around the webhook policy statements

* Reverted changes in version file

* Removed check for deprecated policy_statements

* Removed deprecated fields and refactored helper functions using those deprecated fields

* Removed ConflictsWith for the webhook ON schema since ENABLED no longer exists in the schema

* Fixed test cases

* Updated changelog, refactored getWebhookOn and updated the docs

* Updated version in example and added default config for webhook ON element

* Imiller/ch119137/make segment clause negate field optional (#136)

* make oiptional and default to false + update test

* add example segment config for 2.0

* this should be v2.0.0

* Do not require fallthrough and off_variation in ff_env data source (#142)

* added version to versions.tf file for webhook

* v2 for custom_role and destination. Update read me

* Change targets schema to set and add 'variation' attribute (#141)

* Revise targets schema

* update docs

* Make target values required

* Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

* Change List to Set in description

* remove debug_bin

Co-authored-by: Isabelle Miller <[email protected]>

* Imiller/ch115572/restructure default flag variations (#146)

* add new defaults to schema

* update tests to expected configs / outcomes

* add default on

* restructure defaultVariationsFromResourceData

* update test cases

* hitting a non-empty plan error in test

* ffs just needed to be Computed

* update tests

* update docs and changelog

* fix test

* lost a brace

* fix variation helper

* fix changelog

* small doc fixes (#147)

* remove enabled from destination docs

* update webhook doc

* update doc on name issue (#151)

* environment and data_source_webhook examples (#149)

* added more examples

* added comments

* Imiller/ch120560/feature flag maintainer id should be removed (#150)

* make computed and update tes

* update doc

* update changelog

* Imiller/ch119620/audit examples (#152)

* make separate v1 and v2 feature flag examples

* ensure v2 ff example works

* move some stuff around

* some more reorg

* more reorg

* update toc in readme

* update v2 feature flag readme

* Bug Fix: Revert optional env attributes to defaults (#148)

* Fixed and tests passing

* improve env update test

* default_ttl default, and create new test

* default_ttl should reset to 0

* update docs and changelog

Co-authored-by: Isabelle Miller <[email protected]>

* remove test examples shouldn't have been checked in

* add terraform version note to changelog

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>

* Fix import of launchdarkly_project nested environments (#153)

* start importing all environments

* Preserve environment order

* Update changelog

* Add ignore_changes to withRandomProject

* update doc (#154)

* Imiller/sc 119920/add boolean archive attribute to launchdarkly (#155)

* add archived to ff env schema

* make it a global property

* put it in the wrong schema doh

* attempt archive before deleting so we can return an error if there are dependencies

* prelim test

* some syntax issues

* gotta figure out error bit

* remove failing test

* forgot to set archived in read function

* actually no need to archive first

* Update index of docs with recommended version (#156)

* Update index of docs with recommended version

* Show how to configure the access token

* Imiller/sc 123568/add approval settings to environment resource (#157)

* prelim schema

* tweak approval schema

* draft conversion functions

* i forgot you can't use conflictswith with nested attributes

* a mess of things

* fixed up patches

* handle patch remove

* okay i think this should handle all cases

* unused transformation function since no setting

* forgot to handle most obvious case

* need to set but only sometimes

* min num approvals cannot exceed 5

* make min num approvals required

* project test

* fix helper function for project - first pass

* make entire approvals schema computed

* projet tests working

* NOW project tests working

* remove dead code

* update docs

* update changelog

* simplify approval helper function

* switch old and new afunc arguments

* Imiller/sc 126337/make can apply declined changes default to (#158)

* update error message

* change default in schema

* update tests

* update docs'

* update changelog

* clarify rollout weights (#159)

* Upgrade Terraform provider to use api-client-go 7 (#160)

* Start updating go client

* Continue updating resources

* feature flag resource

* feature flag resource test

* approval settings and custom role policies

* destination resource

* environment

* feature flag environment

* project

* segment

* team member

* webhook

* rule, segment rule, segments, and team member helpers

* variations helper

* data source tests

* webhooks helper

* resource tests

* variations helper test

* policy helpers and tests probably will all fail

* custom role and access token probably also broken

* policy statements helper update

* instantiate config prior to setting other values on it

* fix 401

* vendor v7

* update all imports to v7

* missed one

* fix nil pointer dereference

* instantiate with var instead of make to fix non-empty slice bu

* custom roles now complains if you try to set more than one of Role, InlineRole, or CustomRoleIds

* fix webhook statemetns

* webhook read check if statements are nil & webhook create only set secret if defined

* update changelog

* fix webhook data source tests

* new pointers in client FeatureFlagConfig breaking ff env data source tests

* fix negative expiry thing (apparently the api no longer handles it so we have to)

* move reset into helper function

* hackily handle token reset requests until client bug is fixed

* fix variation transformation - can no longer point to empty string

* fix notResource and notActions

* fix policy helper tests

* fix the weird empty string value in variations issue

* strip protocol from host if provided

* go mod tidy && vendor

* update all go packages

* clean up commentsg

* clean up comment

* Ffeldberg/sc 130551/add the ability to adjust the sdks using (#161)

* chore: first attempts

* feat: updating flag resources works, reading/creating plan is a bit iffy

* chore: clean up comments a bit

* chore: add TODO as reminder

* chore: add more todos

* chore: use ConflictsWith to ensure users dont use both includeInSnippet and clientSideAvailablity

* chore: pr feedback - update deprecation message, always read both sdk client values

* feat: set both includeInSnippet and clientSideAvailability to computed properties

* wip: attempt to use computed and update/create logic blocks

* add comment

* use getOk instead of getOkExists for nested, rename vars

* wip: use getOk instead of getOkExists for nested, test modified read

* temp: temporary test changes for local debugging

* chore: add some comments

* feat: working apart from switching back to deprecated option in edge case

* chore: remove commented out code

* fix: fix issue with read

* test: reset tests

* fix: fix typo in read

* fix: account for datasources in featureflag read

* test: add tests for clientSideAvailability changes

* docs: update example docs

* docs: add include_in_snippet to website docs and add deprecation notice

* docs: update docs

* chore: update CHANGELOG

* fix: fix most issues caused by go client v7 merge

* fix: fix other merge issues

* chore: update CHANGELOG

* chore: apply codereview keys suggestions

Co-authored-by: Isabelle Miller <[email protected]>

* chore: Update launchdarkly/feature_flags_helper.go

keys

Co-authored-by: Isabelle Miller <[email protected]>

* chore: update keys.go to reflect clientsideavailablity keys

* chore: go fmt

* test: add tests for switching between CSA and IIS, clean up

* chore: go fmt

* test: remove pure create tests

* chore: add TODOs where required

* test: add new test case for reverting to default CSA

* feat: set clientSideAvailability according to project defaults for flags

* test: update tests accordingly and add comments

* chore: fmt

* refactor project default get into its own function

* test: account for default project CSA settings

* feat: basic working implementation of resetting to defaults using customizeDiff

* feat: attempted changes to customdiff to support CSA

* chore: clean up flag resource read

* chore: clean up comments and todos

* docs: update docs to mention project level defaults for flag sdk settings

* chore: remove prints to clean up test logs

* chore: go mod vendor

* chore: Update CHANGELOG.md

Co-authored-by: Isabelle Miller <[email protected]>

* chore: address pr feedback

* docs: update changelog

Co-authored-by: Isabelle Miller <[email protected]>

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Fabian <[email protected]>

* 2.2.0

Co-authored-by: Isabelle Miller <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>

Co-authored-by: Isabelle Miller <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>
sloloris added a commit that referenced this pull request Jan 19, 2022
* Update CHANGELOG.md

fix error in changelog

* Imiller/ch117193/rename flag_fallthrough to fallthrough & user_targets to targets (#131)

* add fallthrough and deprecate message to flag_fallthrough

* update doc

* conflicts with

* handle

* update a test

* update changelog

* fix typos in docs

* add targets attribute

* fix linter complaint

* handle in create

* update

* handle read

* update commetn

* update tests

* hack remove user_targets from plan

* set both computed attributes in read

* update changelog

* always set

* simplify helper

* fix data source test

* add test for deprecated field updates

* fix fromResourceData functions

* check renamed on as well

* Update data source d oc

* update data source tests

* Imiller/ch117375/GitHub issue empty string variation (#135)

* should fix it

* add test case

* update changelog and doc

* Fix duplicate text in CHANGELOG.md

Somehow the changelog test was duplicated. Removing, and we can fix the changelog on our next release.

* V2 main (#128)

* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch115579/fix include in snippet bug (#129)

* all it needed was a default val

* add test to ensure optional attributes get set correctly when removed

* fix test

* use TestCheckNoResourceAttr instead of TestCheckResourceAttr

* update changelog

* Imiller/ch113419/upgrade terraform client to v2 (#114)

* run v2 helper

* replace hashcode.String() with schema.HashString()

* replace terraform.ResourceProvider with *schema.Provider

* fix data source TypeMaps

* bump v2 sdk to latest (#116)

* merge

* Remove versions.tf (#119)

* Imiller/ch114162/upgrade resource launchdarkly environment (#121)

* make project_key required

* update descriptions

* update changelog

* Imiller/ch114165/v1 project audit (#120)

* add descriptions

* update doc dscription

* audit team member for v1 (#122)

* update descriptions

* add import instructions to team member docs

* add team member examples

* ForceNew when email is updated

* update test file structure to better reflect provider pattern

* add AtLeastOneOf for role and custom_roles

* oops wrong doc

* use validation.StringInSlice()

* refactor key conversion functions into helper file

* remove owner

* forgot changelog

* Imiller/ch114163/v1 feature flag env (#112)

* add descriptions for everything

* fix dangling default values

* fix bug where creating a non-bool flag with no variations creates a bool flag

* add bug fixes to changelog

* built in an idiotic bug, fixed now

* see if this fixes all of the tests

* found typo:

* fix broken tests

* add descriptions

* update some descriptions for clarity

* make clauses RequiredWith on variations to preempt api error

* fix error in doc

* fix docs properly

* deprecated targeting_enabled in favor of on

* remove ReuqiredWith because it's causing a bug

* fix plan bug

* hopefully this will fix it

* ughhhhh it was that it needed to be computed

* forgot the doc oops

* forgot the changelog too meep

* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch114160/v1 custom role (#125)

* add descriptions

* reformat tests to match pattern

* check removal of optional attributes removes

* holy crap how did this not break earlier

* not sure how that one stuck around either

* somehow we were not actually setting the flag_id

* fix feature flag read

* fix csa on project read

* apparently errors are different too

* remove lingering merge conflict text from changelog

* fix noMatchReturnsError errors

* remove hash indices on type set

* remove hash function for custom role policy

* fix destination tests

* fix feature flag tests

* fix env tests

* fix project tests

* fix segment tests

* fix segment tests and remove unused testAccTagKey function

* revert computed

* define CSA inline

* update changelog

* remove MaxItems property from data sources

* fix forProject

Co-authored-by: Henry Barrow <[email protected]>

* Imiller/ch115576/revert feature flag env optional attributes (#130)

* remove deprecated attribute targeting_enabled (replaced by on)

* on should default to false when removed

* forgot to fix data source tests

* fix test to handle on reversion

* make rules not computed

* make user_targets not computed

* update comments

* finally got fallthrough working

* fix test

* clarify

* fix more tests

* remove deprecated user_targets and flag_fallthrough from schema

* update read

* revert helpers

* update create

* update tests

* update example

* update doc

* remove deprecated fields from keys

* update changelog

* fix fallthrough and fix test

* update changelog

* missed a bit on the docs'

* make prerequisite not computed

* udate changelog again

* add test case for removing prereqs

* update flag_id description for clarity

* add defaults for optional fields

* update test again

* update changelog again

* handle off_variation defaults

* fix data source test

* have to use GetOkExists instead of GetOk to be able to set 0 off_variation on create

* remove commented-out code

* Imiller/ch115576/make fallthrough off variation required (#134)

* make required in schemas

* fix some test configs

* add required attributes to rest of tests. tests all failing

* always set both on read

* no need to check if fallthrough not set because tf will enforce

* update CRU functions

* fix data source tests

* update changelog and docs for new required attributes

* remove comment no longer applicable

* fix typo

* remove `enabled` on webhooks

* removed `policy_statements` on webhooks

* removed `targeting_enabled` on feature flag environment

* update change log

* Change schema function to use recommended one.

* Imiller/ch119139/make env configs required on project resource (#137)

* make required

* delete envs that were previously in state and have been removed

* remove redundant test & add required envs

* ImportSTateVerifyIgnore envs

* update docs

* move full_config example into v1_full_config

* add v2 full config

* update example

* update test project scaffolding function

* change State to StateContext function

* update comment

* fix destination test bug

* add test case for when we fix env defaults

* add note to import about envs

* update changelog

* remove debug bin

* add debug_bin to gitignore

* address pr comments by adding back stuff to docs

* update all example versions to 1.7

* Added logic to delete remote webhook statements when statements block… (#133)

* Added logic to delete remote webhook statements when statements block is removed

* refactored tests

* Added has changes check around the webhook policy statements

* Reverted changes in version file

* Removed check for deprecated policy_statements

* Removed deprecated fields and refactored helper functions using those deprecated fields

* Removed ConflictsWith for the webhook ON schema since ENABLED no longer exists in the schema

* Fixed test cases

* Updated changelog, refactored getWebhookOn and updated the docs

* Updated version in example and added default config for webhook ON element

* Imiller/ch119137/make segment clause negate field optional (#136)

* make oiptional and default to false + update test

* add example segment config for 2.0

* this should be v2.0.0

* Do not require fallthrough and off_variation in ff_env data source (#142)

* added version to versions.tf file for webhook

* v2 for custom_role and destination. Update read me

* Change targets schema to set and add 'variation' attribute (#141)

* Revise targets schema

* update docs

* Make target values required

* Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

* Change List to Set in description

* remove debug_bin

Co-authored-by: Isabelle Miller <[email protected]>

* Imiller/ch115572/restructure default flag variations (#146)

* add new defaults to schema

* update tests to expected configs / outcomes

* add default on

* restructure defaultVariationsFromResourceData

* update test cases

* hitting a non-empty plan error in test

* ffs just needed to be Computed

* update tests

* update docs and changelog

* fix test

* lost a brace

* fix variation helper

* fix changelog

* small doc fixes (#147)

* remove enabled from destination docs

* update webhook doc

* update doc on name issue (#151)

* environment and data_source_webhook examples (#149)

* added more examples

* added comments

* Imiller/ch120560/feature flag maintainer id should be removed (#150)

* make computed and update tes

* update doc

* update changelog

* Imiller/ch119620/audit examples (#152)

* make separate v1 and v2 feature flag examples

* ensure v2 ff example works

* move some stuff around

* some more reorg

* more reorg

* update toc in readme

* update v2 feature flag readme

* Bug Fix: Revert optional env attributes to defaults (#148)

* Fixed and tests passing

* improve env update test

* default_ttl default, and create new test

* default_ttl should reset to 0

* update docs and changelog

Co-authored-by: Isabelle Miller <[email protected]>

* remove test examples shouldn't have been checked in

* add terraform version note to changelog

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>

* Fix import of launchdarkly_project nested environments (#153)

* start importing all environments

* Preserve environment order

* Update changelog

* Add ignore_changes to withRandomProject

* update doc (#154)

* Imiller/sc 119920/add boolean archive attribute to launchdarkly (#155)

* add archived to ff env schema

* make it a global property

* put it in the wrong schema doh

* attempt archive before deleting so we can return an error if there are dependencies

* prelim test

* some syntax issues

* gotta figure out error bit

* remove failing test

* forgot to set archived in read function

* actually no need to archive first

* Update index of docs with recommended version (#156)

* Update index of docs with recommended version

* Show how to configure the access token

* Imiller/sc 123568/add approval settings to environment resource (#157)

* prelim schema

* tweak approval schema

* draft conversion functions

* i forgot you can't use conflictswith with nested attributes

* a mess of things

* fixed up patches

* handle patch remove

* okay i think this should handle all cases

* unused transformation function since no setting

* forgot to handle most obvious case

* need to set but only sometimes

* min num approvals cannot exceed 5

* make min num approvals required

* project test

* fix helper function for project - first pass

* make entire approvals schema computed

* projet tests working

* NOW project tests working

* remove dead code

* update docs

* update changelog

* simplify approval helper function

* switch old and new afunc arguments

* Imiller/sc 126337/make can apply declined changes default to (#158)

* update error message

* change default in schema

* update tests

* update docs'

* update changelog

* clarify rollout weights (#159)

* Upgrade Terraform provider to use api-client-go 7 (#160)

* Start updating go client

* Continue updating resources

* feature flag resource

* feature flag resource test

* approval settings and custom role policies

* destination resource

* environment

* feature flag environment

* project

* segment

* team member

* webhook

* rule, segment rule, segments, and team member helpers

* variations helper

* data source tests

* webhooks helper

* resource tests

* variations helper test

* policy helpers and tests probably will all fail

* custom role and access token probably also broken

* policy statements helper update

* instantiate config prior to setting other values on it

* fix 401

* vendor v7

* update all imports to v7

* missed one

* fix nil pointer dereference

* instantiate with var instead of make to fix non-empty slice bu

* custom roles now complains if you try to set more than one of Role, InlineRole, or CustomRoleIds

* fix webhook statemetns

* webhook read check if statements are nil & webhook create only set secret if defined

* update changelog

* fix webhook data source tests

* new pointers in client FeatureFlagConfig breaking ff env data source tests

* fix negative expiry thing (apparently the api no longer handles it so we have to)

* move reset into helper function

* hackily handle token reset requests until client bug is fixed

* fix variation transformation - can no longer point to empty string

* fix notResource and notActions

* fix policy helper tests

* fix the weird empty string value in variations issue

* strip protocol from host if provided

* go mod tidy && vendor

* update all go packages

* clean up commentsg

* clean up comment

* Ffeldberg/sc 130551/add the ability to adjust the sdks using (#161)

* chore: first attempts

* feat: updating flag resources works, reading/creating plan is a bit iffy

* chore: clean up comments a bit

* chore: add TODO as reminder

* chore: add more todos

* chore: use ConflictsWith to ensure users dont use both includeInSnippet and clientSideAvailablity

* chore: pr feedback - update deprecation message, always read both sdk client values

* feat: set both includeInSnippet and clientSideAvailability to computed properties

* wip: attempt to use computed and update/create logic blocks

* add comment

* use getOk instead of getOkExists for nested, rename vars

* wip: use getOk instead of getOkExists for nested, test modified read

* temp: temporary test changes for local debugging

* chore: add some comments

* feat: working apart from switching back to deprecated option in edge case

* chore: remove commented out code

* fix: fix issue with read

* test: reset tests

* fix: fix typo in read

* fix: account for datasources in featureflag read

* test: add tests for clientSideAvailability changes

* docs: update example docs

* docs: add include_in_snippet to website docs and add deprecation notice

* docs: update docs

* chore: update CHANGELOG

* fix: fix most issues caused by go client v7 merge

* fix: fix other merge issues

* chore: update CHANGELOG

* chore: apply codereview keys suggestions

Co-authored-by: Isabelle Miller <[email protected]>

* chore: Update launchdarkly/feature_flags_helper.go

keys

Co-authored-by: Isabelle Miller <[email protected]>

* chore: update keys.go to reflect clientsideavailablity keys

* chore: go fmt

* test: add tests for switching between CSA and IIS, clean up

* chore: go fmt

* test: remove pure create tests

* chore: add TODOs where required

* test: add new test case for reverting to default CSA

* feat: set clientSideAvailability according to project defaults for flags

* test: update tests accordingly and add comments

* chore: fmt

* refactor project default get into its own function

* test: account for default project CSA settings

* feat: basic working implementation of resetting to defaults using customizeDiff

* feat: attempted changes to customdiff to support CSA

* chore: clean up flag resource read

* chore: clean up comments and todos

* docs: update docs to mention project level defaults for flag sdk settings

* chore: remove prints to clean up test logs

* chore: go mod vendor

* chore: Update CHANGELOG.md

Co-authored-by: Isabelle Miller <[email protected]>

* chore: address pr feedback

* docs: update changelog

Co-authored-by: Isabelle Miller <[email protected]>

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Fabian <[email protected]>

* prepare 2.2.0 release (#75) (#162)

* Update CHANGELOG.md

fix error in changelog

* Imiller/ch117193/rename flag_fallthrough to fallthrough & user_targets to targets (#131)

* add fallthrough and deprecate message to flag_fallthrough

* update doc

* conflicts with

* handle

* update a test

* update changelog

* fix typos in docs

* add targets attribute

* fix linter complaint

* handle in create

* update

* handle read

* update commetn

* update tests

* hack remove user_targets from plan

* set both computed attributes in read

* update changelog

* always set

* simplify helper

* fix data source test

* add test for deprecated field updates

* fix fromResourceData functions

* check renamed on as well

* Update data source d oc

* update data source tests

* Imiller/ch117375/GitHub issue empty string variation (#135)

* should fix it

* add test case

* update changelog and doc

* Fix duplicate text in CHANGELOG.md

Somehow the changelog test was duplicated. Removing, and we can fix the changelog on our next release.

* V2 main (#128)

* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch115579/fix include in snippet bug (#129)

* all it needed was a default val

* add test to ensure optional attributes get set correctly when removed

* fix test

* use TestCheckNoResourceAttr instead of TestCheckResourceAttr

* update changelog

* Imiller/ch113419/upgrade terraform client to v2 (#114)

* run v2 helper

* replace hashcode.String() with schema.HashString()

* replace terraform.ResourceProvider with *schema.Provider

* fix data source TypeMaps

* bump v2 sdk to latest (#116)

* merge

* Remove versions.tf (#119)

* Imiller/ch114162/upgrade resource launchdarkly environment (#121)

* make project_key required

* update descriptions

* update changelog

* Imiller/ch114165/v1 project audit (#120)

* add descriptions

* update doc dscription

* audit team member for v1 (#122)

* update descriptions

* add import instructions to team member docs

* add team member examples

* ForceNew when email is updated

* update test file structure to better reflect provider pattern

* add AtLeastOneOf for role and custom_roles

* oops wrong doc

* use validation.StringInSlice()

* refactor key conversion functions into helper file

* remove owner

* forgot changelog

* Imiller/ch114163/v1 feature flag env (#112)

* add descriptions for everything

* fix dangling default values

* fix bug where creating a non-bool flag with no variations creates a bool flag

* add bug fixes to changelog

* built in an idiotic bug, fixed now

* see if this fixes all of the tests

* found typo:

* fix broken tests

* add descriptions

* update some descriptions for clarity

* make clauses RequiredWith on variations to preempt api error

* fix error in doc

* fix docs properly

* deprecated targeting_enabled in favor of on

* remove ReuqiredWith because it's causing a bug

* fix plan bug

* hopefully this will fix it

* ughhhhh it was that it needed to be computed

* forgot the doc oops

* forgot the changelog too meep

* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch114160/v1 custom role (#125)

* add descriptions

* reformat tests to match pattern

* check removal of optional attributes removes

* holy crap how did this not break earlier

* not sure how that one stuck around either

* somehow we were not actually setting the flag_id

* fix feature flag read

* fix csa on project read

* apparently errors are different too

* remove lingering merge conflict text from changelog

* fix noMatchReturnsError errors

* remove hash indices on type set

* remove hash function for custom role policy

* fix destination tests

* fix feature flag tests

* fix env tests

* fix project tests

* fix segment tests

* fix segment tests and remove unused testAccTagKey function

* revert computed

* define CSA inline

* update changelog

* remove MaxItems property from data sources

* fix forProject

Co-authored-by: Henry Barrow <[email protected]>

* Imiller/ch115576/revert feature flag env optional attributes (#130)

* remove deprecated attribute targeting_enabled (replaced by on)

* on should default to false when removed

* forgot to fix data source tests

* fix test to handle on reversion

* make rules not computed

* make user_targets not computed

* update comments

* finally got fallthrough working

* fix test

* clarify

* fix more tests

* remove deprecated user_targets and flag_fallthrough from schema

* update read

* revert helpers

* update create

* update tests

* update example

* update doc

* remove deprecated fields from keys

* update changelog

* fix fallthrough and fix test

* update changelog

* missed a bit on the docs'

* make prerequisite not computed

* udate changelog again

* add test case for removing prereqs

* update flag_id description for clarity

* add defaults for optional fields

* update test again

* update changelog again

* handle off_variation defaults

* fix data source test

* have to use GetOkExists instead of GetOk to be able to set 0 off_variation on create

* remove commented-out code

* Imiller/ch115576/make fallthrough off variation required (#134)

* make required in schemas

* fix some test configs

* add required attributes to rest of tests. tests all failing

* always set both on read

* no need to check if fallthrough not set because tf will enforce

* update CRU functions

* fix data source tests

* update changelog and docs for new required attributes

* remove comment no longer applicable

* fix typo

* remove `enabled` on webhooks

* removed `policy_statements` on webhooks

* removed `targeting_enabled` on feature flag environment

* update change log

* Change schema function to use recommended one.

* Imiller/ch119139/make env configs required on project resource (#137)

* make required

* delete envs that were previously in state and have been removed

* remove redundant test & add required envs

* ImportSTateVerifyIgnore envs

* update docs

* move full_config example into v1_full_config

* add v2 full config

* update example

* update test project scaffolding function

* change State to StateContext function

* update comment

* fix destination test bug

* add test case for when we fix env defaults

* add note to import about envs

* update changelog

* remove debug bin

* add debug_bin to gitignore

* address pr comments by adding back stuff to docs

* update all example versions to 1.7

* Added logic to delete remote webhook statements when statements block… (#133)

* Added logic to delete remote webhook statements when statements block is removed

* refactored tests

* Added has changes check around the webhook policy statements

* Reverted changes in version file

* Removed check for deprecated policy_statements

* Removed deprecated fields and refactored helper functions using those deprecated fields

* Removed ConflictsWith for the webhook ON schema since ENABLED no longer exists in the schema

* Fixed test cases

* Updated changelog, refactored getWebhookOn and updated the docs

* Updated version in example and added default config for webhook ON element

* Imiller/ch119137/make segment clause negate field optional (#136)

* make oiptional and default to false + update test

* add example segment config for 2.0

* this should be v2.0.0

* Do not require fallthrough and off_variation in ff_env data source (#142)

* added version to versions.tf file for webhook

* v2 for custom_role and destination. Update read me

* Change targets schema to set and add 'variation' attribute (#141)

* Revise targets schema

* update docs

* Make target values required

* Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

* Change List to Set in description

* remove debug_bin

Co-authored-by: Isabelle Miller <[email protected]>

* Imiller/ch115572/restructure default flag variations (#146)

* add new defaults to schema

* update tests to expected configs / outcomes

* add default on

* restructure defaultVariationsFromResourceData

* update test cases

* hitting a non-empty plan error in test

* ffs just needed to be Computed

* update tests

* update docs and changelog

* fix test

* lost a brace

* fix variation helper

* fix changelog

* small doc fixes (#147)

* remove enabled from destination docs

* update webhook doc

* update doc on name issue (#151)

* environment and data_source_webhook examples (#149)

* added more examples

* added comments

* Imiller/ch120560/feature flag maintainer id should be removed (#150)

* make computed and update tes

* update doc

* update changelog

* Imiller/ch119620/audit examples (#152)

* make separate v1 and v2 feature flag examples

* ensure v2 ff example works

* move some stuff around

* some more reorg

* more reorg

* update toc in readme

* update v2 feature flag readme

* Bug Fix: Revert optional env attributes to defaults (#148)

* Fixed and tests passing

* improve env update test

* default_ttl default, and create new test

* default_ttl should reset to 0

* update docs and changelog

Co-authored-by: Isabelle Miller <[email protected]>

* remove test examples shouldn't have been checked in

* add terraform version note to changelog

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>

* Fix import of launchdarkly_project nested environments (#153)

* start importing all environments

* Preserve environment order

* Update changelog

* Add ignore_changes to withRandomProject

* update doc (#154)

* Imiller/sc 119920/add boolean archive attribute to launchdarkly (#155)

* add archived to ff env schema

* make it a global property

* put it in the wrong schema doh

* attempt archive before deleting so we can return an error if there are dependencies

* prelim test

* some syntax issues

* gotta figure out error bit

* remove failing test

* forgot to set archived in read function

* actually no need to archive first

* Update index of docs with recommended version (#156)

* Update index of docs with recommended version

* Show how to configure the access token

* Imiller/sc 123568/add approval settings to environment resource (#157)

* prelim schema

* tweak approval schema

* draft conversion functions

* i forgot you can't use conflictswith with nested attributes

* a mess of things

* fixed up patches

* handle patch remove

* okay i think this should handle all cases

* unused transformation function since no setting

* forgot to handle most obvious case

* need to set but only sometimes

* min num approvals cannot exceed 5

* make min num approvals required

* project test

* fix helper function for project - first pass

* make entire approvals schema computed

* projet tests working

* NOW project tests working

* remove dead code

* update docs

* update changelog

* simplify approval helper function

* switch old and new afunc arguments

* Imiller/sc 126337/make can apply declined changes default to (#158)

* update error message

* change default in schema

* update tests

* update docs'

* update changelog

* clarify rollout weights (#159)

* Upgrade Terraform provider to use api-client-go 7 (#160)

* Start updating go client

* Continue updating resources

* feature flag resource

* feature flag resource test

* approval settings and custom role policies

* destination resource

* environment

* feature flag environment

* project

* segment

* team member

* webhook

* rule, segment rule, segments, and team member helpers

* variations helper

* data source tests

* webhooks helper

* resource tests

* variations helper test

* policy helpers and tests probably will all fail

* custom role and access token probably also broken

* policy statements helper update

* instantiate config prior to setting other values on it

* fix 401

* vendor v7

* update all imports to v7

* missed one

* fix nil pointer dereference

* instantiate with var instead of make to fix non-empty slice bu

* custom roles now complains if you try to set more than one of Role, InlineRole, or CustomRoleIds

* fix webhook statemetns

* webhook read check if statements are nil & webhook create only set secret if defined

* update changelog

* fix webhook data source tests

* new pointers in client FeatureFlagConfig breaking ff env data source tests

* fix negative expiry thing (apparently the api no longer handles it so we have to)

* move reset into helper function

* hackily handle token reset requests until client bug is fixed

* fix variation transformation - can no longer point to empty string

* fix notResource and notActions

* fix policy helper tests

* fix the weird empty string value in variations issue

* strip protocol from host if provided

* go mod tidy && vendor

* update all go packages

* clean up commentsg

* clean up comment

* Ffeldberg/sc 130551/add the ability to adjust the sdks using (#161)

* chore: first attempts

* feat: updating flag resources works, reading/creating plan is a bit iffy

* chore: clean up comments a bit

* chore: add TODO as reminder

* chore: add more todos

* chore: use ConflictsWith to ensure users dont use both includeInSnippet and clientSideAvailablity

* chore: pr feedback - update deprecation message, always read both sdk client values

* feat: set both includeInSnippet and clientSideAvailability to computed properties

* wip: attempt to use computed and update/create logic blocks

* add comment

* use getOk instead of getOkExists for nested, rename vars

* wip: use getOk instead of getOkExists for nested, test modified read

* temp: temporary test changes for local debugging

* chore: add some comments

* feat: working apart from switching back to deprecated option in edge case

* chore: remove commented out code

* fix: fix issue with read

* test: reset tests

* fix: fix typo in read

* fix: account for datasources in featureflag read

* test: add tests for clientSideAvailability changes

* docs: update example docs

* docs: add include_in_snippet to website docs and add deprecation notice

* docs: update docs

* chore: update CHANGELOG

* fix: fix most issues caused by go client v7 merge

* fix: fix other merge issues

* chore: update CHANGELOG

* chore: apply codereview keys suggestions

Co-authored-by: Isabelle Miller <[email protected]>

* chore: Update launchdarkly/feature_flags_helper.go

keys

Co-authored-by: Isabelle Miller <[email protected]>

* chore: update keys.go to reflect clientsideavailablity keys

* chore: go fmt

* test: add tests for switching between CSA and IIS, clean up

* chore: go fmt

* test: remove pure create tests

* chore: add TODOs where required

* test: add new test case for reverting to default CSA

* feat: set clientSideAvailability according to project defaults for flags

* test: update tests accordingly and add comments

* chore: fmt

* refactor project default get into its own function

* test: account for default project CSA settings

* feat: basic working implementation of resetting to defaults using customizeDiff

* feat: attempted changes to customdiff to support CSA

* chore: clean up flag resource read

* chore: clean up comments and todos

* docs: update docs to mention project level defaults for flag sdk settings

* chore: remove prints to clean up test logs

* chore: go mod vendor

* chore: Update CHANGELOG.md

Co-authored-by: Isabelle Miller <[email protected]>

* chore: address pr feedback

* docs: update changelog

Co-authored-by: Isabelle Miller <[email protected]>

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Fabian <[email protected]>

* 2.2.0

Co-authored-by: Isabelle Miller <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>

Co-authored-by: Isabelle Miller <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>

* [SC-135367] Project resource should support default flag SDK values (#166)

* chore: update project resource schema

* chore: add new keys to keys.go

* feat: most situations working for plan/apply

* feat: use customizeDiff to account for resetting default sdk values 

One slight discrepancy left - switching from using defaultClientSideAvailability to not using the attribute applies the correct changes, but ONLY shows changes to includeInSnippetByDefault in the plan, NOT changes to defaultClientSideAvailability (if applicable)

* test: add tests for project changes

* docs: update docs to reflect changes

* docs: update changelog

* chore: account for changes to project dataSource

* fix: only set include_in_snippet for non data source projects

* chore: make default_csa nested fields required

* chore: deprecate data source attr client_side_availability but maintain support

* docs: update docs and changelog

* docs: update project resource docs according to suggestions

Co-authored-by: Henry Barrow <[email protected]>

* chore: only set datasource deprecated attribute on ds reads

* docs: Apply suggestions from code review

Co-authored-by: Henry Barrow <[email protected]>

Co-authored-by: Henry Barrow <[email protected]>

* Fix nil pointer dereference when reading empty approval settings (#169)

* Fix nil approval settings bug and clean up circleci config.yml

* Update Changelog

* Backmerge v2.3.0 (#170)

* Imiller/sc 136707/streamline tests to use key constants where (#172)

* update data source tests

* add a pre-commit to alphabetize the keys

* resources

* changelog

* Added validation to project key length

* Added rate limit and conflict retry logic to LD client (#171)

* Added rate limit and conflicts retry logic to LD client

* Removed occurences of handleRateLimit and handleConflicts from the codebase since both logic has been replaced by go-retyable

* Used retryable client for the fallbackClient, fixed a header bug in the unit tests and added jitter to sleep value for 429s

Co-authored-by: Henry Barrow <[email protected]>

* Add golangci-lint pre-commit hook and run hooks in CI (#175)

* Ffeldberg/sc 136452/use the context aware version of all crud (#174)

* chore: refactor resource CRUD funcs to be ctx aware

* feat: convert validation helpers to context aware funcs

* feat: convert inline validation to diag aware func

* chore: apply ToDiagFunc wrapper to other custom validators

* fix: TypeList validators cant use ToDiagFunc

* fix: TypeSett validators cant use ToDiagFunc

* add integration resource (#164)

* stub integration resource

* dump json of audit log configs to file

* this should theoretically work

* rename to launchdarkly_audit_log_subscription

* add required to policy options - must be true for audit log subs

* actually never mind i have decided on a better way to deal with it

* set default statements and update tests

* ehhh screw it we're making statements required since the api errors if not passed

* ensure error if config is wrongly set

* clean up comments

* refactor for data source and add tests - not sure why failing

* integration key must be required to get duh

* finally fixed that

* add resource doc

* more docs

* handle casing

* handle bool types

* update data source tests to use examples more likely to break

* small docs update

* update changelog

* forgot to mention data source in changelog

* add to the development doc

* add strcase to go.mod

* use const attributes for tests

* update go client

* forgot to update circle config

* add pre commit to run python script for audit log sub configs

* remove old handleRateLimit functions

* udpate doc

* bug fix

* handle optional defaults

* error if error reading json config file

* use go struct

* make on required

* add examples

* use context-aware functions

* update doc to say on is required

* define optional for data source

* fix host issue

* update doc

* small refactor

* add new line

Co-authored-by: Fabian <[email protected]>

* return diag not nil from delete function

* typo

Co-authored-by: Fabian <[email protected]>

* Add relay proxy config resource (#168)

* [sc 137274] add team members data source (#177)

* chore: refactor getTeamMember to actually query instead of list

* refactor: change teamMember schema to function for reusability and add optional ID

* feat: add new data source and related keys

* test: add tests for new datasource

* docs: add documentation and update changelog

* chore: change query logic to filter members in code

* Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

Co-authored-by: Isabelle Miller <[email protected]>

* add flag triggers resource and data source (#163)

* Start updating go client

* Continue updating resources

* feature flag resource

* feature flag resource test

* approval settings and custom role policies

* destination resource

* environment

* feature flag environment

* project

* segment

* team member

* webhook

* rule, segment rule, segments, and team member helpers

* variations helper

* data source tests

* webhooks helper

* resource tests

* variations helper test

* policy helpers and tests probably will all fail

* custom role and access token probably also broken

* policy statements helper update

* instantiate config prior to setting other values on it

* fix 401

* vendor v7

* update all imports to v7

* missed one

* fix nil pointer dereference

* instantiate with var instead of make to fix non-empty slice bu

* custom roles now complains if you try to set more than one of Role, InlineRole, or CustomRoleIds

* fix webhook statemetns

* webhook read check if statements are nil & webhook create only set secret if defined

* update changelog

* fix webhook data source tests

* new pointers in client FeatureFlagConfig breaking ff env data source tests

* fix negative expiry thing (apparently the api no longer handles it so we have to)

* move reset into helper function

* hackily handle token reset requests until client bug is fixed

* fix variation transformation - can no longer point to empty string

* fix notResource and notActions

* fix policy helper tests

* fix the weird empty string value in variations issue

* strip protocol from host if provided

* go mod tidy && vendor

* update all go packages

* clean up commentsg

* stub resource functions

* stub schema

* define instructions

* theoretical create function

* stub update

* stub helper

* update schema

* refactor schema for data source

* not sure if this is the best way to do IDs or not yet

* trying compound IDs

* set proj env flag keys in read

* theoretically handle enabled

* ehhhh useless helper function

* add test, update instructionsFromResourceData

* feat: add enabled update call in create trigger lifecycle

* test works with fixed client

* set url prior to update

* get update working

* iron out some bugs

* update some descriptions

* add flag exist chec to tests

* data source test

* fix if not found error

* failing test

* handle IDs for data source

* clean up comments

* Resource doc

* finalize docs

* update changelog

* typo in changelog

* use consts for test attributes

* make trigger_url sensiive

* update go client

* update circle config

* mae enabled required

* add notes about enterprise feature and sensitive trigger url data to docs

* fix IDs

* add examples

* make context aware

* forgot to add website links

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Fabian Feldberg <[email protected]>

* typo

* [sc 136319] add launchdarkly metric (#167)

* feat: first draft of metrics Schema and crud function stubs

* chore: adjust read to match existing patterns

* chore: add data source metric scaffolding

* chore: first attempt at custom URLs reader for metrics

* feat: first attempts at create

* feat: first attempt at read

* chore: add new resource and ds to provider

* feat: create and read working (with small issues)

* feat: add delete

* feat: basic update working

* test: add basic create test to metric resource

* test: add basic tests for metric data source

* test: simplify error check

* chore: small steps towards success_criteria

* chore: use customizeDiff to validate multiple dependant attributes

* chore: small comments

* chore: clean up validation of attributes

* docs: add starter for metric resource docs and sidebar links

* docs: update data_source docs

* chore: cleanup comments etc

* feat: validate urls blocks for metrics

* fix: fix typo

* chore: remove logs

* chore: move urls validation helper to helpers, adjust logic for successCriteria on create

* chore: tidy up

* test: use KEYS in tests where possible

* test: update test to check two url values

* chore: Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

* chore: remove periods for consintency

* chore: Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

* chore: error consitency

* docs: update link in docs

* test: add extra test for metric update

* chore: update changelog

* feat: bump api client version and start passing successCriteria on creation

* chore: alphabetise keys.go

* chore: alphabetise keys.go

* test: add metric tests to circleci config

* fix: account for changes to client

* docs: add examples for metrics

* docs: correct URL format in example

* chore: remove ID field from data source, make non key fields optional

* chore: make non key fields optional

* docs: fix changelog after merges

* Update CHANGELOG.md

Co-authored-by: Isabelle Miller <[email protected]>

* Update launchdarkly/metrics_helper.go

Co-authored-by: Isabelle Miller <[email protected]>

* chore: use ToDiagFunc helper

* chore: cleaner diag error return

* test: adjust expected error

Co-authored-by: Isabelle Miller <[email protected]>

* [sc 137802] emails need to be url escaped when querying (#178)

* fix: url escape member emails when querying

* test: update tests to ensure we also use an escapable char (+)

* Ffeldberg/sc 136454/use configurecontextfunc instead of configurefunc (#176)

* feat: make providerConfigure context aware

* fix: fix typo

* WIP: attempt to pass in context to NewClient (breaks everything)

* Revert "WIP: attempt to pass in context to NewClient (breaks everything)"

This reverts commit 09a082042bb0fe3e09db62544683b1a559b804e9.

* Imiller/sc 137617/tf doc improvements (#180)

* specfy location of relay proxy id

* integationKey should be forcenew

* specify force new in docs

* add missing notes about enterprise plans

* Ffeldberg/sc 137794/escalation terraform provider throws error (#179)

* chore: bump go client version

* fix: update to account for new go client version

* todo: add debugging comment

* chore: update policy_statement Schema to use conflictswith

* revert schema changes with conflictswith.. not possible hashicorp/terraform-plugin-sdk#71

* fix: add resources/notresources and actions/notactions as required

* test: add not_resource and not_actions tests

* fix: fix the hashing for pointers in subfields

* fix unit tests and update auditlog config through hook

* Clean up policy statements helper functions (#182)

* Clean up policy statements helper functions

* Fix nil return bug

* Add relay proxy config data source (#183)

Co-authored-by: Isabelle Miller <[email protected]>

Co-authored-by: Isabelle Miller <[email protected]>

* Remove unnecessary attributes from  metric data source test config (#184)

* prepare release

Co-authored-by: Sunny <[email protected]>
Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>
Co-authored-by: Fabian <[email protected]>
Co-authored-by: Clifford Tawiah <[email protected]>
Co-authored-by: Fabian Feldberg <[email protected]>
sloloris added a commit that referenced this pull request Jan 19, 2022
* Update CHANGELOG.md

fix error in changelog

* Imiller/ch117193/rename flag_fallthrough to fallthrough & user_targets to targets (#131)

* add fallthrough and deprecate message to flag_fallthrough

* update doc

* conflicts with

* handle

* update a test

* update changelog

* fix typos in docs

* add targets attribute

* fix linter complaint

* handle in create

* update

* handle read

* update commetn

* update tests

* hack remove user_targets from plan

* set both computed attributes in read

* update changelog

* always set

* simplify helper

* fix data source test

* add test for deprecated field updates

* fix fromResourceData functions

* check renamed on as well

* Update data source d oc

* update data source tests

* Imiller/ch117375/GitHub issue empty string variation (#135)

* should fix it

* add test case

* update changelog and doc

* Fix duplicate text in CHANGELOG.md

Somehow the changelog test was duplicated. Removing, and we can fix the changelog on our next release.

* V2 main (#128)

* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch115579/fix include in snippet bug (#129)

* all it needed was a default val

* add test to ensure optional attributes get set correctly when removed

* fix test

* use TestCheckNoResourceAttr instead of TestCheckResourceAttr

* update changelog

* Imiller/ch113419/upgrade terraform client to v2 (#114)

* run v2 helper

* replace hashcode.String() with schema.HashString()

* replace terraform.ResourceProvider with *schema.Provider

* fix data source TypeMaps

* bump v2 sdk to latest (#116)

* merge

* Remove versions.tf (#119)

* Imiller/ch114162/upgrade resource launchdarkly environment (#121)

* make project_key required

* update descriptions

* update changelog

* Imiller/ch114165/v1 project audit (#120)

* add descriptions

* update doc dscription

* audit team member for v1 (#122)

* update descriptions

* add import instructions to team member docs

* add team member examples

* ForceNew when email is updated

* update test file structure to better reflect provider pattern

* add AtLeastOneOf for role and custom_roles

* oops wrong doc

* use validation.StringInSlice()

* refactor key conversion functions into helper file

* remove owner

* forgot changelog

* Imiller/ch114163/v1 feature flag env (#112)

* add descriptions for everything

* fix dangling default values

* fix bug where creating a non-bool flag with no variations creates a bool flag

* add bug fixes to changelog

* built in an idiotic bug, fixed now

* see if this fixes all of the tests

* found typo:

* fix broken tests

* add descriptions

* update some descriptions for clarity

* make clauses RequiredWith on variations to preempt api error

* fix error in doc

* fix docs properly

* deprecated targeting_enabled in favor of on

* remove ReuqiredWith because it's causing a bug

* fix plan bug

* hopefully this will fix it

* ughhhhh it was that it needed to be computed

* forgot the doc oops

* forgot the changelog too meep

* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch114160/v1 custom role (#125)

* add descriptions

* reformat tests to match pattern

* check removal of optional attributes removes

* holy crap how did this not break earlier

* not sure how that one stuck around either

* somehow we were not actually setting the flag_id

* fix feature flag read

* fix csa on project read

* apparently errors are different too

* remove lingering merge conflict text from changelog

* fix noMatchReturnsError errors

* remove hash indices on type set

* remove hash function for custom role policy

* fix destination tests

* fix feature flag tests

* fix env tests

* fix project tests

* fix segment tests

* fix segment tests and remove unused testAccTagKey function

* revert computed

* define CSA inline

* update changelog

* remove MaxItems property from data sources

* fix forProject

Co-authored-by: Henry Barrow <[email protected]>

* Imiller/ch115576/revert feature flag env optional attributes (#130)

* remove deprecated attribute targeting_enabled (replaced by on)

* on should default to false when removed

* forgot to fix data source tests

* fix test to handle on reversion

* make rules not computed

* make user_targets not computed

* update comments

* finally got fallthrough working

* fix test

* clarify

* fix more tests

* remove deprecated user_targets and flag_fallthrough from schema

* update read

* revert helpers

* update create

* update tests

* update example

* update doc

* remove deprecated fields from keys

* update changelog

* fix fallthrough and fix test

* update changelog

* missed a bit on the docs'

* make prerequisite not computed

* udate changelog again

* add test case for removing prereqs

* update flag_id description for clarity

* add defaults for optional fields

* update test again

* update changelog again

* handle off_variation defaults

* fix data source test

* have to use GetOkExists instead of GetOk to be able to set 0 off_variation on create

* remove commented-out code

* Imiller/ch115576/make fallthrough off variation required (#134)

* make required in schemas

* fix some test configs

* add required attributes to rest of tests. tests all failing

* always set both on read

* no need to check if fallthrough not set because tf will enforce

* update CRU functions

* fix data source tests

* update changelog and docs for new required attributes

* remove comment no longer applicable

* fix typo

* remove `enabled` on webhooks

* removed `policy_statements` on webhooks

* removed `targeting_enabled` on feature flag environment

* update change log

* Change schema function to use recommended one.

* Imiller/ch119139/make env configs required on project resource (#137)

* make required

* delete envs that were previously in state and have been removed

* remove redundant test & add required envs

* ImportSTateVerifyIgnore envs

* update docs

* move full_config example into v1_full_config

* add v2 full config

* update example

* update test project scaffolding function

* change State to StateContext function

* update comment

* fix destination test bug

* add test case for when we fix env defaults

* add note to import about envs

* update changelog

* remove debug bin

* add debug_bin to gitignore

* address pr comments by adding back stuff to docs

* update all example versions to 1.7

* Added logic to delete remote webhook statements when statements block… (#133)

* Added logic to delete remote webhook statements when statements block is removed

* refactored tests

* Added has changes check around the webhook policy statements

* Reverted changes in version file

* Removed check for deprecated policy_statements

* Removed deprecated fields and refactored helper functions using those deprecated fields

* Removed ConflictsWith for the webhook ON schema since ENABLED no longer exists in the schema

* Fixed test cases

* Updated changelog, refactored getWebhookOn and updated the docs

* Updated version in example and added default config for webhook ON element

* Imiller/ch119137/make segment clause negate field optional (#136)

* make oiptional and default to false + update test

* add example segment config for 2.0

* this should be v2.0.0

* Do not require fallthrough and off_variation in ff_env data source (#142)

* added version to versions.tf file for webhook

* v2 for custom_role and destination. Update read me

* Change targets schema to set and add 'variation' attribute (#141)

* Revise targets schema

* update docs

* Make target values required

* Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

* Change List to Set in description

* remove debug_bin

Co-authored-by: Isabelle Miller <[email protected]>

* Imiller/ch115572/restructure default flag variations (#146)

* add new defaults to schema

* update tests to expected configs / outcomes

* add default on

* restructure defaultVariationsFromResourceData

* update test cases

* hitting a non-empty plan error in test

* ffs just needed to be Computed

* update tests

* update docs and changelog

* fix test

* lost a brace

* fix variation helper

* fix changelog

* small doc fixes (#147)

* remove enabled from destination docs

* update webhook doc

* update doc on name issue (#151)

* environment and data_source_webhook examples (#149)

* added more examples

* added comments

* Imiller/ch120560/feature flag maintainer id should be removed (#150)

* make computed and update tes

* update doc

* update changelog

* Imiller/ch119620/audit examples (#152)

* make separate v1 and v2 feature flag examples

* ensure v2 ff example works

* move some stuff around

* some more reorg

* more reorg

* update toc in readme

* update v2 feature flag readme

* Bug Fix: Revert optional env attributes to defaults (#148)

* Fixed and tests passing

* improve env update test

* default_ttl default, and create new test

* default_ttl should reset to 0

* update docs and changelog

Co-authored-by: Isabelle Miller <[email protected]>

* remove test examples shouldn't have been checked in

* add terraform version note to changelog

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>

* Fix import of launchdarkly_project nested environments (#153)

* start importing all environments

* Preserve environment order

* Update changelog

* Add ignore_changes to withRandomProject

* update doc (#154)

* Imiller/sc 119920/add boolean archive attribute to launchdarkly (#155)

* add archived to ff env schema

* make it a global property

* put it in the wrong schema doh

* attempt archive before deleting so we can return an error if there are dependencies

* prelim test

* some syntax issues

* gotta figure out error bit

* remove failing test

* forgot to set archived in read function

* actually no need to archive first

* Update index of docs with recommended version (#156)

* Update index of docs with recommended version

* Show how to configure the access token

* Imiller/sc 123568/add approval settings to environment resource (#157)

* prelim schema

* tweak approval schema

* draft conversion functions

* i forgot you can't use conflictswith with nested attributes

* a mess of things

* fixed up patches

* handle patch remove

* okay i think this should handle all cases

* unused transformation function since no setting

* forgot to handle most obvious case

* need to set but only sometimes

* min num approvals cannot exceed 5

* make min num approvals required

* project test

* fix helper function for project - first pass

* make entire approvals schema computed

* projet tests working

* NOW project tests working

* remove dead code

* update docs

* update changelog

* simplify approval helper function

* switch old and new afunc arguments

* Imiller/sc 126337/make can apply declined changes default to (#158)

* update error message

* change default in schema

* update tests

* update docs'

* update changelog

* clarify rollout weights (#159)

* Upgrade Terraform provider to use api-client-go 7 (#160)

* Start updating go client

* Continue updating resources

* feature flag resource

* feature flag resource test

* approval settings and custom role policies

* destination resource

* environment

* feature flag environment

* project

* segment

* team member

* webhook

* rule, segment rule, segments, and team member helpers

* variations helper

* data source tests

* webhooks helper

* resource tests

* variations helper test

* policy helpers and tests probably will all fail

* custom role and access token probably also broken

* policy statements helper update

* instantiate config prior to setting other values on it

* fix 401

* vendor v7

* update all imports to v7

* missed one

* fix nil pointer dereference

* instantiate with var instead of make to fix non-empty slice bu

* custom roles now complains if you try to set more than one of Role, InlineRole, or CustomRoleIds

* fix webhook statemetns

* webhook read check if statements are nil & webhook create only set secret if defined

* update changelog

* fix webhook data source tests

* new pointers in client FeatureFlagConfig breaking ff env data source tests

* fix negative expiry thing (apparently the api no longer handles it so we have to)

* move reset into helper function

* hackily handle token reset requests until client bug is fixed

* fix variation transformation - can no longer point to empty string

* fix notResource and notActions

* fix policy helper tests

* fix the weird empty string value in variations issue

* strip protocol from host if provided

* go mod tidy && vendor

* update all go packages

* clean up commentsg

* clean up comment

* Ffeldberg/sc 130551/add the ability to adjust the sdks using (#161)

* chore: first attempts

* feat: updating flag resources works, reading/creating plan is a bit iffy

* chore: clean up comments a bit

* chore: add TODO as reminder

* chore: add more todos

* chore: use ConflictsWith to ensure users dont use both includeInSnippet and clientSideAvailablity

* chore: pr feedback - update deprecation message, always read both sdk client values

* feat: set both includeInSnippet and clientSideAvailability to computed properties

* wip: attempt to use computed and update/create logic blocks

* add comment

* use getOk instead of getOkExists for nested, rename vars

* wip: use getOk instead of getOkExists for nested, test modified read

* temp: temporary test changes for local debugging

* chore: add some comments

* feat: working apart from switching back to deprecated option in edge case

* chore: remove commented out code

* fix: fix issue with read

* test: reset tests

* fix: fix typo in read

* fix: account for datasources in featureflag read

* test: add tests for clientSideAvailability changes

* docs: update example docs

* docs: add include_in_snippet to website docs and add deprecation notice

* docs: update docs

* chore: update CHANGELOG

* fix: fix most issues caused by go client v7 merge

* fix: fix other merge issues

* chore: update CHANGELOG

* chore: apply codereview keys suggestions

Co-authored-by: Isabelle Miller <[email protected]>

* chore: Update launchdarkly/feature_flags_helper.go

keys

Co-authored-by: Isabelle Miller <[email protected]>

* chore: update keys.go to reflect clientsideavailablity keys

* chore: go fmt

* test: add tests for switching between CSA and IIS, clean up

* chore: go fmt

* test: remove pure create tests

* chore: add TODOs where required

* test: add new test case for reverting to default CSA

* feat: set clientSideAvailability according to project defaults for flags

* test: update tests accordingly and add comments

* chore: fmt

* refactor project default get into its own function

* test: account for default project CSA settings

* feat: basic working implementation of resetting to defaults using customizeDiff

* feat: attempted changes to customdiff to support CSA

* chore: clean up flag resource read

* chore: clean up comments and todos

* docs: update docs to mention project level defaults for flag sdk settings

* chore: remove prints to clean up test logs

* chore: go mod vendor

* chore: Update CHANGELOG.md

Co-authored-by: Isabelle Miller <[email protected]>

* chore: address pr feedback

* docs: update changelog

Co-authored-by: Isabelle Miller <[email protected]>

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Fabian <[email protected]>

* prepare 2.2.0 release (#75) (#162)

* Update CHANGELOG.md

fix error in changelog

* Imiller/ch117193/rename flag_fallthrough to fallthrough & user_targets to targets (#131)

* add fallthrough and deprecate message to flag_fallthrough

* update doc

* conflicts with

* handle

* update a test

* update changelog

* fix typos in docs

* add targets attribute

* fix linter complaint

* handle in create

* update

* handle read

* update commetn

* update tests

* hack remove user_targets from plan

* set both computed attributes in read

* update changelog

* always set

* simplify helper

* fix data source test

* add test for deprecated field updates

* fix fromResourceData functions

* check renamed on as well

* Update data source d oc

* update data source tests

* Imiller/ch117375/GitHub issue empty string variation (#135)

* should fix it

* add test case

* update changelog and doc

* Fix duplicate text in CHANGELOG.md

Somehow the changelog test was duplicated. Removing, and we can fix the changelog on our next release.

* V2 main (#128)

* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch115579/fix include in snippet bug (#129)

* all it needed was a default val

* add test to ensure optional attributes get set correctly when removed

* fix test

* use TestCheckNoResourceAttr instead of TestCheckResourceAttr

* update changelog

* Imiller/ch113419/upgrade terraform client to v2 (#114)

* run v2 helper

* replace hashcode.String() with schema.HashString()

* replace terraform.ResourceProvider with *schema.Provider

* fix data source TypeMaps

* bump v2 sdk to latest (#116)

* merge

* Remove versions.tf (#119)

* Imiller/ch114162/upgrade resource launchdarkly environment (#121)

* make project_key required

* update descriptions

* update changelog

* Imiller/ch114165/v1 project audit (#120)

* add descriptions

* update doc dscription

* audit team member for v1 (#122)

* update descriptions

* add import instructions to team member docs

* add team member examples

* ForceNew when email is updated

* update test file structure to better reflect provider pattern

* add AtLeastOneOf for role and custom_roles

* oops wrong doc

* use validation.StringInSlice()

* refactor key conversion functions into helper file

* remove owner

* forgot changelog

* Imiller/ch114163/v1 feature flag env (#112)

* add descriptions for everything

* fix dangling default values

* fix bug where creating a non-bool flag with no variations creates a bool flag

* add bug fixes to changelog

* built in an idiotic bug, fixed now

* see if this fixes all of the tests

* found typo:

* fix broken tests

* add descriptions

* update some descriptions for clarity

* make clauses RequiredWith on variations to preempt api error

* fix error in doc

* fix docs properly

* deprecated targeting_enabled in favor of on

* remove ReuqiredWith because it's causing a bug

* fix plan bug

* hopefully this will fix it

* ughhhhh it was that it needed to be computed

* forgot the doc oops

* forgot the changelog too meep

* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch114160/v1 custom role (#125)

* add descriptions

* reformat tests to match pattern

* check removal of optional attributes removes

* holy crap how did this not break earlier

* not sure how that one stuck around either

* somehow we were not actually setting the flag_id

* fix feature flag read

* fix csa on project read

* apparently errors are different too

* remove lingering merge conflict text from changelog

* fix noMatchReturnsError errors

* remove hash indices on type set

* remove hash function for custom role policy

* fix destination tests

* fix feature flag tests

* fix env tests

* fix project tests

* fix segment tests

* fix segment tests and remove unused testAccTagKey function

* revert computed

* define CSA inline

* update changelog

* remove MaxItems property from data sources

* fix forProject

Co-authored-by: Henry Barrow <[email protected]>

* Imiller/ch115576/revert feature flag env optional attributes (#130)

* remove deprecated attribute targeting_enabled (replaced by on)

* on should default to false when removed

* forgot to fix data source tests

* fix test to handle on reversion

* make rules not computed

* make user_targets not computed

* update comments

* finally got fallthrough working

* fix test

* clarify

* fix more tests

* remove deprecated user_targets and flag_fallthrough from schema

* update read

* revert helpers

* update create

* update tests

* update example

* update doc

* remove deprecated fields from keys

* update changelog

* fix fallthrough and fix test

* update changelog

* missed a bit on the docs'

* make prerequisite not computed

* udate changelog again

* add test case for removing prereqs

* update flag_id description for clarity

* add defaults for optional fields

* update test again

* update changelog again

* handle off_variation defaults

* fix data source test

* have to use GetOkExists instead of GetOk to be able to set 0 off_variation on create

* remove commented-out code

* Imiller/ch115576/make fallthrough off variation required (#134)

* make required in schemas

* fix some test configs

* add required attributes to rest of tests. tests all failing

* always set both on read

* no need to check if fallthrough not set because tf will enforce

* update CRU functions

* fix data source tests

* update changelog and docs for new required attributes

* remove comment no longer applicable

* fix typo

* remove `enabled` on webhooks

* removed `policy_statements` on webhooks

* removed `targeting_enabled` on feature flag environment

* update change log

* Change schema function to use recommended one.

* Imiller/ch119139/make env configs required on project resource (#137)

* make required

* delete envs that were previously in state and have been removed

* remove redundant test & add required envs

* ImportSTateVerifyIgnore envs

* update docs

* move full_config example into v1_full_config

* add v2 full config

* update example

* update test project scaffolding function

* change State to StateContext function

* update comment

* fix destination test bug

* add test case for when we fix env defaults

* add note to import about envs

* update changelog

* remove debug bin

* add debug_bin to gitignore

* address pr comments by adding back stuff to docs

* update all example versions to 1.7

* Added logic to delete remote webhook statements when statements block… (#133)

* Added logic to delete remote webhook statements when statements block is removed

* refactored tests

* Added has changes check around the webhook policy statements

* Reverted changes in version file

* Removed check for deprecated policy_statements

* Removed deprecated fields and refactored helper functions using those deprecated fields

* Removed ConflictsWith for the webhook ON schema since ENABLED no longer exists in the schema

* Fixed test cases

* Updated changelog, refactored getWebhookOn and updated the docs

* Updated version in example and added default config for webhook ON element

* Imiller/ch119137/make segment clause negate field optional (#136)

* make oiptional and default to false + update test

* add example segment config for 2.0

* this should be v2.0.0

* Do not require fallthrough and off_variation in ff_env data source (#142)

* added version to versions.tf file for webhook

* v2 for custom_role and destination. Update read me

* Change targets schema to set and add 'variation' attribute (#141)

* Revise targets schema

* update docs

* Make target values required

* Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

* Change List to Set in description

* remove debug_bin

Co-authored-by: Isabelle Miller <[email protected]>

* Imiller/ch115572/restructure default flag variations (#146)

* add new defaults to schema

* update tests to expected configs / outcomes

* add default on

* restructure defaultVariationsFromResourceData

* update test cases

* hitting a non-empty plan error in test

* ffs just needed to be Computed

* update tests

* update docs and changelog

* fix test

* lost a brace

* fix variation helper

* fix changelog

* small doc fixes (#147)

* remove enabled from destination docs

* update webhook doc

* update doc on name issue (#151)

* environment and data_source_webhook examples (#149)

* added more examples

* added comments

* Imiller/ch120560/feature flag maintainer id should be removed (#150)

* make computed and update tes

* update doc

* update changelog

* Imiller/ch119620/audit examples (#152)

* make separate v1 and v2 feature flag examples

* ensure v2 ff example works

* move some stuff around

* some more reorg

* more reorg

* update toc in readme

* update v2 feature flag readme

* Bug Fix: Revert optional env attributes to defaults (#148)

* Fixed and tests passing

* improve env update test

* default_ttl default, and create new test

* default_ttl should reset to 0

* update docs and changelog

Co-authored-by: Isabelle Miller <[email protected]>

* remove test examples shouldn't have been checked in

* add terraform version note to changelog

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>

* Fix import of launchdarkly_project nested environments (#153)

* start importing all environments

* Preserve environment order

* Update changelog

* Add ignore_changes to withRandomProject

* update doc (#154)

* Imiller/sc 119920/add boolean archive attribute to launchdarkly (#155)

* add archived to ff env schema

* make it a global property

* put it in the wrong schema doh

* attempt archive before deleting so we can return an error if there are dependencies

* prelim test

* some syntax issues

* gotta figure out error bit

* remove failing test

* forgot to set archived in read function

* actually no need to archive first

* Update index of docs with recommended version (#156)

* Update index of docs with recommended version

* Show how to configure the access token

* Imiller/sc 123568/add approval settings to environment resource (#157)

* prelim schema

* tweak approval schema

* draft conversion functions

* i forgot you can't use conflictswith with nested attributes

* a mess of things

* fixed up patches

* handle patch remove

* okay i think this should handle all cases

* unused transformation function since no setting

* forgot to handle most obvious case

* need to set but only sometimes

* min num approvals cannot exceed 5

* make min num approvals required

* project test

* fix helper function for project - first pass

* make entire approvals schema computed

* projet tests working

* NOW project tests working

* remove dead code

* update docs

* update changelog

* simplify approval helper function

* switch old and new afunc arguments

* Imiller/sc 126337/make can apply declined changes default to (#158)

* update error message

* change default in schema

* update tests

* update docs'

* update changelog

* clarify rollout weights (#159)

* Upgrade Terraform provider to use api-client-go 7 (#160)

* Start updating go client

* Continue updating resources

* feature flag resource

* feature flag resource test

* approval settings and custom role policies

* destination resource

* environment

* feature flag environment

* project

* segment

* team member

* webhook

* rule, segment rule, segments, and team member helpers

* variations helper

* data source tests

* webhooks helper

* resource tests

* variations helper test

* policy helpers and tests probably will all fail

* custom role and access token probably also broken

* policy statements helper update

* instantiate config prior to setting other values on it

* fix 401

* vendor v7

* update all imports to v7

* missed one

* fix nil pointer dereference

* instantiate with var instead of make to fix non-empty slice bu

* custom roles now complains if you try to set more than one of Role, InlineRole, or CustomRoleIds

* fix webhook statemetns

* webhook read check if statements are nil & webhook create only set secret if defined

* update changelog

* fix webhook data source tests

* new pointers in client FeatureFlagConfig breaking ff env data source tests

* fix negative expiry thing (apparently the api no longer handles it so we have to)

* move reset into helper function

* hackily handle token reset requests until client bug is fixed

* fix variation transformation - can no longer point to empty string

* fix notResource and notActions

* fix policy helper tests

* fix the weird empty string value in variations issue

* strip protocol from host if provided

* go mod tidy && vendor

* update all go packages

* clean up commentsg

* clean up comment

* Ffeldberg/sc 130551/add the ability to adjust the sdks using (#161)

* chore: first attempts

* feat: updating flag resources works, reading/creating plan is a bit iffy

* chore: clean up comments a bit

* chore: add TODO as reminder

* chore: add more todos

* chore: use ConflictsWith to ensure users dont use both includeInSnippet and clientSideAvailablity

* chore: pr feedback - update deprecation message, always read both sdk client values

* feat: set both includeInSnippet and clientSideAvailability to computed properties

* wip: attempt to use computed and update/create logic blocks

* add comment

* use getOk instead of getOkExists for nested, rename vars

* wip: use getOk instead of getOkExists for nested, test modified read

* temp: temporary test changes for local debugging

* chore: add some comments

* feat: working apart from switching back to deprecated option in edge case

* chore: remove commented out code

* fix: fix issue with read

* test: reset tests

* fix: fix typo in read

* fix: account for datasources in featureflag read

* test: add tests for clientSideAvailability changes

* docs: update example docs

* docs: add include_in_snippet to website docs and add deprecation notice

* docs: update docs

* chore: update CHANGELOG

* fix: fix most issues caused by go client v7 merge

* fix: fix other merge issues

* chore: update CHANGELOG

* chore: apply codereview keys suggestions

Co-authored-by: Isabelle Miller <[email protected]>

* chore: Update launchdarkly/feature_flags_helper.go

keys

Co-authored-by: Isabelle Miller <[email protected]>

* chore: update keys.go to reflect clientsideavailablity keys

* chore: go fmt

* test: add tests for switching between CSA and IIS, clean up

* chore: go fmt

* test: remove pure create tests

* chore: add TODOs where required

* test: add new test case for reverting to default CSA

* feat: set clientSideAvailability according to project defaults for flags

* test: update tests accordingly and add comments

* chore: fmt

* refactor project default get into its own function

* test: account for default project CSA settings

* feat: basic working implementation of resetting to defaults using customizeDiff

* feat: attempted changes to customdiff to support CSA

* chore: clean up flag resource read

* chore: clean up comments and todos

* docs: update docs to mention project level defaults for flag sdk settings

* chore: remove prints to clean up test logs

* chore: go mod vendor

* chore: Update CHANGELOG.md

Co-authored-by: Isabelle Miller <[email protected]>

* chore: address pr feedback

* docs: update changelog

Co-authored-by: Isabelle Miller <[email protected]>

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Fabian <[email protected]>

* 2.2.0

Co-authored-by: Isabelle Miller <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>

Co-authored-by: Isabelle Miller <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>

* [SC-135367] Project resource should support default flag SDK values (#166)

* chore: update project resource schema

* chore: add new keys to keys.go

* feat: most situations working for plan/apply

* feat: use customizeDiff to account for resetting default sdk values 

One slight discrepancy left - switching from using defaultClientSideAvailability to not using the attribute applies the correct changes, but ONLY shows changes to includeInSnippetByDefault in the plan, NOT changes to defaultClientSideAvailability (if applicable)

* test: add tests for project changes

* docs: update docs to reflect changes

* docs: update changelog

* chore: account for changes to project dataSource

* fix: only set include_in_snippet for non data source projects

* chore: make default_csa nested fields required

* chore: deprecate data source attr client_side_availability but maintain support

* docs: update docs and changelog

* docs: update project resource docs according to suggestions

Co-authored-by: Henry Barrow <[email protected]>

* chore: only set datasource deprecated attribute on ds reads

* docs: Apply suggestions from code review

Co-authored-by: Henry Barrow <[email protected]>

Co-authored-by: Henry Barrow <[email protected]>

* Fix nil pointer dereference when reading empty approval settings (#169)

* Fix nil approval settings bug and clean up circleci config.yml

* Update Changelog

* Backmerge v2.3.0 (#170)

* Imiller/sc 136707/streamline tests to use key constants where (#172)

* update data source tests

* add a pre-commit to alphabetize the keys

* resources

* changelog

* Added validation to project key length

* Added rate limit and conflict retry logic to LD client (#171)

* Added rate limit and conflicts retry logic to LD client

* Removed occurences of handleRateLimit and handleConflicts from the codebase since both logic has been replaced by go-retyable

* Used retryable client for the fallbackClient, fixed a header bug in the unit tests and added jitter to sleep value for 429s

Co-authored-by: Henry Barrow <[email protected]>

* Add golangci-lint pre-commit hook and run hooks in CI (#175)

* Ffeldberg/sc 136452/use the context aware version of all crud (#174)

* chore: refactor resource CRUD funcs to be ctx aware

* feat: convert validation helpers to context aware funcs

* feat: convert inline validation to diag aware func

* chore: apply ToDiagFunc wrapper to other custom validators

* fix: TypeList validators cant use ToDiagFunc

* fix: TypeSett validators cant use ToDiagFunc

* add integration resource (#164)

* stub integration resource

* dump json of audit log configs to file

* this should theoretically work

* rename to launchdarkly_audit_log_subscription

* add required to policy options - must be true for audit log subs

* actually never mind i have decided on a better way to deal with it

* set default statements and update tests

* ehhh screw it we're making statements required since the api errors if not passed

* ensure error if config is wrongly set

* clean up comments

* refactor for data source and add tests - not sure why failing

* integration key must be required to get duh

* finally fixed that

* add resource doc

* more docs

* handle casing

* handle bool types

* update data source tests to use examples more likely to break

* small docs update

* update changelog

* forgot to mention data source in changelog

* add to the development doc

* add strcase to go.mod

* use const attributes for tests

* update go client

* forgot to update circle config

* add pre commit to run python script for audit log sub configs

* remove old handleRateLimit functions

* udpate doc

* bug fix

* handle optional defaults

* error if error reading json config file

* use go struct

* make on required

* add examples

* use context-aware functions

* update doc to say on is required

* define optional for data source

* fix host issue

* update doc

* small refactor

* add new line

Co-authored-by: Fabian <[email protected]>

* return diag not nil from delete function

* typo

Co-authored-by: Fabian <[email protected]>

* Add relay proxy config resource (#168)

* [sc 137274] add team members data source (#177)

* chore: refactor getTeamMember to actually query instead of list

* refactor: change teamMember schema to function for reusability and add optional ID

* feat: add new data source and related keys

* test: add tests for new datasource

* docs: add documentation and update changelog

* chore: change query logic to filter members in code

* Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

Co-authored-by: Isabelle Miller <[email protected]>

* add flag triggers resource and data source (#163)

* Start updating go client

* Continue updating resources

* feature flag resource

* feature flag resource test

* approval settings and custom role policies

* destination resource

* environment

* feature flag environment

* project

* segment

* team member

* webhook

* rule, segment rule, segments, and team member helpers

* variations helper

* data source tests

* webhooks helper

* resource tests

* variations helper test

* policy helpers and tests probably will all fail

* custom role and access token probably also broken

* policy statements helper update

* instantiate config prior to setting other values on it

* fix 401

* vendor v7

* update all imports to v7

* missed one

* fix nil pointer dereference

* instantiate with var instead of make to fix non-empty slice bu

* custom roles now complains if you try to set more than one of Role, InlineRole, or CustomRoleIds

* fix webhook statemetns

* webhook read check if statements are nil & webhook create only set secret if defined

* update changelog

* fix webhook data source tests

* new pointers in client FeatureFlagConfig breaking ff env data source tests

* fix negative expiry thing (apparently the api no longer handles it so we have to)

* move reset into helper function

* hackily handle token reset requests until client bug is fixed

* fix variation transformation - can no longer point to empty string

* fix notResource and notActions

* fix policy helper tests

* fix the weird empty string value in variations issue

* strip protocol from host if provided

* go mod tidy && vendor

* update all go packages

* clean up commentsg

* stub resource functions

* stub schema

* define instructions

* theoretical create function

* stub update

* stub helper

* update schema

* refactor schema for data source

* not sure if this is the best way to do IDs or not yet

* trying compound IDs

* set proj env flag keys in read

* theoretically handle enabled

* ehhhh useless helper function

* add test, update instructionsFromResourceData

* feat: add enabled update call in create trigger lifecycle

* test works with fixed client

* set url prior to update

* get update working

* iron out some bugs

* update some descriptions

* add flag exist chec to tests

* data source test

* fix if not found error

* failing test

* handle IDs for data source

* clean up comments

* Resource doc

* finalize docs

* update changelog

* typo in changelog

* use consts for test attributes

* make trigger_url sensiive

* update go client

* update circle config

* mae enabled required

* add notes about enterprise feature and sensitive trigger url data to docs

* fix IDs

* add examples

* make context aware

* forgot to add website links

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Fabian Feldberg <[email protected]>

* typo

* [sc 136319] add launchdarkly metric (#167)

* feat: first draft of metrics Schema and crud function stubs

* chore: adjust read to match existing patterns

* chore: add data source metric scaffolding

* chore: first attempt at custom URLs reader for metrics

* feat: first attempts at create

* feat: first attempt at read

* chore: add new resource and ds to provider

* feat: create and read working (with small issues)

* feat: add delete

* feat: basic update working

* test: add basic create test to metric resource

* test: add basic tests for metric data source

* test: simplify error check

* chore: small steps towards success_criteria

* chore: use customizeDiff to validate multiple dependant attributes

* chore: small comments

* chore: clean up validation of attributes

* docs: add starter for metric resource docs and sidebar links

* docs: update data_source docs

* chore: cleanup comments etc

* feat: validate urls blocks for metrics

* fix: fix typo

* chore: remove logs

* chore: move urls validation helper to helpers, adjust logic for successCriteria on create

* chore: tidy up

* test: use KEYS in tests where possible

* test: update test to check two url values

* chore: Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

* chore: remove periods for consintency

* chore: Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

* chore: error consitency

* docs: update link in docs

* test: add extra test for metric update

* chore: update changelog

* feat: bump api client version and start passing successCriteria on creation

* chore: alphabetise keys.go

* chore: alphabetise keys.go

* test: add metric tests to circleci config

* fix: account for changes to client

* docs: add examples for metrics

* docs: correct URL format in example

* chore: remove ID field from data source, make non key fields optional

* chore: make non key fields optional

* docs: fix changelog after merges

* Update CHANGELOG.md

Co-authored-by: Isabelle Miller <[email protected]>

* Update launchdarkly/metrics_helper.go

Co-authored-by: Isabelle Miller <[email protected]>

* chore: use ToDiagFunc helper

* chore: cleaner diag error return

* test: adjust expected error

Co-authored-by: Isabelle Miller <[email protected]>

* [sc 137802] emails need to be url escaped when querying (#178)

* fix: url escape member emails when querying

* test: update tests to ensure we also use an escapable char (+)

* Ffeldberg/sc 136454/use configurecontextfunc instead of configurefunc (#176)

* feat: make providerConfigure context aware

* fix: fix typo

* WIP: attempt to pass in context to NewClient (breaks everything)

* Revert "WIP: attempt to pass in context to NewClient (breaks everything)"

This reverts commit 09a082042bb0fe3e09db62544683b1a559b804e9.

* Imiller/sc 137617/tf doc improvements (#180)

* specfy location of relay proxy id

* integationKey should be forcenew

* specify force new in docs

* add missing notes about enterprise plans

* Ffeldberg/sc 137794/escalation terraform provider throws error (#179)

* chore: bump go client version

* fix: update to account for new go client version

* todo: add debugging comment

* chore: update policy_statement Schema to use conflictswith

* revert schema changes with conflictswith.. not possible hashicorp/terraform-plugin-sdk#71

* fix: add resources/notresources and actions/notactions as required

* test: add not_resource and not_actions tests

* fix: fix the hashing for pointers in subfields

* fix unit tests and update auditlog config through hook

* Clean up policy statements helper functions (#182)

* Clean up policy statements helper functions

* Fix nil return bug

* Add relay proxy config data source (#183)

Co-authored-by: Isabelle Miller <[email protected]>

Co-authored-by: Isabelle Miller <[email protected]>

* Remove unnecessary attributes from  metric data source test config (#184)

* merge issues

* weird merge issue

* include in snippet getting set twice

Co-authored-by: Sunny <[email protected]>
Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>
Co-authored-by: Fabian <[email protected]>
Co-authored-by: Clifford Tawiah <[email protected]>
Co-authored-by: Fabian Feldberg <[email protected]>
sloloris added a commit that referenced this pull request Jan 20, 2022
* prepare 2.2.0 release (#75)

* Update CHANGELOG.md

fix error in changelog

* Imiller/ch117193/rename flag_fallthrough to fallthrough & user_targets to targets (#131)

* add fallthrough and deprecate message to flag_fallthrough

* update doc

* conflicts with

* handle

* update a test

* update changelog

* fix typos in docs

* add targets attribute

* fix linter complaint

* handle in create

* update

* handle read

* update commetn

* update tests

* hack remove user_targets from plan

* set both computed attributes in read

* update changelog

* always set

* simplify helper

* fix data source test

* add test for deprecated field updates

* fix fromResourceData functions

* check renamed on as well

* Update data source d oc

* update data source tests

* Imiller/ch117375/GitHub issue empty string variation (#135)

* should fix it

* add test case

* update changelog and doc

* Fix duplicate text in CHANGELOG.md

Somehow the changelog test was duplicated. Removing, and we can fix the changelog on our next release.

* V2 main (#128)

* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch115579/fix include in snippet bug (#129)

* all it needed was a default val

* add test to ensure optional attributes get set correctly when removed

* fix test

* use TestCheckNoResourceAttr instead of TestCheckResourceAttr

* update changelog

* Imiller/ch113419/upgrade terraform client to v2 (#114)

* run v2 helper

* replace hashcode.String() with schema.HashString()

* replace terraform.ResourceProvider with *schema.Provider

* fix data source TypeMaps

* bump v2 sdk to latest (#116)

* merge

* Remove versions.tf (#119)

* Imiller/ch114162/upgrade resource launchdarkly environment (#121)

* make project_key required

* update descriptions

* update changelog

* Imiller/ch114165/v1 project audit (#120)

* add descriptions

* update doc dscription

* audit team member for v1 (#122)

* update descriptions

* add import instructions to team member docs

* add team member examples

* ForceNew when email is updated

* update test file structure to better reflect provider pattern

* add AtLeastOneOf for role and custom_roles

* oops wrong doc

* use validation.StringInSlice()

* refactor key conversion functions into helper file

* remove owner

* forgot changelog

* Imiller/ch114163/v1 feature flag env (#112)

* add descriptions for everything

* fix dangling default values

* fix bug where creating a non-bool flag with no variations creates a bool flag

* add bug fixes to changelog

* built in an idiotic bug, fixed now

* see if this fixes all of the tests

* found typo:

* fix broken tests

* add descriptions

* update some descriptions for clarity

* make clauses RequiredWith on variations to preempt api error

* fix error in doc

* fix docs properly

* deprecated targeting_enabled in favor of on

* remove ReuqiredWith because it's causing a bug

* fix plan bug

* hopefully this will fix it

* ughhhhh it was that it needed to be computed

* forgot the doc oops

* forgot the changelog too meep

* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch114160/v1 custom role (#125)

* add descriptions

* reformat tests to match pattern

* check removal of optional attributes removes

* holy crap how did this not break earlier

* not sure how that one stuck around either

* somehow we were not actually setting the flag_id

* fix feature flag read

* fix csa on project read

* apparently errors are different too

* remove lingering merge conflict text from changelog

* fix noMatchReturnsError errors

* remove hash indices on type set

* remove hash function for custom role policy

* fix destination tests

* fix feature flag tests

* fix env tests

* fix project tests

* fix segment tests

* fix segment tests and remove unused testAccTagKey function

* revert computed

* define CSA inline

* update changelog

* remove MaxItems property from data sources

* fix forProject

Co-authored-by: Henry Barrow <[email protected]>

* Imiller/ch115576/revert feature flag env optional attributes (#130)

* remove deprecated attribute targeting_enabled (replaced by on)

* on should default to false when removed

* forgot to fix data source tests

* fix test to handle on reversion

* make rules not computed

* make user_targets not computed

* update comments

* finally got fallthrough working

* fix test

* clarify

* fix more tests

* remove deprecated user_targets and flag_fallthrough from schema

* update read

* revert helpers

* update create

* update tests

* update example

* update doc

* remove deprecated fields from keys

* update changelog

* fix fallthrough and fix test

* update changelog

* missed a bit on the docs'

* make prerequisite not computed

* udate changelog again

* add test case for removing prereqs

* update flag_id description for clarity

* add defaults for optional fields

* update test again

* update changelog again

* handle off_variation defaults

* fix data source test

* have to use GetOkExists instead of GetOk to be able to set 0 off_variation on create

* remove commented-out code

* Imiller/ch115576/make fallthrough off variation required (#134)

* make required in schemas

* fix some test configs

* add required attributes to rest of tests. tests all failing

* always set both on read

* no need to check if fallthrough not set because tf will enforce

* update CRU functions

* fix data source tests

* update changelog and docs for new required attributes

* remove comment no longer applicable

* fix typo

* remove `enabled` on webhooks

* removed `policy_statements` on webhooks

* removed `targeting_enabled` on feature flag environment

* update change log

* Change schema function to use recommended one.

* Imiller/ch119139/make env configs required on project resource (#137)

* make required

* delete envs that were previously in state and have been removed

* remove redundant test & add required envs

* ImportSTateVerifyIgnore envs

* update docs

* move full_config example into v1_full_config

* add v2 full config

* update example

* update test project scaffolding function

* change State to StateContext function

* update comment

* fix destination test bug

* add test case for when we fix env defaults

* add note to import about envs

* update changelog

* remove debug bin

* add debug_bin to gitignore

* address pr comments by adding back stuff to docs

* update all example versions to 1.7

* Added logic to delete remote webhook statements when statements block… (#133)

* Added logic to delete remote webhook statements when statements block is removed

* refactored tests

* Added has changes check around the webhook policy statements

* Reverted changes in version file

* Removed check for deprecated policy_statements

* Removed deprecated fields and refactored helper functions using those deprecated fields

* Removed ConflictsWith for the webhook ON schema since ENABLED no longer exists in the schema

* Fixed test cases

* Updated changelog, refactored getWebhookOn and updated the docs

* Updated version in example and added default config for webhook ON element

* Imiller/ch119137/make segment clause negate field optional (#136)

* make oiptional and default to false + update test

* add example segment config for 2.0

* this should be v2.0.0

* Do not require fallthrough and off_variation in ff_env data source (#142)

* added version to versions.tf file for webhook

* v2 for custom_role and destination. Update read me

* Change targets schema to set and add 'variation' attribute (#141)

* Revise targets schema

* update docs

* Make target values required

* Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

* Change List to Set in description

* remove debug_bin

Co-authored-by: Isabelle Miller <[email protected]>

* Imiller/ch115572/restructure default flag variations (#146)

* add new defaults to schema

* update tests to expected configs / outcomes

* add default on

* restructure defaultVariationsFromResourceData

* update test cases

* hitting a non-empty plan error in test

* ffs just needed to be Computed

* update tests

* update docs and changelog

* fix test

* lost a brace

* fix variation helper

* fix changelog

* small doc fixes (#147)

* remove enabled from destination docs

* update webhook doc

* update doc on name issue (#151)

* environment and data_source_webhook examples (#149)

* added more examples

* added comments

* Imiller/ch120560/feature flag maintainer id should be removed (#150)

* make computed and update tes

* update doc

* update changelog

* Imiller/ch119620/audit examples (#152)

* make separate v1 and v2 feature flag examples

* ensure v2 ff example works

* move some stuff around

* some more reorg

* more reorg

* update toc in readme

* update v2 feature flag readme

* Bug Fix: Revert optional env attributes to defaults (#148)

* Fixed and tests passing

* improve env update test

* default_ttl default, and create new test

* default_ttl should reset to 0

* update docs and changelog

Co-authored-by: Isabelle Miller <[email protected]>

* remove test examples shouldn't have been checked in

* add terraform version note to changelog

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>

* Fix import of launchdarkly_project nested environments (#153)

* start importing all environments

* Preserve environment order

* Update changelog

* Add ignore_changes to withRandomProject

* update doc (#154)

* Imiller/sc 119920/add boolean archive attribute to launchdarkly (#155)

* add archived to ff env schema

* make it a global property

* put it in the wrong schema doh

* attempt archive before deleting so we can return an error if there are dependencies

* prelim test

* some syntax issues

* gotta figure out error bit

* remove failing test

* forgot to set archived in read function

* actually no need to archive first

* Update index of docs with recommended version (#156)

* Update index of docs with recommended version

* Show how to configure the access token

* Imiller/sc 123568/add approval settings to environment resource (#157)

* prelim schema

* tweak approval schema

* draft conversion functions

* i forgot you can't use conflictswith with nested attributes

* a mess of things

* fixed up patches

* handle patch remove

* okay i think this should handle all cases

* unused transformation function since no setting

* forgot to handle most obvious case

* need to set but only sometimes

* min num approvals cannot exceed 5

* make min num approvals required

* project test

* fix helper function for project - first pass

* make entire approvals schema computed

* projet tests working

* NOW project tests working

* remove dead code

* update docs

* update changelog

* simplify approval helper function

* switch old and new afunc arguments

* Imiller/sc 126337/make can apply declined changes default to (#158)

* update error message

* change default in schema

* update tests

* update docs'

* update changelog

* clarify rollout weights (#159)

* Upgrade Terraform provider to use api-client-go 7 (#160)

* Start updating go client

* Continue updating resources

* feature flag resource

* feature flag resource test

* approval settings and custom role policies

* destination resource

* environment

* feature flag environment

* project

* segment

* team member

* webhook

* rule, segment rule, segments, and team member helpers

* variations helper

* data source tests

* webhooks helper

* resource tests

* variations helper test

* policy helpers and tests probably will all fail

* custom role and access token probably also broken

* policy statements helper update

* instantiate config prior to setting other values on it

* fix 401

* vendor v7

* update all imports to v7

* missed one

* fix nil pointer dereference

* instantiate with var instead of make to fix non-empty slice bu

* custom roles now complains if you try to set more than one of Role, InlineRole, or CustomRoleIds

* fix webhook statemetns

* webhook read check if statements are nil & webhook create only set secret if defined

* update changelog

* fix webhook data source tests

* new pointers in client FeatureFlagConfig breaking ff env data source tests

* fix negative expiry thing (apparently the api no longer handles it so we have to)

* move reset into helper function

* hackily handle token reset requests until client bug is fixed

* fix variation transformation - can no longer point to empty string

* fix notResource and notActions

* fix policy helper tests

* fix the weird empty string value in variations issue

* strip protocol from host if provided

* go mod tidy && vendor

* update all go packages

* clean up commentsg

* clean up comment

* Ffeldberg/sc 130551/add the ability to adjust the sdks using (#161)

* chore: first attempts

* feat: updating flag resources works, reading/creating plan is a bit iffy

* chore: clean up comments a bit

* chore: add TODO as reminder

* chore: add more todos

* chore: use ConflictsWith to ensure users dont use both includeInSnippet and clientSideAvailablity

* chore: pr feedback - update deprecation message, always read both sdk client values

* feat: set both includeInSnippet and clientSideAvailability to computed properties

* wip: attempt to use computed and update/create logic blocks

* add comment

* use getOk instead of getOkExists for nested, rename vars

* wip: use getOk instead of getOkExists for nested, test modified read

* temp: temporary test changes for local debugging

* chore: add some comments

* feat: working apart from switching back to deprecated option in edge case

* chore: remove commented out code

* fix: fix issue with read

* test: reset tests

* fix: fix typo in read

* fix: account for datasources in featureflag read

* test: add tests for clientSideAvailability changes

* docs: update example docs

* docs: add include_in_snippet to website docs and add deprecation notice

* docs: update docs

* chore: update CHANGELOG

* fix: fix most issues caused by go client v7 merge

* fix: fix other merge issues

* chore: update CHANGELOG

* chore: apply codereview keys suggestions

Co-authored-by: Isabelle Miller <[email protected]>

* chore: Update launchdarkly/feature_flags_helper.go

keys

Co-authored-by: Isabelle Miller <[email protected]>

* chore: update keys.go to reflect clientsideavailablity keys

* chore: go fmt

* test: add tests for switching between CSA and IIS, clean up

* chore: go fmt

* test: remove pure create tests

* chore: add TODOs where required

* test: add new test case for reverting to default CSA

* feat: set clientSideAvailability according to project defaults for flags

* test: update tests accordingly and add comments

* chore: fmt

* refactor project default get into its own function

* test: account for default project CSA settings

* feat: basic working implementation of resetting to defaults using customizeDiff

* feat: attempted changes to customdiff to support CSA

* chore: clean up flag resource read

* chore: clean up comments and todos

* docs: update docs to mention project level defaults for flag sdk settings

* chore: remove prints to clean up test logs

* chore: go mod vendor

* chore: Update CHANGELOG.md

Co-authored-by: Isabelle Miller <[email protected]>

* chore: address pr feedback

* docs: update changelog

Co-authored-by: Isabelle Miller <[email protected]>

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Fabian <[email protected]>

* 2.2.0

Co-authored-by: Isabelle Miller <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>

* prepare 2.3.0 release (#76)

Co-authored-by: Isabelle Miller <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>
Co-authored-by: Fabian <[email protected]>

* Prepare 2.4.0 release (#77)

* Update CHANGELOG.md

fix error in changelog

* Imiller/ch117193/rename flag_fallthrough to fallthrough & user_targets to targets (#131)

* add fallthrough and deprecate message to flag_fallthrough

* update doc

* conflicts with

* handle

* update a test

* update changelog

* fix typos in docs

* add targets attribute

* fix linter complaint

* handle in create

* update

* handle read

* update commetn

* update tests

* hack remove user_targets from plan

* set both computed attributes in read

* update changelog

* always set

* simplify helper

* fix data source test

* add test for deprecated field updates

* fix fromResourceData functions

* check renamed on as well

* Update data source d oc

* update data source tests

* Imiller/ch117375/GitHub issue empty string variation (#135)

* should fix it

* add test case

* update changelog and doc

* Fix duplicate text in CHANGELOG.md

Somehow the changelog test was duplicated. Removing, and we can fix the changelog on our next release.

* V2 main (#128)

* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch115579/fix include in snippet bug (#129)

* all it needed was a default val

* add test to ensure optional attributes get set correctly when removed

* fix test

* use TestCheckNoResourceAttr instead of TestCheckResourceAttr

* update changelog

* Imiller/ch113419/upgrade terraform client to v2 (#114)

* run v2 helper

* replace hashcode.String() with schema.HashString()

* replace terraform.ResourceProvider with *schema.Provider

* fix data source TypeMaps

* bump v2 sdk to latest (#116)

* merge

* Remove versions.tf (#119)

* Imiller/ch114162/upgrade resource launchdarkly environment (#121)

* make project_key required

* update descriptions

* update changelog

* Imiller/ch114165/v1 project audit (#120)

* add descriptions

* update doc dscription

* audit team member for v1 (#122)

* update descriptions

* add import instructions to team member docs

* add team member examples

* ForceNew when email is updated

* update test file structure to better reflect provider pattern

* add AtLeastOneOf for role and custom_roles

* oops wrong doc

* use validation.StringInSlice()

* refactor key conversion functions into helper file

* remove owner

* forgot changelog

* Imiller/ch114163/v1 feature flag env (#112)

* add descriptions for everything

* fix dangling default values

* fix bug where creating a non-bool flag with no variations creates a bool flag

* add bug fixes to changelog

* built in an idiotic bug, fixed now

* see if this fixes all of the tests

* found typo:

* fix broken tests

* add descriptions

* update some descriptions for clarity

* make clauses RequiredWith on variations to preempt api error

* fix error in doc

* fix docs properly

* deprecated targeting_enabled in favor of on

* remove ReuqiredWith because it's causing a bug

* fix plan bug

* hopefully this will fix it

* ughhhhh it was that it needed to be computed

* forgot the doc oops

* forgot the changelog too meep

* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch114160/v1 custom role (#125)

* add descriptions

* reformat tests to match pattern

* check removal of optional attributes removes

* holy crap how did this not break earlier

* not sure how that one stuck around either

* somehow we were not actually setting the flag_id

* fix feature flag read

* fix csa on project read

* apparently errors are different too

* remove lingering merge conflict text from changelog

* fix noMatchReturnsError errors

* remove hash indices on type set

* remove hash function for custom role policy

* fix destination tests

* fix feature flag tests

* fix env tests

* fix project tests

* fix segment tests

* fix segment tests and remove unused testAccTagKey function

* revert computed

* define CSA inline

* update changelog

* remove MaxItems property from data sources

* fix forProject

Co-authored-by: Henry Barrow <[email protected]>

* Imiller/ch115576/revert feature flag env optional attributes (#130)

* remove deprecated attribute targeting_enabled (replaced by on)

* on should default to false when removed

* forgot to fix data source tests

* fix test to handle on reversion

* make rules not computed

* make user_targets not computed

* update comments

* finally got fallthrough working

* fix test

* clarify

* fix more tests

* remove deprecated user_targets and flag_fallthrough from schema

* update read

* revert helpers

* update create

* update tests

* update example

* update doc

* remove deprecated fields from keys

* update changelog

* fix fallthrough and fix test

* update changelog

* missed a bit on the docs'

* make prerequisite not computed

* udate changelog again

* add test case for removing prereqs

* update flag_id description for clarity

* add defaults for optional fields

* update test again

* update changelog again

* handle off_variation defaults

* fix data source test

* have to use GetOkExists instead of GetOk to be able to set 0 off_variation on create

* remove commented-out code

* Imiller/ch115576/make fallthrough off variation required (#134)

* make required in schemas

* fix some test configs

* add required attributes to rest of tests. tests all failing

* always set both on read

* no need to check if fallthrough not set because tf will enforce

* update CRU functions

* fix data source tests

* update changelog and docs for new required attributes

* remove comment no longer applicable

* fix typo

* remove `enabled` on webhooks

* removed `policy_statements` on webhooks

* removed `targeting_enabled` on feature flag environment

* update change log

* Change schema function to use recommended one.

* Imiller/ch119139/make env configs required on project resource (#137)

* make required

* delete envs that were previously in state and have been removed

* remove redundant test & add required envs

* ImportSTateVerifyIgnore envs

* update docs

* move full_config example into v1_full_config

* add v2 full config

* update example

* update test project scaffolding function

* change State to StateContext function

* update comment

* fix destination test bug

* add test case for when we fix env defaults

* add note to import about envs

* update changelog

* remove debug bin

* add debug_bin to gitignore

* address pr comments by adding back stuff to docs

* update all example versions to 1.7

* Added logic to delete remote webhook statements when statements block… (#133)

* Added logic to delete remote webhook statements when statements block is removed

* refactored tests

* Added has changes check around the webhook policy statements

* Reverted changes in version file

* Removed check for deprecated policy_statements

* Removed deprecated fields and refactored helper functions using those deprecated fields

* Removed ConflictsWith for the webhook ON schema since ENABLED no longer exists in the schema

* Fixed test cases

* Updated changelog, refactored getWebhookOn and updated the docs

* Updated version in example and added default config for webhook ON element

* Imiller/ch119137/make segment clause negate field optional (#136)

* make oiptional and default to false + update test

* add example segment config for 2.0

* this should be v2.0.0

* Do not require fallthrough and off_variation in ff_env data source (#142)

* added version to versions.tf file for webhook

* v2 for custom_role and destination. Update read me

* Change targets schema to set and add 'variation' attribute (#141)

* Revise targets schema

* update docs

* Make target values required

* Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

* Change List to Set in description

* remove debug_bin

Co-authored-by: Isabelle Miller <[email protected]>

* Imiller/ch115572/restructure default flag variations (#146)

* add new defaults to schema

* update tests to expected configs / outcomes

* add default on

* restructure defaultVariationsFromResourceData

* update test cases

* hitting a non-empty plan error in test

* ffs just needed to be Computed

* update tests

* update docs and changelog

* fix test

* lost a brace

* fix variation helper

* fix changelog

* small doc fixes (#147)

* remove enabled from destination docs

* update webhook doc

* update doc on name issue (#151)

* environment and data_source_webhook examples (#149)

* added more examples

* added comments

* Imiller/ch120560/feature flag maintainer id should be removed (#150)

* make computed and update tes

* update doc

* update changelog

* Imiller/ch119620/audit examples (#152)

* make separate v1 and v2 feature flag examples

* ensure v2 ff example works

* move some stuff around

* some more reorg

* more reorg

* update toc in readme

* update v2 feature flag readme

* Bug Fix: Revert optional env attributes to defaults (#148)

* Fixed and tests passing

* improve env update test

* default_ttl default, and create new test

* default_ttl should reset to 0

* update docs and changelog

Co-authored-by: Isabelle Miller <[email protected]>

* remove test examples shouldn't have been checked in

* add terraform version note to changelog

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>

* Fix import of launchdarkly_project nested environments (#153)

* start importing all environments

* Preserve environment order

* Update changelog

* Add ignore_changes to withRandomProject

* update doc (#154)

* Imiller/sc 119920/add boolean archive attribute to launchdarkly (#155)

* add archived to ff env schema

* make it a global property

* put it in the wrong schema doh

* attempt archive before deleting so we can return an error if there are dependencies

* prelim test

* some syntax issues

* gotta figure out error bit

* remove failing test

* forgot to set archived in read function

* actually no need to archive first

* Update index of docs with recommended version (#156)

* Update index of docs with recommended version

* Show how to configure the access token

* Imiller/sc 123568/add approval settings to environment resource (#157)

* prelim schema

* tweak approval schema

* draft conversion functions

* i forgot you can't use conflictswith with nested attributes

* a mess of things

* fixed up patches

* handle patch remove

* okay i think this should handle all cases

* unused transformation function since no setting

* forgot to handle most obvious case

* need to set but only sometimes

* min num approvals cannot exceed 5

* make min num approvals required

* project test

* fix helper function for project - first pass

* make entire approvals schema computed

* projet tests working

* NOW project tests working

* remove dead code

* update docs

* update changelog

* simplify approval helper function

* switch old and new afunc arguments

* Imiller/sc 126337/make can apply declined changes default to (#158)

* update error message

* change default in schema

* update tests

* update docs'

* update changelog

* clarify rollout weights (#159)

* Upgrade Terraform provider to use api-client-go 7 (#160)

* Start updating go client

* Continue updating resources

* feature flag resource

* feature flag resource test

* approval settings and custom role policies

* destination resource

* environment

* feature flag environment

* project

* segment

* team member

* webhook

* rule, segment rule, segments, and team member helpers

* variations helper

* data source tests

* webhooks helper

* resource tests

* variations helper test

* policy helpers and tests probably will all fail

* custom role and access token probably also broken

* policy statements helper update

* instantiate config prior to setting other values on it

* fix 401

* vendor v7

* update all imports to v7

* missed one

* fix nil pointer dereference

* instantiate with var instead of make to fix non-empty slice bu

* custom roles now complains if you try to set more than one of Role, InlineRole, or CustomRoleIds

* fix webhook statemetns

* webhook read check if statements are nil & webhook create only set secret if defined

* update changelog

* fix webhook data source tests

* new pointers in client FeatureFlagConfig breaking ff env data source tests

* fix negative expiry thing (apparently the api no longer handles it so we have to)

* move reset into helper function

* hackily handle token reset requests until client bug is fixed

* fix variation transformation - can no longer point to empty string

* fix notResource and notActions

* fix policy helper tests

* fix the weird empty string value in variations issue

* strip protocol from host if provided

* go mod tidy && vendor

* update all go packages

* clean up commentsg

* clean up comment

* Ffeldberg/sc 130551/add the ability to adjust the sdks using (#161)

* chore: first attempts

* feat: updating flag resources works, reading/creating plan is a bit iffy

* chore: clean up comments a bit

* chore: add TODO as reminder

* chore: add more todos

* chore: use ConflictsWith to ensure users dont use both includeInSnippet and clientSideAvailablity

* chore: pr feedback - update deprecation message, always read both sdk client values

* feat: set both includeInSnippet and clientSideAvailability to computed properties

* wip: attempt to use computed and update/create logic blocks

* add comment

* use getOk instead of getOkExists for nested, rename vars

* wip: use getOk instead of getOkExists for nested, test modified read

* temp: temporary test changes for local debugging

* chore: add some comments

* feat: working apart from switching back to deprecated option in edge case

* chore: remove commented out code

* fix: fix issue with read

* test: reset tests

* fix: fix typo in read

* fix: account for datasources in featureflag read

* test: add tests for clientSideAvailability changes

* docs: update example docs

* docs: add include_in_snippet to website docs and add deprecation notice

* docs: update docs

* chore: update CHANGELOG

* fix: fix most issues caused by go client v7 merge

* fix: fix other merge issues

* chore: update CHANGELOG

* chore: apply codereview keys suggestions

Co-authored-by: Isabelle Miller <[email protected]>

* chore: Update launchdarkly/feature_flags_helper.go

keys

Co-authored-by: Isabelle Miller <[email protected]>

* chore: update keys.go to reflect clientsideavailablity keys

* chore: go fmt

* test: add tests for switching between CSA and IIS, clean up

* chore: go fmt

* test: remove pure create tests

* chore: add TODOs where required

* test: add new test case for reverting to default CSA

* feat: set clientSideAvailability according to project defaults for flags

* test: update tests accordingly and add comments

* chore: fmt

* refactor project default get into its own function

* test: account for default project CSA settings

* feat: basic working implementation of resetting to defaults using customizeDiff

* feat: attempted changes to customdiff to support CSA

* chore: clean up flag resource read

* chore: clean up comments and todos

* docs: update docs to mention project level defaults for flag sdk settings

* chore: remove prints to clean up test logs

* chore: go mod vendor

* chore: Update CHANGELOG.md

Co-authored-by: Isabelle Miller <[email protected]>

* chore: address pr feedback

* docs: update changelog

Co-authored-by: Isabelle Miller <[email protected]>

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Fabian <[email protected]>

* prepare 2.2.0 release (#75) (#162)

* Update CHANGELOG.md

fix error in changelog

* Imiller/ch117193/rename flag_fallthrough to fallthrough & user_targets to targets (#131)

* add fallthrough and deprecate message to flag_fallthrough

* update doc

* conflicts with

* handle

* update a test

* update changelog

* fix typos in docs

* add targets attribute

* fix linter complaint

* handle in create

* update

* handle read

* update commetn

* update tests

* hack remove user_targets from plan

* set both computed attributes in read

* update changelog

* always set

* simplify helper

* fix data source test

* add test for deprecated field updates

* fix fromResourceData functions

* check renamed on as well

* Update data source d oc

* update data source tests

* Imiller/ch117375/GitHub issue empty string variation (#135)

* should fix it

* add test case

* update changelog and doc

* Fix duplicate text in CHANGELOG.md

Somehow the changelog test was duplicated. Removing, and we can fix the changelog on our next release.

* V2 main (#128)

* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch115579/fix include in snippet bug (#129)

* all it needed was a default val

* add test to ensure optional attributes get set correctly when removed

* fix test

* use TestCheckNoResourceAttr instead of TestCheckResourceAttr

* update changelog

* Imiller/ch113419/upgrade terraform client to v2 (#114)

* run v2 helper

* replace hashcode.String() with schema.HashString()

* replace terraform.ResourceProvider with *schema.Provider

* fix data source TypeMaps

* bump v2 sdk to latest (#116)

* merge

* Remove versions.tf (#119)

* Imiller/ch114162/upgrade resource launchdarkly environment (#121)

* make project_key required

* update descriptions

* update changelog

* Imiller/ch114165/v1 project audit (#120)

* add descriptions

* update doc dscription

* audit team member for v1 (#122)

* update descriptions

* add import instructions to team member docs

* add team member examples

* ForceNew when email is updated

* update test file structure to better reflect provider pattern

* add AtLeastOneOf for role and custom_roles

* oops wrong doc

* use validation.StringInSlice()

* refactor key conversion functions into helper file

* remove owner

* forgot changelog

* Imiller/ch114163/v1 feature flag env (#112)

* add descriptions for everything

* fix dangling default values

* fix bug where creating a non-bool flag with no variations creates a bool flag

* add bug fixes to changelog

* built in an idiotic bug, fixed now

* see if this fixes all of the tests

* found typo:

* fix broken tests

* add descriptions

* update some descriptions for clarity

* make clauses RequiredWith on variations to preempt api error

* fix error in doc

* fix docs properly

* deprecated targeting_enabled in favor of on

* remove ReuqiredWith because it's causing a bug

* fix plan bug

* hopefully this will fix it

* ughhhhh it was that it needed to be computed

* forgot the doc oops

* forgot the changelog too meep

* destination on should default to false (v2) (#124)

* remove enabled

* test that on defaults to false when removed

* Imiller/ch114160/v1 custom role (#125)

* add descriptions

* reformat tests to match pattern

* check removal of optional attributes removes

* holy crap how did this not break earlier

* not sure how that one stuck around either

* somehow we were not actually setting the flag_id

* fix feature flag read

* fix csa on project read

* apparently errors are different too

* remove lingering merge conflict text from changelog

* fix noMatchReturnsError errors

* remove hash indices on type set

* remove hash function for custom role policy

* fix destination tests

* fix feature flag tests

* fix env tests

* fix project tests

* fix segment tests

* fix segment tests and remove unused testAccTagKey function

* revert computed

* define CSA inline

* update changelog

* remove MaxItems property from data sources

* fix forProject

Co-authored-by: Henry Barrow <[email protected]>

* Imiller/ch115576/revert feature flag env optional attributes (#130)

* remove deprecated attribute targeting_enabled (replaced by on)

* on should default to false when removed

* forgot to fix data source tests

* fix test to handle on reversion

* make rules not computed

* make user_targets not computed

* update comments

* finally got fallthrough working

* fix test

* clarify

* fix more tests

* remove deprecated user_targets and flag_fallthrough from schema

* update read

* revert helpers

* update create

* update tests

* update example

* update doc

* remove deprecated fields from keys

* update changelog

* fix fallthrough and fix test

* update changelog

* missed a bit on the docs'

* make prerequisite not computed

* udate changelog again

* add test case for removing prereqs

* update flag_id description for clarity

* add defaults for optional fields

* update test again

* update changelog again

* handle off_variation defaults

* fix data source test

* have to use GetOkExists instead of GetOk to be able to set 0 off_variation on create

* remove commented-out code

* Imiller/ch115576/make fallthrough off variation required (#134)

* make required in schemas

* fix some test configs

* add required attributes to rest of tests. tests all failing

* always set both on read

* no need to check if fallthrough not set because tf will enforce

* update CRU functions

* fix data source tests

* update changelog and docs for new required attributes

* remove comment no longer applicable

* fix typo

* remove `enabled` on webhooks

* removed `policy_statements` on webhooks

* removed `targeting_enabled` on feature flag environment

* update change log

* Change schema function to use recommended one.

* Imiller/ch119139/make env configs required on project resource (#137)

* make required

* delete envs that were previously in state and have been removed

* remove redundant test & add required envs

* ImportSTateVerifyIgnore envs

* update docs

* move full_config example into v1_full_config

* add v2 full config

* update example

* update test project scaffolding function

* change State to StateContext function

* update comment

* fix destination test bug

* add test case for when we fix env defaults

* add note to import about envs

* update changelog

* remove debug bin

* add debug_bin to gitignore

* address pr comments by adding back stuff to docs

* update all example versions to 1.7

* Added logic to delete remote webhook statements when statements block… (#133)

* Added logic to delete remote webhook statements when statements block is removed

* refactored tests

* Added has changes check around the webhook policy statements

* Reverted changes in version file

* Removed check for deprecated policy_statements

* Removed deprecated fields and refactored helper functions using those deprecated fields

* Removed ConflictsWith for the webhook ON schema since ENABLED no longer exists in the schema

* Fixed test cases

* Updated changelog, refactored getWebhookOn and updated the docs

* Updated version in example and added default config for webhook ON element

* Imiller/ch119137/make segment clause negate field optional (#136)

* make oiptional and default to false + update test

* add example segment config for 2.0

* this should be v2.0.0

* Do not require fallthrough and off_variation in ff_env data source (#142)

* added version to versions.tf file for webhook

* v2 for custom_role and destination. Update read me

* Change targets schema to set and add 'variation' attribute (#141)

* Revise targets schema

* update docs

* Make target values required

* Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

* Change List to Set in description

* remove debug_bin

Co-authored-by: Isabelle Miller <[email protected]>

* Imiller/ch115572/restructure default flag variations (#146)

* add new defaults to schema

* update tests to expected configs / outcomes

* add default on

* restructure defaultVariationsFromResourceData

* update test cases

* hitting a non-empty plan error in test

* ffs just needed to be Computed

* update tests

* update docs and changelog

* fix test

* lost a brace

* fix variation helper

* fix changelog

* small doc fixes (#147)

* remove enabled from destination docs

* update webhook doc

* update doc on name issue (#151)

* environment and data_source_webhook examples (#149)

* added more examples

* added comments

* Imiller/ch120560/feature flag maintainer id should be removed (#150)

* make computed and update tes

* update doc

* update changelog

* Imiller/ch119620/audit examples (#152)

* make separate v1 and v2 feature flag examples

* ensure v2 ff example works

* move some stuff around

* some more reorg

* more reorg

* update toc in readme

* update v2 feature flag readme

* Bug Fix: Revert optional env attributes to defaults (#148)

* Fixed and tests passing

* improve env update test

* default_ttl default, and create new test

* default_ttl should reset to 0

* update docs and changelog

Co-authored-by: Isabelle Miller <[email protected]>

* remove test examples shouldn't have been checked in

* add terraform version note to changelog

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>

* Fix import of launchdarkly_project nested environments (#153)

* start importing all environments

* Preserve environment order

* Update changelog

* Add ignore_changes to withRandomProject

* update doc (#154)

* Imiller/sc 119920/add boolean archive attribute to launchdarkly (#155)

* add archived to ff env schema

* make it a global property

* put it in the wrong schema doh

* attempt archive before deleting so we can return an error if there are dependencies

* prelim test

* some syntax issues

* gotta figure out error bit

* remove failing test

* forgot to set archived in read function

* actually no need to archive first

* Update index of docs with recommended version (#156)

* Update index of docs with recommended version

* Show how to configure the access token

* Imiller/sc 123568/add approval settings to environment resource (#157)

* prelim schema

* tweak approval schema

* draft conversion functions

* i forgot you can't use conflictswith with nested attributes

* a mess of things

* fixed up patches

* handle patch remove

* okay i think this should handle all cases

* unused transformation function since no setting

* forgot to handle most obvious case

* need to set but only sometimes

* min num approvals cannot exceed 5

* make min num approvals required

* project test

* fix helper function for project - first pass

* make entire approvals schema computed

* projet tests working

* NOW project tests working

* remove dead code

* update docs

* update changelog

* simplify approval helper function

* switch old and new afunc arguments

* Imiller/sc 126337/make can apply declined changes default to (#158)

* update error message

* change default in schema

* update tests

* update docs'

* update changelog

* clarify rollout weights (#159)

* Upgrade Terraform provider to use api-client-go 7 (#160)

* Start updating go client

* Continue updating resources

* feature flag resource

* feature flag resource test

* approval settings and custom role policies

* destination resource

* environment

* feature flag environment

* project

* segment

* team member

* webhook

* rule, segment rule, segments, and team member helpers

* variations helper

* data source tests

* webhooks helper

* resource tests

* variations helper test

* policy helpers and tests probably will all fail

* custom role and access token probably also broken

* policy statements helper update

* instantiate config prior to setting other values on it

* fix 401

* vendor v7

* update all imports to v7

* missed one

* fix nil pointer dereference

* instantiate with var instead of make to fix non-empty slice bu

* custom roles now complains if you try to set more than one of Role, InlineRole, or CustomRoleIds

* fix webhook statemetns

* webhook read check if statements are nil & webhook create only set secret if defined

* update changelog

* fix webhook data source tests

* new pointers in client FeatureFlagConfig breaking ff env data source tests

* fix negative expiry thing (apparently the api no longer handles it so we have to)

* move reset into helper function

* hackily handle token reset requests until client bug is fixed

* fix variation transformation - can no longer point to empty string

* fix notResource and notActions

* fix policy helper tests

* fix the weird empty string value in variations issue

* strip protocol from host if provided

* go mod tidy && vendor

* update all go packages

* clean up commentsg

* clean up comment

* Ffeldberg/sc 130551/add the ability to adjust the sdks using (#161)

* chore: first attempts

* feat: updating flag resources works, reading/creating plan is a bit iffy

* chore: clean up comments a bit

* chore: add TODO as reminder

* chore: add more todos

* chore: use ConflictsWith to ensure users dont use both includeInSnippet and clientSideAvailablity

* chore: pr feedback - update deprecation message, always read both sdk client values

* feat: set both includeInSnippet and clientSideAvailability to computed properties

* wip: attempt to use computed and update/create logic blocks

* add comment

* use getOk instead of getOkExists for nested, rename vars

* wip: use getOk instead of getOkExists for nested, test modified read

* temp: temporary test changes for local debugging

* chore: add some comments

* feat: working apart from switching back to deprecated option in edge case

* chore: remove commented out code

* fix: fix issue with read

* test: reset tests

* fix: fix typo in read

* fix: account for datasources in featureflag read

* test: add tests for clientSideAvailability changes

* docs: update example docs

* docs: add include_in_snippet to website docs and add deprecation notice

* docs: update docs

* chore: update CHANGELOG

* fix: fix most issues caused by go client v7 merge

* fix: fix other merge issues

* chore: update CHANGELOG

* chore: apply codereview keys suggestions

Co-authored-by: Isabelle Miller <[email protected]>

* chore: Update launchdarkly/feature_flags_helper.go

keys

Co-authored-by: Isabelle Miller <[email protected]>

* chore: update keys.go to reflect clientsideavailablity keys

* chore: go fmt

* test: add tests for switching between CSA and IIS, clean up

* chore: go fmt

* test: remove pure create tests

* chore: add TODOs where required

* test: add new test case for reverting to default CSA

* feat: set clientSideAvailability according to project defaults for flags

* test: update tests accordingly and add comments

* chore: fmt

* refactor project default get into its own function

* test: account for default project CSA settings

* feat: basic working implementation of resetting to defaults using customizeDiff

* feat: attempted changes to customdiff to support CSA

* chore: clean up flag resource read

* chore: clean up comments and todos

* docs: update docs to mention project level defaults for flag sdk settings

* chore: remove prints to clean up test logs

* chore: go mod vendor

* chore: Update CHANGELOG.md

Co-authored-by: Isabelle Miller <[email protected]>

* chore: address pr feedback

* docs: update changelog

Co-authored-by: Isabelle Miller <[email protected]>

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Fabian <[email protected]>

* 2.2.0

Co-authored-by: Isabelle Miller <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>

Co-authored-by: Isabelle Miller <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>

* [SC-135367] Project resource should support default flag SDK values (#166)

* chore: update project resource schema

* chore: add new keys to keys.go

* feat: most situations working for plan/apply

* feat: use customizeDiff to account for resetting default sdk values 

One slight discrepancy left - switching from using defaultClientSideAvailability to not using the attribute applies the correct changes, but ONLY shows changes to includeInSnippetByDefault in the plan, NOT changes to defaultClientSideAvailability (if applicable)

* test: add tests for project changes

* docs: update docs to reflect changes

* docs: update changelog

* chore: account for changes to project dataSource

* fix: only set include_in_snippet for non data source projects

* chore: make default_csa nested fields required

* chore: deprecate data source attr client_side_availability but maintain support

* docs: update docs and changelog

* docs: update project resource docs according to suggestions

Co-authored-by: Henry Barrow <[email protected]>

* chore: only set datasource deprecated attribute on ds reads

* docs: Apply suggestions from code review

Co-authored-by: Henry Barrow <[email protected]>

Co-authored-by: Henry Barrow <[email protected]>

* Fix nil pointer dereference when reading empty approval settings (#169)

* Fix nil approval settings bug and clean up circleci config.yml

* Update Changelog

* Backmerge v2.3.0 (#170)

* Imiller/sc 136707/streamline tests to use key constants where (#172)

* update data source tests

* add a pre-commit to alphabetize the keys

* resources

* changelog

* Added validation to project key length

* Added rate limit and conflict retry logic to LD client (#171)

* Added rate limit and conflicts retry logic to LD client

* Removed occurences of handleRateLimit and handleConflicts from the codebase since both logic has been replaced by go-retyable

* Used retryable client for the fallbackClient, fixed a header bug in the unit tests and added jitter to sleep value for 429s

Co-authored-by: Henry Barrow <[email protected]>

* Add golangci-lint pre-commit hook and run hooks in CI (#175)

* Ffeldberg/sc 136452/use the context aware version of all crud (#174)

* chore: refactor resource CRUD funcs to be ctx aware

* feat: convert validation helpers to context aware funcs

* feat: convert inline validation to diag aware func

* chore: apply ToDiagFunc wrapper to other custom validators

* fix: TypeList validators cant use ToDiagFunc

* fix: TypeSett validators cant use ToDiagFunc

* add integration resource (#164)

* stub integration resource

* dump json of audit log configs to file

* this should theoretically work

* rename to launchdarkly_audit_log_subscription

* add required to policy options - must be true for audit log subs

* actually never mind i have decided on a better way to deal with it

* set default statements and update tests

* ehhh screw it we're making statements required since the api errors if not passed

* ensure error if config is wrongly set

* clean up comments

* refactor for data source and add tests - not sure why failing

* integration key must be required to get duh

* finally fixed that

* add resource doc

* more docs

* handle casing

* handle bool types

* update data source tests to use examples more likely to break

* small docs update

* update changelog

* forgot to mention data source in changelog

* add to the development doc

* add strcase to go.mod

* use const attributes for tests

* update go client

* forgot to update circle config

* add pre commit to run python script for audit log sub configs

* remove old handleRateLimit functions

* udpate doc

* bug fix

* handle optional defaults

* error if error reading json config file

* use go struct

* make on required

* add examples

* use context-aware functions

* update doc to say on is required

* define optional for data source

* fix host issue

* update doc

* small refactor

* add new line

Co-authored-by: Fabian <[email protected]>

* return diag not nil from delete function

* typo

Co-authored-by: Fabian <[email protected]>

* Add relay proxy config resource (#168)

* [sc 137274] add team members data source (#177)

* chore: refactor getTeamMember to actually query instead of list

* refactor: change teamMember schema to function for reusability and add optional ID

* feat: add new data source and related keys

* test: add tests for new datasource

* docs: add documentation and update changelog

* chore: change query logic to filter members in code

* Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

Co-authored-by: Isabelle Miller <[email protected]>

* add flag triggers resource and data source (#163)

* Start updating go client

* Continue updating resources

* feature flag resource

* feature flag resource test

* approval settings and custom role policies

* destination resource

* environment

* feature flag environment

* project

* segment

* team member

* webhook

* rule, segment rule, segments, and team member helpers

* variations helper

* data source tests

* webhooks helper

* resource tests

* variations helper test

* policy helpers and tests probably will all fail

* custom role and access token probably also broken

* policy statements helper update

* instantiate config prior to setting other values on it

* fix 401

* vendor v7

* update all imports to v7

* missed one

* fix nil pointer dereference

* instantiate with var instead of make to fix non-empty slice bu

* custom roles now complains if you try to set more than one of Role, InlineRole, or CustomRoleIds

* fix webhook statemetns

* webhook read check if statements are nil & webhook create only set secret if defined

* update changelog

* fix webhook data source tests

* new pointers in client FeatureFlagConfig breaking ff env data source tests

* fix negative expiry thing (apparently the api no longer handles it so we have to)

* move reset into helper function

* hackily handle token reset requests until client bug is fixed

* fix variation transformation - can no longer point to empty string

* fix notResource and notActions

* fix policy helper tests

* fix the weird empty string value in variations issue

* strip protocol from host if provided

* go mod tidy && vendor

* update all go packages

* clean up commentsg

* stub resource functions

* stub schema

* define instructions

* theoretical create function

* stub update

* stub helper

* update schema

* refactor schema for data source

* not sure if this is the best way to do IDs or not yet

* trying compound IDs

* set proj env flag keys in read

* theoretically handle enabled

* ehhhh useless helper function

* add test, update instructionsFromResourceData

* feat: add enabled update call in create trigger lifecycle

* test works with fixed client

* set url prior to update

* get update working

* iron out some bugs

* update some descriptions

* add flag exist chec to tests

* data source test

* fix if not found error

* failing test

* handle IDs for data source

* clean up comments

* Resource doc

* finalize docs

* update changelog

* typo in changelog

* use consts for test attributes

* make trigger_url sensiive

* update go client

* update circle config

* mae enabled required

* add notes about enterprise feature and sensitive trigger url data to docs

* fix IDs

* add examples

* make context aware

* forgot to add website links

Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Fabian Feldberg <[email protected]>

* typo

* [sc 136319] add launchdarkly metric (#167)

* feat: first draft of metrics Schema and crud function stubs

* chore: adjust read to match existing patterns

* chore: add data source metric scaffolding

* chore: first attempt at custom URLs reader for metrics

* feat: first attempts at create

* feat: first attempt at read

* chore: add new resource and ds to provider

* feat: create and read working (with small issues)

* feat: add delete

* feat: basic update working

* test: add basic create test to metric resource

* test: add basic tests for metric data source

* test: simplify error check

* chore: small steps towards success_criteria

* chore: use customizeDiff to validate multiple dependant attributes

* chore: small comments

* chore: clean up validation of attributes

* docs: add starter for metric resource docs and sidebar links

* docs: update data_source docs

* chore: cleanup comments etc

* feat: validate urls blocks for metrics

* fix: fix typo

* chore: remove logs

* chore: move urls validation helper to helpers, adjust logic for successCriteria on create

* chore: tidy up

* test: use KEYS in tests where possible

* test: update test to check two url values

* chore: Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

* chore: remove periods for consintency

* chore: Apply suggestions from code review

Co-authored-by: Isabelle Miller <[email protected]>

* chore: error consitency

* docs: update link in docs

* test: add extra test for metric update

* chore: update changelog

* feat: bump api client version and start passing successCriteria on creation

* chore: alphabetise keys.go

* chore: alphabetise keys.go

* test: add metric tests to circleci config

* fix: account for changes to client

* docs: add examples for metrics

* docs: correct URL format in example

* chore: remove ID field from data source, make non key fields optional

* chore: make non key fields optional

* docs: fix changelog after merges

* Update CHANGELOG.md

Co-authored-by: Isabelle Miller <[email protected]>

* Update launchdarkly/metrics_helper.go

Co-authored-by: Isabelle Miller <[email protected]>

* chore: use ToDiagFunc helper

* chore: cleaner diag error return

* test: adjust expected error

Co-authored-by: Isabelle Miller <[email protected]>

* [sc 137802] emails need to be url escaped when querying (#178)

* fix: url escape member emails when querying

* test: update tests to ensure we also use an escapable char (+)

* Ffeldberg/sc 136454/use configurecontextfunc instead of configurefunc (#176)

* feat: make providerConfigure context aware

* fix: fix typo

* WIP: attempt to pass in context to NewClient (breaks everything)

* Revert "WIP: attempt to pass in context to NewClient (breaks everything)"

This reverts commit 09a082042bb0fe3e09db62544683b1a559b804e9.

* Imiller/sc 137617/tf doc improvements (#180)

* specfy location of relay proxy id

* integationKey should be forcenew

* specify force new in docs

* add missing notes about enterprise plans

* Ffeldberg/sc 137794/escalation terraform provider throws error (#179)

* chore: bump go client version

* fix: update to account for new go client version

* todo: add debugging comment

* chore: update policy_statement Schema to use conflictswith

* revert schema changes with conflictswith.. not possible https://github.com/hashicorp/terraform-plugin-sdk/issues/71

* fix: add resources/notresources and actions/notactions as required

* test: add not_resource and not_actions tests

* fix: fix the hashing for pointers in subfields

* fix unit tests and update auditlog config through hook

* Clean up policy statements helper functions (#182)

* Clean up policy statements helper functions

* Fix nil return bug

* Add relay proxy config data source (#183)

Co-authored-by: Isabelle Miller <[email protected]>

Co-authored-by: Isabelle Miller <[email protected]>

* Remove unnecessary attributes from  metric data source test config (#184)

* prepare release

Co-authored-by: Sunny <[email protected]>
Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>
Co-authored-by: Fabian <[email protected]>
Co-authored-by: Clifford Tawiah <[email protected]>
Co-authored-by: Fabian Feldberg <[email protected]>

* merge issues

* weird merge issue

* this got rolled in again somehow

Co-authored-by: Fabian <[email protected]>
Co-authored-by: Sunny <[email protected]>
Co-authored-by: Henry Barrow <[email protected]>
Co-authored-by: Cliff Tawiah <[email protected]>
Co-authored-by: Clifford Tawiah <[email protected]>
Co-authored-by: Fabian Feldberg <[email protected]>
@ldhenry ldhenry deleted the release-2.2.0 branch July 28, 2022 10:05
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