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

Release 2.9.2 #116

Closed
wants to merge 78 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
8fd56bd
prepare release (#80) (#188)
sloloris Jan 20, 2022
aea6005
Do not allow 0% segment rule weights (#189)
ldhenry Jan 21, 2022
f1e972c
Fix flag trigger creation panic (#190)
ldhenry Jan 21, 2022
09a6fa3
Backmerge/release 2.4.1 (#191)
ldhenry Jan 21, 2022
e493b76
Add Slack webhooks to audit_log_subscription (#192)
ldhenry Feb 7, 2022
2512cf3
backmerge v2.5.0 (#193)
ldhenry Feb 8, 2022
f4332bc
Use jennifer to generate audit log subscription configs (#194)
ldhenry Feb 8, 2022
de0fe41
Run terraform provider acceptance tests daily and notify of failures …
ldhenry Feb 8, 2022
9a38dde
Update changelog branch (#195)
ldhenry Feb 9, 2022
d285706
[ sc-143291] update autogenerated audit_log_subscription configs (#197)
monsagri Mar 14, 2022
42d99ac
Increase checkpoint-api.harhicorp.com timeout to 10s (#198)
ldhenry Mar 17, 2022
04b73ff
Updated destination tests to use random env keys to avoid env conflic…
ctawiah Apr 6, 2022
b6bc3f2
Merge pull request #199 from launchdarkly/ctawiah/sc-148136/randomize…
ctawiah Apr 6, 2022
e722f06
[sc 148065] add approvals bypass to terraform docs (#200)
monsagri Apr 7, 2022
b88452a
Backmerge/release 2.6.0 (#201)
monsagri Apr 7, 2022
ae41bdb
fix doc issues (#202)
sloloris Apr 14, 2022
a402d11
[sc-149869] roll back documentation changes regarding (#203)
monsagri Apr 14, 2022
66d55a1
backmerge 2.6.1 (#204)
monsagri Apr 14, 2022
494df8f
Imiller/sc 151834/add base permissions to custom role resource (#205)
sloloris May 4, 2022
38d70bc
Backmerge/release 2.7.0 (#206)
sloloris May 5, 2022
6559f71
(bug-fix) Update modules to accept new API header
May 11, 2022
4795ea3
Merge pull request #207 from launchdarkly/fix-ci
lucywyman May 13, 2022
626aaae
Update circleci test timeout to 15 seconds
May 19, 2022
2c88570
Merge pull request #208 from launchdarkly/sunny/sc-153482/increase-ti…
lucywyman May 20, 2022
9084524
Regenerate auditlog configs to resolve CI failures (#211)
ldhenry Jun 30, 2022
54dbc29
Run make generate to supress CI failures (#212)
ldhenry Jul 11, 2022
b9a3419
added a check for environment and warning
Jul 12, 2022
c073a3b
fix go lint error
Jul 12, 2022
822f9d8
Merge branch 'main' into sunny/sc-158595/leftover-resources-cannot-be…
Jul 12, 2022
2ba884b
use environmentExists function
Jul 12, 2022
dd21dac
remove grafana
Jul 13, 2022
66c862c
fix: [sc-158595] leftover resources cannot be cleared out after launc…
Jul 13, 2022
88840f0
Update changelog with bug fix for datasource feature flag environment
Jul 13, 2022
33a1f9f
Merge pull request #215 from launchdarkly/sunny/update-changelog-data…
lucywyman Jul 14, 2022
7b218fe
added changes
Jul 26, 2022
c1a3b89
Merge pull request #216 from launchdarkly/backmerge/release-2.7.1
Jul 26, 2022
70c9c34
upgrade go version 1.18.1 (#217)
sloloris Jul 27, 2022
8bee33e
Backmerge public/release v2.7.1 3 (#219)
ldhenry Jul 27, 2022
402b508
Remove invalid integration configurations (#221)
ldhenry Jul 28, 2022
db398b8
Add blacklist to manifest codegen and remove Zapier. (#222)
ldhenry Jul 28, 2022
b9e966d
Backmerge release 2.7.2 (#223)
ldhenry Jul 28, 2022
e7d7f77
Update Go api client to 10.0.1
Jun 28, 2022
6a6345e
Fix up v10 migration PR
Jul 28, 2022
11e3b82
Merge pull request #225 from launchdarkly/migrate-terraform-to-v10
lucywyman Jul 28, 2022
e9c8d43
[SC-160359] Create Teams resource and datasource
Jun 28, 2022
1d1e3d3
Fix up documentation
Aug 3, 2022
70e838e
Make lists unsorted to avoid unnecessary change detection
Aug 3, 2022
8fb4544
Update website/docs/d/team.html.markdown
lucywyman Aug 3, 2022
a97b4ae
Make lists unsorted to avoid unnecessary change detection
Aug 3, 2022
1cd0737
Merge pull request #224 from launchdarkly/dominickagnello/sc-160359/u…
lucywyman Aug 4, 2022
da5dacd
prepare 2.6.0 release (#91)
monsagri Apr 7, 2022
43ee03b
prepare 2.6.1 release (#94)
monsagri Apr 14, 2022
519707a
Prepare 2.7.1 release (#103)
Jul 25, 2022
1d371d9
Prepare release 2.7.1 2 (#104)
sloloris Jul 27, 2022
6276ea6
fix merge issue in Circle config (#105)
ldhenry Jul 27, 2022
76f1bcf
Release 2.7.2 (#106)
ldhenry Jul 28, 2022
416ec8b
prepare 2.8.0 release
Aug 4, 2022
8569589
Merge pull request #227 from launchdarkly/backmerge/release-2.8.0
lucywyman Aug 4, 2022
f21dd2c
[SC-163244] Add no-access role for team member resource
Aug 5, 2022
aded53f
Merge pull request #228 from launchdarkly/lucyvoigt/sc-163244/add-no-…
lucywyman Aug 5, 2022
f8caaea
Backmerge 2.9.0 release
Aug 5, 2022
72236a5
[sc-147722] add codeowners file (#230)
monsagri Aug 9, 2022
fd4a7de
Merge pull request #229 from launchdarkly/backmerge/release-2.9.0
lucywyman Aug 10, 2022
c60959a
Dominickagnello/sc 163883/open a pr against the terraform provider (#…
Blugil Aug 10, 2022
8ceb94b
add conditional so that new action only runs in private repo
Aug 10, 2022
229b5b9
Remove example.com email addresses from acceptance tests (#234)
ldhenry Aug 10, 2022
d459813
Retry failed acceptance tests once
Aug 10, 2022
e23033f
Merge pull request #235 from launchdarkly/retry-failed-tests-once
lucywyman Aug 10, 2022
124c1da
Merge pull request #233 from launchdarkly/dominickagnello/sc-163883/o…
lucywyman Aug 11, 2022
362669f
[SC-163262] Suppress diff when value_type doesn't change
Aug 5, 2022
c1ff182
Update launchdarkly/clause_helper.go
lucywyman Aug 23, 2022
a83f848
Merge pull request #236 from launchdarkly/lucyvoigt/sc-163262/don-t-s…
lucywyman Aug 24, 2022
e7affce
[bot] Regenerate integration configs (#237)
github-actions[bot] Aug 24, 2022
b8c9085
Update feature_flag_environmewnt to only create patch statements when…
ldhenry Aug 24, 2022
07e3cc0
merge public/main (#239)
ldhenry Aug 24, 2022
8311a3a
Imiller/sc 166499/defaults for boolean flags do not apply to existing…
sloloris Sep 1, 2022
6c5f39a
merge main
sloloris Sep 1, 2022
26a37fa
update changelog
sloloris Sep 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [2.9.2] (September 1, 2022)

BUG FIXES:

- Fixes a bug in the `launchdarkly_feature_flag` resource where explicit defaults were not getting set for boolean flags upon creation.

## [2.9.1] (August 24, 2022)

BUG FIXES:
Expand Down
29 changes: 20 additions & 9 deletions launchdarkly/default_variations_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,36 @@ import (

func defaultVariationsFromResourceData(d *schema.ResourceData) (*ldapi.Defaults, error) {
schemaVariations := d.Get(VARIATIONS).([]interface{})
numberOfVariations := len(schemaVariations)
variationType := d.Get(VARIATION_TYPE).(string)
if len(schemaVariations) == 0 && variationType == BOOL_VARIATION {
// default boolean variations
return &ldapi.Defaults{OnVariation: int32(0), OffVariation: int32(1)}, nil
}
rawDefaults, ok := d.GetOk(DEFAULTS)
if !ok {
return &ldapi.Defaults{OnVariation: int32(0), OffVariation: int32(len(schemaVariations) - 1)}, nil
defaultOff := numberOfVariations - 1
if variationType == BOOL_VARIATION {
defaultOff = 1 // otherwise at this point it would be -1
}
return &ldapi.Defaults{OnVariation: int32(0), OffVariation: int32(defaultOff)}, nil
}
defaultList := rawDefaults.([]interface{})
if variationType == BOOL_VARIATION {
if numberOfVariations == 0 && len(defaultList) == 0 {
// default boolean variations
return &ldapi.Defaults{OnVariation: int32(0), OffVariation: int32(1)}, nil
} else {
// this allows us to confidence check the variation indices below
numberOfVariations = 2
}
}

defaults := defaultList[0].(map[string]interface{})
on := defaults[ON_VARIATION].(int)
off := defaults[OFF_VARIATION].(int)

if on >= len(schemaVariations) {
return nil, fmt.Errorf("default on_variation %v is out of range, must be between 0 and %v inclusive", on, len(schemaVariations)-1)
if on >= numberOfVariations {
return nil, fmt.Errorf("default on_variation %v is out of range, must be between 0 and %v inclusive", on, numberOfVariations-1)
}
if off >= len(schemaVariations) {
return nil, fmt.Errorf("default off_variation %v is out of range, must be between 0 and %v inclusive", off, len(schemaVariations)-1)
if off >= numberOfVariations {
return nil, fmt.Errorf("default off_variation %v is out of range, must be between 0 and %v inclusive", off, numberOfVariations-1)
}

return &ldapi.Defaults{OnVariation: int32(on), OffVariation: int32(off)}, nil
Expand Down
24 changes: 23 additions & 1 deletion launchdarkly/default_variations_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestDefaultVariationsFromResourceData(t *testing.T) {
expectedErr error
}{
{
name: "no defaults on boolean",
name: "automatic boolean defaults",
vars: map[string]interface{}{
VARIATIONS: []interface{}{
map[string]interface{}{
Expand Down Expand Up @@ -56,6 +56,28 @@ func TestDefaultVariationsFromResourceData(t *testing.T) {
OffVariation: 1,
},
},
{
name: "explicit defautls overwrite default defaults",
vars: map[string]interface{}{
VARIATIONS: []interface{}{
map[string]interface{}{
VALUE: "true",
},
map[string]interface{}{
VALUE: "false",
},
},
DEFAULTS: []interface{}{
map[string]interface{}{
ON_VARIATION: 1,
OFF_VARIATION: 0,
}},
},
expected: &ldapi.Defaults{
OnVariation: 1,
OffVariation: 0,
},
},
{
name: "invalid default on value",
vars: map[string]interface{}{
Expand Down
145 changes: 44 additions & 101 deletions launchdarkly/resource_launchdarkly_feature_flag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ resource "launchdarkly_feature_flag" "basic" {
include_in_snippet = true
temporary = true
defaults {
on_variation = 0
on_variation = 1
off_variation = 1
}
}
Expand Down Expand Up @@ -290,7 +290,7 @@ resource "launchdarkly_feature_flag" "defaults" {
name = "Feature flag with defaults"
variation_type = "boolean"
defaults {
on_variation = 0
on_variation = 1
off_variation = 1
}
}
Expand Down Expand Up @@ -497,7 +497,7 @@ func withRandomProjectIncludeInSnippetTrue(randomProject, resource string) strin
%s`, randomProject, resource)
}

func TestAccFeatureFlag_Basic(t *testing.T) {
func TestAccFeatureFlag_BasicCreateAndUpdate(t *testing.T) {
projectKey := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
resourceName := "launchdarkly_feature_flag.basic"
resource.ParallelTest(t, resource.TestCase{
Expand All @@ -518,6 +518,9 @@ func TestAccFeatureFlag_Basic(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "variations.#", "2"),
resource.TestCheckResourceAttr(resourceName, "variations.0.value", "true"),
resource.TestCheckResourceAttr(resourceName, "variations.1.value", "false"),
// bool variation defaults should default to 0 and 1 if not set
resource.TestCheckResourceAttr(resourceName, "defaults.0.on_variation", "0"),
resource.TestCheckResourceAttr(resourceName, "defaults.0.off_variation", "1"),
resource.TestCheckNoResourceAttr(resourceName, MAINTAINER_ID),
),
},
Expand All @@ -527,29 +530,6 @@ func TestAccFeatureFlag_Basic(t *testing.T) {
// TODO: While we have to account for usingMobileKey being set to true by default, we cant use importStateVerify
// ImportStateVerify: true,
},
},
})
}

func TestAccFeatureFlag_Update(t *testing.T) {
projectKey := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
resourceName := "launchdarkly_feature_flag.basic"
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: withRandomProject(projectKey, testAccFeatureFlagBasic),
Check: resource.ComposeTestCheckFunc(
testAccCheckProjectExists("launchdarkly_project.test"),
testAccCheckFeatureFlagExists(resourceName),
resource.TestCheckResourceAttr(resourceName, NAME, "Basic feature flag"),
resource.TestCheckResourceAttr(resourceName, KEY, "basic-flag"),
resource.TestCheckResourceAttr(resourceName, PROJECT_KEY, projectKey),
),
},
{
Config: withRandomProject(projectKey, testAccFeatureFlagUpdate),
Check: resource.ComposeTestCheckFunc(
Expand All @@ -564,7 +544,7 @@ func TestAccFeatureFlag_Update(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "tags.1", "update"),
resource.TestCheckResourceAttr(resourceName, INCLUDE_IN_SNIPPET, "true"),
resource.TestCheckResourceAttr(resourceName, TEMPORARY, "true"),
resource.TestCheckResourceAttr(resourceName, "defaults.0.on_variation", "0"),
resource.TestCheckResourceAttr(resourceName, "defaults.0.on_variation", "1"),
resource.TestCheckResourceAttr(resourceName, "defaults.0.off_variation", "1"),
),
},
Expand Down Expand Up @@ -755,7 +735,7 @@ func TestAccFeatureFlag_InvalidMaintainer(t *testing.T) {
})
}

func TestAccFeatureFlag_CreateMultivariate(t *testing.T) {
func TestAccFeatureFlag_CreateAndUpdateMultivariate(t *testing.T) {
projectKey := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
resourceName := "launchdarkly_feature_flag.multivariate"
resource.ParallelTest(t, resource.TestCase{
Expand Down Expand Up @@ -797,78 +777,6 @@ func TestAccFeatureFlag_CreateMultivariate(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "custom_properties.1.value.0", "very special custom property"),
),
},
},
})
}

func TestAccFeatureFlag_CreateMultivariate2(t *testing.T) {
projectKey := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
resourceName := "launchdarkly_feature_flag.multivariate_numbers"
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: withRandomProject(projectKey, testAccFeatureFlagCreateMultivariate2),
Check: resource.ComposeTestCheckFunc(
testAccCheckProjectExists("launchdarkly_project.test"),
testAccCheckFeatureFlagExists(resourceName),
resource.TestCheckResourceAttr(resourceName, NAME, "multivariate flag 2 name"),
resource.TestCheckResourceAttr(resourceName, KEY, "multivariate-flag-2"),
resource.TestCheckResourceAttr(resourceName, PROJECT_KEY, projectKey),
resource.TestCheckResourceAttr(resourceName, DESCRIPTION, "this is a multivariate flag to test big number values"),
resource.TestCheckResourceAttr(resourceName, VARIATION_TYPE, "number"),
resource.TestCheckResourceAttr(resourceName, "variations.#", "3"),
resource.TestCheckResourceAttr(resourceName, "variations.0.description", "a description"),
resource.TestCheckResourceAttr(resourceName, "variations.0.name", "variation1"),
resource.TestCheckResourceAttr(resourceName, "variations.0.value", "86400000"),
resource.TestCheckResourceAttr(resourceName, "variations.1.value", "123"),
resource.TestCheckResourceAttr(resourceName, "variations.2.value", "123456789"),
resource.TestCheckResourceAttr(resourceName, "tags.#", "3"),
resource.TestCheckResourceAttr(resourceName, "tags.0", "is"),
resource.TestCheckResourceAttr(resourceName, "tags.1", "this"),
resource.TestCheckResourceAttr(resourceName, "tags.2", "unordered"),
),
},
},
})
}

func TestAccFeatureFlag_UpdateMultivariate(t *testing.T) {
projectKey := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
resourceName := "launchdarkly_feature_flag.multivariate"
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: withRandomProject(projectKey, testAccFeatureFlagCreateMultivariate),
Check: resource.ComposeTestCheckFunc(
testAccCheckProjectExists("launchdarkly_project.test"),
testAccCheckFeatureFlagExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "variations.#", "3"),
resource.TestCheckResourceAttr(resourceName, "variations.0.description", "a description"),
resource.TestCheckResourceAttr(resourceName, "variations.0.name", "variation1"),
resource.TestCheckResourceAttr(resourceName, "variations.0.value", "string1"),
resource.TestCheckResourceAttr(resourceName, "variations.1.value", "string2"),
resource.TestCheckResourceAttr(resourceName, "variations.2.value", "another option"),
resource.TestCheckResourceAttr(resourceName, "custom_properties.#", "2"),
resource.TestCheckResourceAttr(resourceName, "custom_properties.0.key", "some.property"),
resource.TestCheckResourceAttr(resourceName, "custom_properties.0.name", "Some Property"),
resource.TestCheckResourceAttr(resourceName, "custom_properties.0.value.#", "3"),
resource.TestCheckResourceAttr(resourceName, "custom_properties.0.value.0", "value1"),
resource.TestCheckResourceAttr(resourceName, "custom_properties.0.value.1", "value2"),
resource.TestCheckResourceAttr(resourceName, "custom_properties.0.value.2", "value3"),
resource.TestCheckResourceAttr(resourceName, "custom_properties.1.key", "some.property2"),
resource.TestCheckResourceAttr(resourceName, "custom_properties.1.name", "Some Property"),
resource.TestCheckResourceAttr(resourceName, "custom_properties.1.value.#", "1"),
resource.TestCheckResourceAttr(resourceName, "custom_properties.1.value.0", "very special custom property"),
),
},
{
Config: withRandomProject(projectKey, testAccFeatureFlagUpdateMultivariate),
Check: resource.ComposeTestCheckFunc(
Expand Down Expand Up @@ -922,6 +830,41 @@ func TestAccFeatureFlag_UpdateMultivariate(t *testing.T) {
})
}

func TestAccFeatureFlag_CreateMultivariate2(t *testing.T) {
projectKey := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
resourceName := "launchdarkly_feature_flag.multivariate_numbers"
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {
testAccPreCheck(t)
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: withRandomProject(projectKey, testAccFeatureFlagCreateMultivariate2),
Check: resource.ComposeTestCheckFunc(
testAccCheckProjectExists("launchdarkly_project.test"),
testAccCheckFeatureFlagExists(resourceName),
resource.TestCheckResourceAttr(resourceName, NAME, "multivariate flag 2 name"),
resource.TestCheckResourceAttr(resourceName, KEY, "multivariate-flag-2"),
resource.TestCheckResourceAttr(resourceName, PROJECT_KEY, projectKey),
resource.TestCheckResourceAttr(resourceName, DESCRIPTION, "this is a multivariate flag to test big number values"),
resource.TestCheckResourceAttr(resourceName, VARIATION_TYPE, "number"),
resource.TestCheckResourceAttr(resourceName, "variations.#", "3"),
resource.TestCheckResourceAttr(resourceName, "variations.0.description", "a description"),
resource.TestCheckResourceAttr(resourceName, "variations.0.name", "variation1"),
resource.TestCheckResourceAttr(resourceName, "variations.0.value", "86400000"),
resource.TestCheckResourceAttr(resourceName, "variations.1.value", "123"),
resource.TestCheckResourceAttr(resourceName, "variations.2.value", "123456789"),
resource.TestCheckResourceAttr(resourceName, "tags.#", "3"),
resource.TestCheckResourceAttr(resourceName, "tags.0", "is"),
resource.TestCheckResourceAttr(resourceName, "tags.1", "this"),
resource.TestCheckResourceAttr(resourceName, "tags.2", "unordered"),
),
},
},
})
}

func TestAccFeatureFlag_UpdateDefaults(t *testing.T) {
projectKey := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
resourceName := "launchdarkly_feature_flag.defaults"
Expand All @@ -936,7 +879,7 @@ func TestAccFeatureFlag_UpdateDefaults(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckProjectExists("launchdarkly_project.test"),
testAccCheckFeatureFlagExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "defaults.0.on_variation", "0"),
resource.TestCheckResourceAttr(resourceName, "defaults.0.on_variation", "1"),
resource.TestCheckResourceAttr(resourceName, "defaults.0.off_variation", "1"),
),
},
Expand Down