Skip to content

Commit

Permalink
Prepare 2.4.0 release (#77)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
7 people authored Jan 19, 2022
1 parent 8c7d0fc commit c92dede
Show file tree
Hide file tree
Showing 121 changed files with 6,142 additions and 1,631 deletions.
37 changes: 31 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@ version: 2.1

orbs:
go: circleci/[email protected]
linter: talkiq/[email protected]

jobs:
build:
test:
executor:
name: go/default
tag: "1.16"
tag: &go_version "1.16.10"

steps:
- checkout
- go/mod-download-cached
- run:
name: go vet
command: make vet
- run:
name: Run unit tests
command: TESTARGS="-v" make test
Expand All @@ -25,6 +23,9 @@ jobs:
- run:
name: Test Access Token Resource
command: TESTARGS="-run TestAccAccessToken" make testacc
- run:
name: Test Audit Log Subscription Resource
command: TESTARGS="-run TestAccAuditLogSubscription" make testacc
- run:
name: Test Custom Role Resource
command: TESTARGS="-run TestAccCustomRole" make testacc
Expand All @@ -40,9 +41,18 @@ jobs:
- run:
name: Test Feature Flag Environment Resource
command: TESTARGS="-run TestAccFeatureFlagEnvironment" make testacc
- run:
name: Test Flag Trigger Resource
command: TESTARGS="-run TestAccFlagTrigger" make testacc
- run:
name: Test Metric Resource
command: TESTARGS="-run TestAccMetric" make testacc
- run:
name: Test Project Resource
command: TESTARGS="-run TestAccProject" make testacc
- run:
name: Test Relay Proxy Configuration Resource
command: TESTARGS="-run TestAccRelayProxy" make testacc
- run:
name: Test Segment Resource
command: TESTARGS="-run TestAccSegment" make testacc
Expand All @@ -57,7 +67,22 @@ jobs:
name: Test Webhook Resource
command: TESTARGS="-run TestAccWebhook" make testacc

lint:
executor:
name: go/default
tag: *go_version

steps:
- checkout
- run:
name: Install python
command: |
sudo apt update
sudo apt install python3-pip python-is-python3
- linter/pre-commit

workflows:
main:
jobs:
- build
- test
- lint
1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.16.10
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
minimum_pre_commit_version: "2.9.3"

repos:
- repo: https://github.com/ashanbrown/gofmts
rev: v0.1.4
hooks:
- id: gofmts
- repo: https://github.com/golangci/golangci-lint
rev: v1.43.0
hooks:
- id: golangci-lint
- repo: local
hooks:
- id: generate-audit-log-subscription-configs
name: Generate Audit Log Subscription Configurations
description: This hook runs a python script to update the audit log subscription configuration validation fields.
entry: python scripts/generate_integration_audit_log_configs.py
pass_filenames: false
language: python
additional_dependencies: ['requests']
verbose: true

30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
## [2.4.0] (January 19, 2022)

FEATURES:

- Added a `launchdarkly_team_members` data source to allow using multiple team members in one data source.

- Added a new `launchdarkly_metric` resource and data source for managing LaunchDarkly experiment flag metrics.

- Added a new `launchdarkly_flag_triggers` resource and data source for managing LaunchDarkly flag triggers.

- Added a new `launchdarkly_relay_proxy_configuration` resource and data source for managing configurations for the Relay Proxy's [automatic configuration](https://docs.launchdarkly.com/home/relay-proxy/automatic-configuration#writing-an-inline-policy) feature.

- Added a new `launchdarkly_audit_log_subscription` resource and data source for managing LaunchDarkly audit log integration subscriptions.

ENHANCEMENTS:

- Updated tests to use the constant attribute keys defined in launchdarkly/keys.go.

- Added a pre-commit file with a hook to alphabetize launchdarkly/keys.go

- Improved 409 and 429 retry handling.

## [2.3.0] (January 4, 2022)

FEATURES:
Expand Down Expand Up @@ -29,6 +51,14 @@ 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.

ENHANCEMENTS:

- Upgraded the LaunchDarkly API client to version 7.

=======

> > > > > > > 8c7d0fc67b7d6038363a5a9c20ff8a5ef0f364df
## [2.1.1] (October 11, 2021)

BUG FIXES:
Expand Down
2 changes: 2 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ vet:
fi

fmt:
go install github.com/ashanbrown/gofmts/cmd/[email protected]
gofmts -w $(GOFMT_FILES)
gofmt -w $(GOFMT_FILES)

fmtcheck:
Expand Down
2 changes: 2 additions & 0 deletions docs/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ $ mkdir -p $HOME/development/terraform-providers/; cd $HOME/development/terrafor
$ git clone [email protected]:launchdarkly/terraform-provider-launchdarkly
```

If you are working on the `launchdarkly_audit_log_subscription` resource, you will want to ensure the configuration field mapping is up-to-date with the [most recent changes](https://github.com/launchdarkly/integration-framework/tree/master/integrations) while testing by `cd`-ing into `scripts/` and running `python generate_integration_audit_log_configs.py`. Please note you will need to have the Python `requests` package installed locally. Otherwise, this will be run as a git commit hook. Then, to update the go mapping, follow the instructions in audit_log_subscription_configs.go and commit and push your changes.

To compile the provider, run `make build`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory.

```sh
Expand Down
23 changes: 23 additions & 0 deletions examples/v2/audit_log_subscription/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions examples/v2/audit_log_subscription/example.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
terraform {
required_providers {
launchdarkly = {
source = "launchdarkly/launchdarkly"
version = "~> 2.0"
}
}
required_version = ">= 0.13"
}

resource "launchdarkly_audit_log_subscription" "datadog_example" {
integration_key = "datadog"
name = "Example Terraform Subscription"
config = {
api_key = "thisisasecretkey"
host_url = "https://api.datadoghq.com"
}
on = false
tags = ["terraform-managed"]
statements {
actions = ["*"]
effect = "deny"
resources = ["proj/*:env/*:flag/*"]
}
}

resource "launchdarkly_audit_log_subscription" "dynatrace_example" {
integration_key = "dynatrace"
name = "Example Terraform Subscription"
config = {
api_token = "verysecrettoken"
url = "https://launchdarkly.appdynamics.com"
entity = "APPLICATION_METHOD"
}
tags = ["terraform-managed"]
on = true
statements {
actions = ["*"]
effect = "deny"
resources = ["proj/*:env/test:flag/*"]
}
}

resource "launchdarkly_audit_log_subscription" "splunk_example" {
integration_key = "splunk"
name = "Example Terraform Subscription"
config = {
base_url = "https://launchdarkly.splunk.com"
token = "averysecrettoken"
skip_ca_verification = true
}
tags = ["terraform-managed"]
on = true
statements {
actions = ["*"]
effect = "allow"
resources = ["proj/*:env/production:flag/*"]
}
}

39 changes: 39 additions & 0 deletions examples/v2/flag_trigger/example.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
terraform {
required_providers {
launchdarkly = {
source = "launchdarkly/launchdarkly"
version = "~> 2.0"
}
}
required_version = ">= 0.13"
}

resource "launchdarkly_project" "trigger_test" {
key = "trigger-test"
name = "A Trigger Test Project"
# configure a production environment
environments {
name = "Terraform Production Environment"
key = "production"
color = "581845"
}
}

resource "launchdarkly_feature_flag" "trigger_test_flag" {
project_key = launchdarkly_project.trigger_test.key
key = "trigger-test-flag"
name = "Trigger Test Flag"

variation_type = "boolean"
}

resource "launchdarkly_flag_trigger" "test_trigger" {
project_key = launchdarkly_project.trigger_test.key
env_key = launchdarkly_project.trigger_test.environments.0.key
flag_key = launchdarkly_feature_flag.trigger_test_flag.key
integration_key = "generic-trigger"
instructions {
kind = "turnFlagOff"
}
enabled = false
}
72 changes: 72 additions & 0 deletions examples/v2/metric/example.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
resource "launchdarkly_project" "example" {
key = "example-project"
name = "metrics example project"
environments {
name = "example environment"
key = "example-env"
color = "010101"
}
}

resource "launchdarkly_metric" "pageview_example" {
project_key = launchdarkly_project.example.key
key = "pageview-metric"
name = "Pageview Metric"
description = "example pageview metric"
kind = "pageview"
is_active = false
tags = [
"example",
]
urls {
kind = "substring"
substring = "foo"
}
urls {
kind = "regex"
pattern = "`foo`gm"
}
}

resource "launchdarkly_metric" "click_example" {
project_key = launchdarkly_project.example.key
key = "click-metric"
name = "click Metric"
description = "example click metric"
kind = "click"
selector = ".foo"
tags = [
"example",
]
urls {
kind = "exact"
url = "https://example.com/example/"
}
}

resource "launchdarkly_metric" "custom_example" {
project_key = launchdarkly_project.example.key
key = "custom-metric"
name = "custom Metric"
description = "example custom metric"
kind = "custom"
event_key = "foo"
tags = [
"example",
]
}

resource "launchdarkly_metric" "numeric_example" {
project_key = launchdarkly_project.example.key
key = "numeric-metric"
name = "numeric Metric"
description = "example numeric metric"
kind = "custom"
is_numeric = true
unit = "bar"
success_criteria = "HigherThanBaseline"
event_key = "foo"
tags = [
"example",
]
}
9 changes: 9 additions & 0 deletions examples/v2/metric/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_providers {
launchdarkly = {
source = "launchdarkly/launchdarkly"
version = "~> 2.0.0"
}
}
required_version = ">= 0.13"
}
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ require (
github.com/agext/levenshtein v1.2.3 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/go-hclog v1.0.0 // indirect
github.com/hashicorp/go-plugin v1.4.3 // indirect
github.com/hashicorp/go-retryablehttp v0.7.0
github.com/hashicorp/hcl/v2 v2.11.1 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.0
github.com/hashicorp/terraform-registry-address v0.0.0-20210816115301-cb2034eba045 // indirect
github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 // indirect
github.com/launchdarkly/api-client-go/v7 v7.0.0
github.com/launchdarkly/api-client-go/v7 v7.1.1
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/stoewer/go-strcase v1.2.0
github.com/stretchr/testify v1.7.0
github.com/zclconf/go-cty v1.10.0 // indirect
golang.org/x/net v0.0.0-20211208012354-db4efeb81f4b // indirect
Expand Down
Loading

0 comments on commit c92dede

Please sign in to comment.