From a9e03ec05432ad40a20b431dde18fbd4aadbe55e Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Wed, 4 Dec 2024 17:04:57 +0100 Subject: [PATCH 01/22] add test.yml --- .github/workflows/test.yml | 122 +++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..a8bf0b9d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,122 @@ +# Terraform Provider testing workflow. +name: Tests + +on: + pull_request: + paths-ignore: + - 'README.md' + push: + paths-ignore: + - 'README.md' + +# Testing only needs permissions to read the repository contents. +permissions: + contents: read + +jobs: + # Ensure project builds before running testing matrix + build: + name: Build + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + with: + go-version-file: 'go.mod' + cache: true + - run: go mod download + - run: go build -v . + - name: Run linters + uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 + with: + version: latest + + generate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + with: + go-version-file: 'go.mod' + cache: true + # We need the latest version of Terraform for our documentation generation to use + - uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 + with: + terraform_wrapper: false + - run: make generate + - name: git diff + run: | + git diff --compact-summary --exit-code || \ + (echo; echo "Unexpected difference in directories after code generation. Run 'make generate' command and commit."; exit 1) + + # Run acceptance tests in a matrix with Terraform CLI versions + test: + executor: + name: go/default + tag: &go_version "1.21.3" + environment: + # sc-146360 - overrides the default timeout of 3000ms when reaching checkpoint-api.hashicorp.com + CHECKPOINT_TIMEOUT: 15000 + steps: + - checkout + - go/mod-download-cached + - run: + name: Run unit tests + command: TESTARGS="-v" make test + - run: + name: Test Data Sources + command: TESTARGS="-run TestAccDataSource" make testacc-with-retry + - run: + name: Test Access Token Resource + command: TESTARGS="-run TestAccAccessToken" make testacc-with-retry + - run: + name: Test Audit Log Subscription Resource + command: TESTARGS="-run TestAccAuditLogSubscription" make testacc-with-retry + - run: + name: Test Custom Role Resource + command: TESTARGS="-run TestAccCustomRole" make testacc-with-retry + - run: + name: Test Destination Resource + command: TESTARGS="-run TestAccDestination" make testacc-with-retry + - run: + name: Test Environment Resource + command: TESTARGS="-run TestAccEnvironment" make testacc-with-retry + - run: + name: Test Feature Flag Resource + command: TESTARGS="-run TestAccFeatureFlag_" make testacc-with-retry + - run: + name: Test Feature Flag Environment Resource + command: TESTARGS="-run TestAccFeatureFlagEnvironment" make testacc-with-retry + - run: + name: Test Flag Trigger Resource + command: TESTARGS="-run TestAccFlagTrigger" make testacc-with-retry + - run: + name: Test Metric Resource + command: TESTARGS="-run TestAccMetric" make testacc-with-retry + - run: + name: Test Project Resource + command: TESTARGS="-run TestAccProject" make testacc-with-retry + - run: + name: Test Relay Proxy Configuration Resource + command: TESTARGS="-run TestAccRelayProxy" make testacc-with-retry + - run: + name: Test Segment Resource + command: TESTARGS="-run TestAccSegment" make testacc-with-retry + - run: + name: Test Team Members + command: | + TESTARGS="-run TestAccTeamMember_CreateGeneric" make testacc-with-retry + TESTARGS="-run TestAccTeamMember_UpdateGeneric" make testacc-with-retry + TESTARGS="-run TestAccTeamMember_CreateWithCustomRole" make testacc-with-retry + TESTARGS="-run TestAccTeamMember_UpdateWithCustomRole" make testacc-with-retry + - run: + name: Test Team Resource + command: TESTARGS="-run TestAccTeam_" make testacc-with-retry + - run: + name: Test Team Role Mapping Resource + command: TESTARGS="-run TestAccTeamRoleMapping_" make testacc-with-retry + - run: + name: Test Webhook Resource + command: TESTARGS="-run TestAccWebhook" make testacc-with-retry + - notify-slack-of-failures \ No newline at end of file From ba71bd75601e9f3b6210b1cf3264be324f3c580b Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Wed, 4 Dec 2024 17:15:03 +0100 Subject: [PATCH 02/22] make a change --- docs/data-sources/environment.md | 1 + examples/data-sources/launchdarkly_environment/data-source.tf | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/data-sources/environment.md b/docs/data-sources/environment.md index f26b2999..a7e26712 100644 --- a/docs/data-sources/environment.md +++ b/docs/data-sources/environment.md @@ -19,6 +19,7 @@ This data source allows you to retrieve environment information from your Launch data "launchdarkly_environment" "example" { key = "example-env" project_key = "example-project" + color = "ff00ff" } ``` diff --git a/examples/data-sources/launchdarkly_environment/data-source.tf b/examples/data-sources/launchdarkly_environment/data-source.tf index 75cf8aef..88520798 100644 --- a/examples/data-sources/launchdarkly_environment/data-source.tf +++ b/examples/data-sources/launchdarkly_environment/data-source.tf @@ -1,4 +1,5 @@ data "launchdarkly_environment" "example" { key = "example-env" project_key = "example-project" + color = "ff00ff" } From d27512a46273afd40e1e241940068bb7751109a2 Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Wed, 4 Dec 2024 17:17:44 +0100 Subject: [PATCH 03/22] on push only --- .github/workflows/test.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a8bf0b9d..d96ef935 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,10 +1,7 @@ # Terraform Provider testing workflow. -name: Tests +name: "Tests" on: - pull_request: - paths-ignore: - - 'README.md' push: paths-ignore: - 'README.md' From f44e19e1fdf2b920b50c2d3612977a3eff2bb05e Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Wed, 4 Dec 2024 17:21:25 +0100 Subject: [PATCH 04/22] pull request only --- .github/workflows/test.yml | 2 +- .gitignore | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d96ef935..b30eeff4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: "Tests" on: - push: + pull_request: paths-ignore: - 'README.md' diff --git a/.gitignore b/.gitignore index 22624338..aa6d3c88 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,5 @@ website/build website/node_modules .vscode/ + +dist/ From e43853b6ae0bfb3baa162849c35d5b5532571b0b Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Wed, 4 Dec 2024 17:33:13 +0100 Subject: [PATCH 05/22] attempt fix and simplify --- .github/workflows/test.yml | 93 ++++++++++++-------------------------- 1 file changed, 28 insertions(+), 65 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b30eeff4..af9e94c2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,71 +49,34 @@ jobs: # Run acceptance tests in a matrix with Terraform CLI versions test: - executor: - name: go/default - tag: &go_version "1.21.3" - environment: + runs-on: ubuntu-latest + env: # sc-146360 - overrides the default timeout of 3000ms when reaching checkpoint-api.hashicorp.com CHECKPOINT_TIMEOUT: 15000 steps: - - checkout - - go/mod-download-cached - - run: - name: Run unit tests - command: TESTARGS="-v" make test - - run: - name: Test Data Sources - command: TESTARGS="-run TestAccDataSource" make testacc-with-retry - - run: - name: Test Access Token Resource - command: TESTARGS="-run TestAccAccessToken" make testacc-with-retry - - run: - name: Test Audit Log Subscription Resource - command: TESTARGS="-run TestAccAuditLogSubscription" make testacc-with-retry - - run: - name: Test Custom Role Resource - command: TESTARGS="-run TestAccCustomRole" make testacc-with-retry - - run: - name: Test Destination Resource - command: TESTARGS="-run TestAccDestination" make testacc-with-retry - - run: - name: Test Environment Resource - command: TESTARGS="-run TestAccEnvironment" make testacc-with-retry - - run: - name: Test Feature Flag Resource - command: TESTARGS="-run TestAccFeatureFlag_" make testacc-with-retry - - run: - name: Test Feature Flag Environment Resource - command: TESTARGS="-run TestAccFeatureFlagEnvironment" make testacc-with-retry - - run: - name: Test Flag Trigger Resource - command: TESTARGS="-run TestAccFlagTrigger" make testacc-with-retry - - run: - name: Test Metric Resource - command: TESTARGS="-run TestAccMetric" make testacc-with-retry - - run: - name: Test Project Resource - command: TESTARGS="-run TestAccProject" make testacc-with-retry - - run: - name: Test Relay Proxy Configuration Resource - command: TESTARGS="-run TestAccRelayProxy" make testacc-with-retry - - run: - name: Test Segment Resource - command: TESTARGS="-run TestAccSegment" make testacc-with-retry - - run: - name: Test Team Members - command: | - TESTARGS="-run TestAccTeamMember_CreateGeneric" make testacc-with-retry - TESTARGS="-run TestAccTeamMember_UpdateGeneric" make testacc-with-retry - TESTARGS="-run TestAccTeamMember_CreateWithCustomRole" make testacc-with-retry - TESTARGS="-run TestAccTeamMember_UpdateWithCustomRole" make testacc-with-retry - - run: - name: Test Team Resource - command: TESTARGS="-run TestAccTeam_" make testacc-with-retry - - run: - name: Test Team Role Mapping Resource - command: TESTARGS="-run TestAccTeamRoleMapping_" make testacc-with-retry - - run: - name: Test Webhook Resource - command: TESTARGS="-run TestAccWebhook" make testacc-with-retry - - notify-slack-of-failures \ No newline at end of file + - uses: actions/checkout@v4.2.2 + - uses: actions/setup-go@v5.1.0 + with: + go-version: "1.21.3" + - run: go mod download + - run: TESTARGS="-v" make test + - run: TESTARGS="-run TestAccDataSource" make testacc-with-retry + - run: TESTARGS="-run TestAccAccessToken" make testacc-with-retry + - run: TESTARGS="-run TestAccAuditLogSubscription" make testacc-with-retry + - run: TESTARGS="-run TestAccCustomRole" make testacc-with-retry + - run: TESTARGS="-run TestAccDestination" make testacc-with-retry + - run: TESTARGS="-run TestAccEnvironment" make testacc-with-retry + - run: TESTARGS="-run TestAccFeatureFlag_" make testacc-with-retry + - run: TESTARGS="-run TestAccFeatureFlagEnvironment" make testacc-with-retry + - run: TESTARGS="-run TestAccFlagTrigger" make testacc-with-retry + - run: TESTARGS="-run TestAccMetric" make testacc-with-retry + - run: TESTARGS="-run TestAccProject" make testacc-with-retry + - run: TESTARGS="-run TestAccRelayProxy" make testacc-with-retry + - run: TESTARGS="-run TestAccSegment" make testacc-with-retry + - run: TESTARGS="-run TestAccTeamMember_CreateGeneric" make testacc-with-retry + - run: TESTARGS="-run TestAccTeamMember_UpdateGeneric" make testacc-with-retry + - run: TESTARGS="-run TestAccTeamMember_CreateWithCustomRole" make testacc-with-retry + - run: TESTARGS="-run TestAccTeamMember_UpdateWithCustomRole" make testacc-with-retry + - run: TESTARGS="-run TestAccTeam_" make testacc-with-retry + - run: TESTARGS="-run TestAccTeamRoleMapping_" make testacc-with-retry + - run: TESTARGS="-run TestAccWebhook" make testacc-with-retry \ No newline at end of file From 28a19ff76f39e2176e3d83a63528a65a7c0d335f Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Wed, 4 Dec 2024 17:35:55 +0100 Subject: [PATCH 06/22] revert unrelated changes --- .gitignore | 4 +--- docs/data-sources/environment.md | 1 - examples/data-sources/launchdarkly_environment/data-source.tf | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index aa6d3c88..f91642d4 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,4 @@ website/.bundle website/build website/node_modules -.vscode/ - -dist/ +.vscode/ \ No newline at end of file diff --git a/docs/data-sources/environment.md b/docs/data-sources/environment.md index a7e26712..f26b2999 100644 --- a/docs/data-sources/environment.md +++ b/docs/data-sources/environment.md @@ -19,7 +19,6 @@ This data source allows you to retrieve environment information from your Launch data "launchdarkly_environment" "example" { key = "example-env" project_key = "example-project" - color = "ff00ff" } ``` diff --git a/examples/data-sources/launchdarkly_environment/data-source.tf b/examples/data-sources/launchdarkly_environment/data-source.tf index 88520798..75cf8aef 100644 --- a/examples/data-sources/launchdarkly_environment/data-source.tf +++ b/examples/data-sources/launchdarkly_environment/data-source.tf @@ -1,5 +1,4 @@ data "launchdarkly_environment" "example" { key = "example-env" project_key = "example-project" - color = "ff00ff" } From d6cfde82de4ada5714763bc3b238a016b85664c9 Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Wed, 4 Dec 2024 17:45:26 +0100 Subject: [PATCH 07/22] remove redundant nil check for string array --- launchdarkly/policy_statements_helper.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/launchdarkly/policy_statements_helper.go b/launchdarkly/policy_statements_helper.go index fd25b560..33087c87 100644 --- a/launchdarkly/policy_statements_helper.go +++ b/launchdarkly/policy_statements_helper.go @@ -151,16 +151,16 @@ func policyStatementsToResourceData(statements []ldapi.Statement) []interface{} t := map[string]interface{}{ EFFECT: s.Effect, } - if s.Resources != nil && len(s.Resources) > 0 { + if len(s.Resources) > 0 { t[RESOURCES] = stringSliceToInterfaceSlice(s.Resources) } - if s.NotResources != nil && len(s.NotResources) > 0 { + if len(s.NotResources) > 0 { t[NOT_RESOURCES] = stringSliceToInterfaceSlice(s.NotResources) } - if s.Actions != nil && len(s.Actions) > 0 { + if len(s.Actions) > 0 { t[ACTIONS] = stringSliceToInterfaceSlice(s.Actions) } - if s.NotActions != nil && len(s.NotActions) > 0 { + if len(s.NotActions) > 0 { t[NOT_ACTIONS] = stringSliceToInterfaceSlice(s.NotActions) } transformed = append(transformed, t) From b9aaeb1176a08502fbb664ec48bf2b7bb1eb838f Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Wed, 4 Dec 2024 18:00:31 +0100 Subject: [PATCH 08/22] remove another nil check --- launchdarkly/resource_launchdarkly_access_token.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launchdarkly/resource_launchdarkly_access_token.go b/launchdarkly/resource_launchdarkly_access_token.go index 555cdfbf..d96c3404 100644 --- a/launchdarkly/resource_launchdarkly_access_token.go +++ b/launchdarkly/resource_launchdarkly_access_token.go @@ -204,7 +204,7 @@ func resourceAccessTokenRead(ctx context.Context, d *schema.ResourceData, metaRa if accessToken.Role != nil { _ = d.Set(ROLE, *accessToken.Role) } - if accessToken.CustomRoleIds != nil && len(accessToken.CustomRoleIds) > 0 { + if len(accessToken.CustomRoleIds) > 0 { customRoleKeys, err := customRoleIDsToKeys(client, accessToken.CustomRoleIds) if err != nil { return diag.FromErr(err) From 2501d61e449cbc4397de84f17bbd810aa32b3269 Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Wed, 4 Dec 2024 18:49:09 +0100 Subject: [PATCH 09/22] add access token env var --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index af9e94c2..92a316f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,6 +53,7 @@ jobs: env: # sc-146360 - overrides the default timeout of 3000ms when reaching checkpoint-api.hashicorp.com CHECKPOINT_TIMEOUT: 15000 + LAUNCHDARKLY_ACCESS_TOKEN: ${{ secrets.LAUNCHDARKLY_ACCESS_TOKEN }} steps: - uses: actions/checkout@v4.2.2 - uses: actions/setup-go@v5.1.0 From bc83a85268f1665b5ca9f579b275e3d176a53a30 Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Wed, 4 Dec 2024 18:52:27 +0100 Subject: [PATCH 10/22] nvm --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 92a316f4..af9e94c2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,7 +53,6 @@ jobs: env: # sc-146360 - overrides the default timeout of 3000ms when reaching checkpoint-api.hashicorp.com CHECKPOINT_TIMEOUT: 15000 - LAUNCHDARKLY_ACCESS_TOKEN: ${{ secrets.LAUNCHDARKLY_ACCESS_TOKEN }} steps: - uses: actions/checkout@v4.2.2 - uses: actions/setup-go@v5.1.0 From c3b7e7432038f51734167822a1baac0b3e617652 Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Wed, 4 Dec 2024 18:54:46 +0100 Subject: [PATCH 11/22] attempt implement with matrix strategy --- .github/workflows/test.yml | 57 +++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index af9e94c2..6fd48a6a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,6 +31,7 @@ jobs: generate: runs-on: ubuntu-latest + timeout-minutes: 5 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 @@ -50,33 +51,37 @@ jobs: # Run acceptance tests in a matrix with Terraform CLI versions test: runs-on: ubuntu-latest - env: - # sc-146360 - overrides the default timeout of 3000ms when reaching checkpoint-api.hashicorp.com - CHECKPOINT_TIMEOUT: 15000 + timeout-minutes: 30 + strategy: + matrix: + test_case: + - TestAccDataSource + - TestAccAccessToken + - TestAccAuditLogSubscription + - TestAccCustomRole + - TestAccDestination + - TestAccEnvironment + - TestAccFeatureFlag_ + - TestAccFeatureFlagEnvironment + - TestAccFlagTrigger + - TestAccMetric + - TestAccProject + - TestAccRelayProxy + - TestAccSegment + - TestAccTeamMember_CreateGeneric + - TestAccTeamMember_UpdateGeneric + - TestAccTeamMember_CreateWithCustomRole + - TestAccTeamMember_UpdateWithCustomRole + - TestAccTeam_ + - TestAccTeamRoleMapping_ + - TestAccWebhook steps: - - uses: actions/checkout@v4.2.2 - - uses: actions/setup-go@v5.1.0 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: "1.21.3" - run: go mod download - - run: TESTARGS="-v" make test - - run: TESTARGS="-run TestAccDataSource" make testacc-with-retry - - run: TESTARGS="-run TestAccAccessToken" make testacc-with-retry - - run: TESTARGS="-run TestAccAuditLogSubscription" make testacc-with-retry - - run: TESTARGS="-run TestAccCustomRole" make testacc-with-retry - - run: TESTARGS="-run TestAccDestination" make testacc-with-retry - - run: TESTARGS="-run TestAccEnvironment" make testacc-with-retry - - run: TESTARGS="-run TestAccFeatureFlag_" make testacc-with-retry - - run: TESTARGS="-run TestAccFeatureFlagEnvironment" make testacc-with-retry - - run: TESTARGS="-run TestAccFlagTrigger" make testacc-with-retry - - run: TESTARGS="-run TestAccMetric" make testacc-with-retry - - run: TESTARGS="-run TestAccProject" make testacc-with-retry - - run: TESTARGS="-run TestAccRelayProxy" make testacc-with-retry - - run: TESTARGS="-run TestAccSegment" make testacc-with-retry - - run: TESTARGS="-run TestAccTeamMember_CreateGeneric" make testacc-with-retry - - run: TESTARGS="-run TestAccTeamMember_UpdateGeneric" make testacc-with-retry - - run: TESTARGS="-run TestAccTeamMember_CreateWithCustomRole" make testacc-with-retry - - run: TESTARGS="-run TestAccTeamMember_UpdateWithCustomRole" make testacc-with-retry - - run: TESTARGS="-run TestAccTeam_" make testacc-with-retry - - run: TESTARGS="-run TestAccTeamRoleMapping_" make testacc-with-retry - - run: TESTARGS="-run TestAccWebhook" make testacc-with-retry \ No newline at end of file + - name: Run Test + run: | + echo "Running test case: ${{ matrix.test_case }}" + TESTARGS="-run ${{ matrix.test_case }}" make testacc-with-retry \ No newline at end of file From b00aa2cb89c445726d0ef30151b54f06bbcbc25d Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Thu, 5 Dec 2024 10:01:52 +0100 Subject: [PATCH 12/22] set env vars --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6fd48a6a..af859b2c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,6 +52,9 @@ jobs: test: runs-on: ubuntu-latest timeout-minutes: 30 + env: + TF_ACC: "1" + LAUNCHDARKLY_ACCESS_TOKEN: ${{ secrets.LAUNCHDARKLY_ACCESS_TOKEN }} strategy: matrix: test_case: From f609255748ee65831e6bae10bfea313f32836cd9 Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Thu, 5 Dec 2024 11:36:47 +0100 Subject: [PATCH 13/22] set access token on generate job --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index af859b2c..5b47ef35 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,6 +32,8 @@ jobs: generate: runs-on: ubuntu-latest timeout-minutes: 5 + env: + LAUNCHDARKLY_ACCESS_TOKEN: ${{ secrets.LAUNCHDARKLY_ACCESS_TOKEN }} steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 From 8551a2223e6207bd3c1d9a327e02f6d13024318a Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Thu, 5 Dec 2024 14:33:35 +0100 Subject: [PATCH 14/22] add note to custom role name description --- docs/resources/custom_role.md | 2 +- launchdarkly/resource_launchdarkly_custom_role.go | 2 +- launchdarkly/resource_launchdarkly_team_test.go | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/resources/custom_role.md b/docs/resources/custom_role.md index ef4861de..6d7444a4 100644 --- a/docs/resources/custom_role.md +++ b/docs/resources/custom_role.md @@ -43,7 +43,7 @@ resource "launchdarkly_custom_role" "example" { ### Required - `key` (String) A unique key that will be used to reference the custom role in your code. A change in this field will force the destruction of the existing resource and the creation of a new one. -- `name` (String) A name for the custom role +- `name` (String) A name for the custom role. This must be unique within your organization. ### Optional diff --git a/launchdarkly/resource_launchdarkly_custom_role.go b/launchdarkly/resource_launchdarkly_custom_role.go index 2b3bba75..2245212d 100644 --- a/launchdarkly/resource_launchdarkly_custom_role.go +++ b/launchdarkly/resource_launchdarkly_custom_role.go @@ -41,7 +41,7 @@ This resource allows you to create and manage custom roles within your LaunchDar NAME: { Type: schema.TypeString, Required: true, - Description: "A name for the custom role", + Description: "A name for the custom role. This must be unique within your organization.", }, DESCRIPTION: { Type: schema.TypeString, diff --git a/launchdarkly/resource_launchdarkly_team_test.go b/launchdarkly/resource_launchdarkly_team_test.go index 5af5679a..52ef164f 100644 --- a/launchdarkly/resource_launchdarkly_team_test.go +++ b/launchdarkly/resource_launchdarkly_team_test.go @@ -168,6 +168,7 @@ func TestAccTeam_CreateAndUpdate(t *testing.T) { randomEmailThree := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) resourceName := "launchdarkly_team.test" + // custom role names must also be unique resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) From a384697162391b62a89809c57b3910ad495714ff Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Thu, 5 Dec 2024 14:49:04 +0100 Subject: [PATCH 15/22] change test timeout minutes to 10 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5b47ef35..49624490 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,7 +53,7 @@ jobs: # Run acceptance tests in a matrix with Terraform CLI versions test: runs-on: ubuntu-latest - timeout-minutes: 30 + timeout-minutes: 10 env: TF_ACC: "1" LAUNCHDARKLY_ACCESS_TOKEN: ${{ secrets.LAUNCHDARKLY_ACCESS_TOKEN }} From b6330539bfd02ad1bddc1eabdc733ef406033fd4 Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Thu, 5 Dec 2024 15:06:49 +0100 Subject: [PATCH 16/22] add specific name to tests job --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 49624490..dd3c8b48 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,5 @@ # Terraform Provider testing workflow. -name: "Tests" +name: Tests on: pull_request: @@ -52,6 +52,7 @@ jobs: # Run acceptance tests in a matrix with Terraform CLI versions test: + name: Acceptance Tests runs-on: ubuntu-latest timeout-minutes: 10 env: From a86d3da83fbe576e9f038d3eac6a32ee4277aacd Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Thu, 5 Dec 2024 15:13:01 +0100 Subject: [PATCH 17/22] pin version of golangci-lint and run tests on push to main --- .github/workflows/test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dd3c8b48..89c647a0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,10 +1,12 @@ # Terraform Provider testing workflow. -name: Tests +name: Test on: pull_request: paths-ignore: - 'README.md' + push: + branches: [main] # Testing only needs permissions to read the repository contents. permissions: @@ -27,7 +29,7 @@ jobs: - name: Run linters uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 with: - version: latest + version: v6.1.1 generate: runs-on: ubuntu-latest From f764c596c0dbc1e9ef012a9f70c451f529f849dc Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Thu, 5 Dec 2024 15:16:19 +0100 Subject: [PATCH 18/22] pin to sha tags --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 89c647a0..643bec5c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -84,8 +84,8 @@ jobs: - TestAccTeamRoleMapping_ - TestAccWebhook steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 with: go-version: "1.21.3" - run: go mod download From 2b1e78d647bb534a93e3eed8f79e649998497332 Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Thu, 5 Dec 2024 15:18:51 +0100 Subject: [PATCH 19/22] run on all pull requests --- .github/workflows/test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 643bec5c..1d906914 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,8 +3,7 @@ name: Test on: pull_request: - paths-ignore: - - 'README.md' + branches: [main] push: branches: [main] From 4b55aa34e6d7a37fc31773b2c2575d532023cb35 Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Thu, 5 Dec 2024 15:20:39 +0100 Subject: [PATCH 20/22] remove with version --- .github/workflows/test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1d906914..b1819bbb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,6 @@ name: Test on: pull_request: - branches: [main] push: branches: [main] @@ -27,8 +26,6 @@ jobs: - run: go build -v . - name: Run linters uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 - with: - version: v6.1.1 generate: runs-on: ubuntu-latest From 3657c1fa8c999f471c557eebd6de347b1401533f Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Fri, 6 Dec 2024 12:32:38 +0100 Subject: [PATCH 21/22] set draft:true and add terraform-registry-manifest --- .goreleaser.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 5b0eb589..b7bf7ee1 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -54,7 +54,9 @@ signs: - "--detach-sign" - "${artifact}" release: - # Actually creating the release is handled by project-releaser - disable: true + draft:true + extra_files: + - glob: 'terraform-registry-manifest.json' + name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' changelog: disable: true From 7dd40e6610805a24aa5878dacb053bf710f48a92 Mon Sep 17 00:00:00 2001 From: Isabelle Miller Date: Fri, 6 Dec 2024 12:42:00 +0100 Subject: [PATCH 22/22] add space --- .goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index b7bf7ee1..2bafe072 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -54,7 +54,7 @@ signs: - "--detach-sign" - "${artifact}" release: - draft:true + draft: true extra_files: - glob: 'terraform-registry-manifest.json' name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'