Skip to content

Commit 52425ce

Browse files
Merge branch 'main' into dependabot/go_modules/github.com/RedisLabs/rediscloud-go-api-0.24.0
2 parents 4ae9ca5 + 65cb02a commit 52425ce

File tree

34 files changed

+324
-86
lines changed

34 files changed

+324
-86
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
run: git fetch --prune --unshallow
2727
-
2828
name: Set up Go
29-
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
29+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
3030
with:
3131
go-version-file: go.mod
3232
-
@@ -38,7 +38,7 @@ jobs:
3838
PASSPHRASE: ${{ secrets.PASSPHRASE }}
3939
-
4040
name: Run GoReleaser
41-
uses: goreleaser/goreleaser-action@v5.0.0
41+
uses: goreleaser/goreleaser-action@v6.3.0
4242
with:
4343
version: latest
4444
args: release --clean

.github/workflows/terraform_provider.yml

Lines changed: 94 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,29 @@ on:
1111
- develop
1212
env:
1313
TERRAFORM_VERSION: "1.2.6"
14+
REDISCLOUD_ACCESS_KEY: ${{ secrets.REDISCLOUD_ACCESS_KEY_STAGING }}
15+
REDISCLOUD_SECRET_KEY: ${{ secrets.REDISCLOUD_SECRET_KEY_STAGING }}
16+
REDISCLOUD_URL: ${{ secrets.REDISCLOUD_URL_STAGING }}
17+
AWS_TEST_CLOUD_ACCOUNT_NAME: "${{ secrets.AWS_TEST_CLOUD_ACCOUNT_NAME_STAGING }}"
18+
AWS_PEERING_REGION: ${{ secrets.AWS_PEERING_REGION }}
19+
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
20+
AWS_VPC_CIDR: ${{ secrets.AWS_VPC_CIDR }}
21+
AWS_VPC_ID: ${{ secrets.AWS_VPC_ID }}
22+
AWS_TEST_TGW_ID: ${{ secrets.AWS_TEST_TGW_ID_STAGING }}
23+
TF_ACC: true
24+
TF_LOG: info
25+
AWS_ACCESS_KEY_ID: ${{ secrets.CLOUD_ACCOUNT_KEY }}
26+
AWS_ACCESS_SECRET_KEY: ${{ secrets.CLOUD_ACCOUNT_SECRET }}
27+
AWS_CONSOLE_USERNAME: ${{ secrets.CLOUD_ACCOUNT_USERNAME }}
28+
AWS_CONSOLE_PASSWORD: ${{ secrets.CLOUD_ACCOUNT_PASS }}
29+
AWS_SIGNIN_URL: ${{ secrets.CLOUD_ACCOUNT_URL }}
30+
GCP_VPC_PROJECT: ${{ secrets.GCP_VPC_PROJECT }}
31+
GCP_VPC_ID: ${{ secrets.GCP_VPC_ID }}
32+
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
33+
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
1434

1535
concurrency:
16-
group: ${{ github.workflow }}-${{ github.ref }}
36+
group: <span class="math-inline">\{\{ github\.workflow \}\}\-</span>{{ github.ref }}
1737
cancel-in-progress: true
1838

1939
jobs:
@@ -22,15 +42,15 @@ jobs:
2242
runs-on: ubuntu-latest
2343
steps:
2444
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25-
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
45+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
2646
continue-on-error: true
2747
id: cache-terraform-plugin-dir
2848
timeout-minutes: 2
2949
with:
3050
path: terraform-plugin-dir
3151
key: ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }}
3252
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
33-
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
53+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
3454
with:
3555
go-version-file: go.mod
3656
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
@@ -46,15 +66,15 @@ jobs:
4666
runs-on: ubuntu-latest
4767
steps:
4868
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
49-
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
69+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
5070
continue-on-error: true
5171
id: cache-terraform-providers-schema
5272
timeout-minutes: 2
5373
with:
5474
path: terraform-providers-schema
5575
key: ${{ runner.os }}-terraform-providers-schema-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }}
5676
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
57-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
77+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
5878
timeout-minutes: 2
5979
with:
6080
path: terraform-plugin-dir
@@ -86,66 +106,90 @@ jobs:
86106
mkdir terraform-providers-schema
87107
terraform providers schema -json > terraform-providers-schema/schema.json
88108
89-
go_test:
90-
name: go test
109+
go_test_databases:
110+
name: go test Databases
91111
needs: [go_build]
92112
runs-on: ubuntu-latest
93113
steps:
94114
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
95-
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
115+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
96116
with:
97117
go-version-file: go.mod
98-
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
99-
id: filter
118+
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloud(Essentials|Pro|ActiveActive)Database_.*"'
119+
120+
go_test_subscriptions:
121+
name: go test Subscriptions
122+
needs: [go_test_databases]
123+
runs-on: ubuntu-latest
124+
steps:
125+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
126+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
127+
with:
128+
go-version-file: go.mod
129+
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloud(Essentials|Pro|ActiveActive)Subscription_.*"'
130+
131+
go_test_subscriptions_tls:
132+
name: go test Subscriptions TLS
133+
needs: [go_test_subscriptions]
134+
runs-on: ubuntu-latest
135+
steps:
136+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
137+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
100138
with:
101-
filters: |
102-
code-changes:
103-
- 'go.mod'
104-
- 'go.sum'
105-
- 'provider/**'
106-
- '*.go'
107-
- '.github/workflows/**'
108-
- run: make testacc
109-
if: steps.filter.outputs.code-changes == 'true'
110-
env:
111-
REDISCLOUD_ACCESS_KEY: ${{ secrets.REDISCLOUD_ACCESS_KEY_STAGING }}
112-
REDISCLOUD_SECRET_KEY: ${{ secrets.REDISCLOUD_SECRET_KEY_STAGING }}
113-
REDISCLOUD_URL: ${{ secrets.REDISCLOUD_URL_STAGING }}
114-
AWS_TEST_CLOUD_ACCOUNT_NAME: "${{ secrets.AWS_TEST_CLOUD_ACCOUNT_NAME_STAGING }}"
115-
AWS_PEERING_REGION: ${{ secrets.AWS_PEERING_REGION }}
116-
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
117-
AWS_VPC_CIDR: ${{ secrets.AWS_VPC_CIDR }}
118-
AWS_VPC_ID: ${{ secrets.AWS_VPC_ID }}
119-
AWS_TEST_TGW_ID: ${{ secrets.AWS_TEST_TGW_ID_STAGING }}
120-
TF_ACC: true
121-
TF_LOG: debug
122-
AWS_ACCESS_KEY_ID: ${{ secrets.CLOUD_ACCOUNT_KEY }}
123-
AWS_ACCESS_SECRET_KEY: ${{ secrets.CLOUD_ACCOUNT_SECRET }}
124-
AWS_CONSOLE_USERNAME: ${{ secrets.CLOUD_ACCOUNT_USERNAME }}
125-
AWS_CONSOLE_PASSWORD: ${{ secrets.CLOUD_ACCOUNT_PASS }}
126-
AWS_SIGNIN_URL: ${{ secrets.CLOUD_ACCOUNT_URL }}
127-
GCP_VPC_PROJECT: ${{ secrets.GCP_VPC_PROJECT }}
128-
GCP_VPC_ID: ${{ secrets.GCP_VPC_ID }}
129-
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
130-
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
131-
- name: Generate code coverage report
132-
if: steps.filter.outputs.code-changes == 'true' && (success() || failure())
133-
run: make generate_coverage
134-
- name: Upload code coverage report
135-
if: steps.filter.outputs.code-changes == 'true' && (success() || failure())
136-
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
139+
go-version-file: go.mod
140+
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloudSubscriptionTls_.*"'
141+
142+
go_test_essentials_plan:
143+
name: go test Essentials Plan
144+
needs: [go_test_subscriptions_tls]
145+
runs-on: ubuntu-latest
146+
steps:
147+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
148+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
137149
with:
138-
name: coverage.html
139-
path: bin/coverage.html
150+
go-version-file: go.mod
151+
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloudEssentialsPlan_.*"'
152+
153+
go_test_persistence_modules_regions_acl:
154+
name: go test Other
155+
needs: [go_test_essentials_plan]
156+
runs-on: ubuntu-latest
157+
steps:
158+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
159+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
160+
with:
161+
go-version-file: go.mod
162+
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloud(DataPersistence|DatabaseModules|Regions|Acl).*"'
163+
164+
go_test_cloud_account:
165+
name: go test Cloud Account
166+
needs: [go_test_persistence_modules_regions_acl]
167+
runs-on: ubuntu-latest
168+
steps:
169+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
170+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
171+
with:
172+
go-version-file: go.mod
173+
- run: EXECUTE_TESTS=true make testacc TESTARGS='-test.short -run="TestAcc(DataSource|Resource)RedisCloud(CloudAccount).*"'
174+
175+
go_test_transit_payment:
176+
name: go test Transit Gateway & Payment
177+
needs: [go_test_cloud_account]
178+
runs-on: ubuntu-latest
179+
steps:
180+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
181+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
182+
with:
183+
go-version-file: go.mod
184+
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloud(TransitGatewayAttachment|PaymentMethod).*"'
140185

141186
tfproviderlint:
142187
name: tfproviderlint
143188
needs: [go_build]
144189
runs-on: ubuntu-latest
145190
steps:
146191
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
147-
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
192+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
148193
with:
149194
go-version-file: go.mod
150195
- run: make tfproviderlint
151-
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package provider
2+
3+
import (
4+
"fmt"
5+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
6+
"regexp"
7+
"testing"
8+
)
9+
10+
func TestAccDataSourceRedisCloudAclRule_ForDefaultRule(t *testing.T) {
11+
12+
testAccRequiresEnvVar(t, "EXECUTE_TESTS")
13+
14+
// This rule already exists
15+
const testName = "Read-Write"
16+
const testRule = "+@all -@dangerous ~*"
17+
getRuleTerraform := fmt.Sprintf(getDefaultDatasourceAclRuleDataSource, testName)
18+
19+
const AclRuleTest = "data.rediscloud_acl_rule.test"
20+
resource.ParallelTest(t, resource.TestCase{
21+
PreCheck: func() { testAccPreCheck(t) },
22+
ProviderFactories: providerFactories,
23+
CheckDestroy: nil, // test doesn't create a resource, so don't need to check anything
24+
Steps: []resource.TestStep{
25+
{
26+
Config: getRuleTerraform,
27+
Check: resource.ComposeAggregateTestCheckFunc(
28+
resource.TestMatchResourceAttr(
29+
AclRuleTest, "id", regexp.MustCompile("^\\d*$")),
30+
resource.TestCheckResourceAttr(AclRuleTest, "name", testName),
31+
resource.TestCheckResourceAttr(AclRuleTest, "rule", testRule),
32+
),
33+
},
34+
},
35+
})
36+
}
37+
38+
const getDefaultDatasourceAclRuleDataSource = `
39+
data "rediscloud_acl_rule" "test" {
40+
name = "%s"
41+
}
42+
`

provider/datasource_rediscloud_cloud_account_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import (
1010
)
1111

1212
func TestAccDataSourceRedisCloudCloudAccount_basic(t *testing.T) {
13+
14+
testAccRequiresEnvVar(t, "EXECUTE_TESTS")
15+
1316
name := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME")
1417

1518
const testCloudAccount = "data.rediscloud_cloud_account.test"

provider/datasource_rediscloud_data_persistence_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import (
77
)
88

99
func TestAccDataSourceRedisCloudDataPersistence_basic(t *testing.T) {
10+
11+
testAccRequiresEnvVar(t, "EXECUTE_TESTS")
12+
1013
const dataPersistenceFoo = "data.rediscloud_data_persistence.foo"
1114
resource.ParallelTest(t, resource.TestCase{
1215
PreCheck: func() { testAccPreCheck(t) },

provider/datasource_rediscloud_database_modules_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import (
77
)
88

99
func TestAccDataSourceRedisCloudDatabaseModules_basic(t *testing.T) {
10+
11+
testAccRequiresEnvVar(t, "EXECUTE_TESTS")
12+
1013
resource.ParallelTest(t, resource.TestCase{
1114
PreCheck: func() { testAccPreCheck(t) },
1215
ProviderFactories: providerFactories,

provider/datasource_rediscloud_essentials_plan_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88

99
func TestAccDataSourceRedisCloudEssentialsPlan_basic(t *testing.T) {
1010

11+
testAccRequiresEnvVar(t, "EXECUTE_TESTS")
12+
1113
const basicPlan = "data.rediscloud_essentials_plan.basic"
1214

1315
resource.ParallelTest(t, resource.TestCase{
@@ -48,6 +50,8 @@ func TestAccDataSourceRedisCloudEssentialsPlan_basic(t *testing.T) {
4850

4951
func TestAccDataSourceRedisCloudEssentialsPlan_azure(t *testing.T) {
5052

53+
testAccRequiresEnvVar(t, "EXECUTE_TESTS")
54+
5155
const azurePlan = "data.rediscloud_essentials_plan.azure"
5256

5357
resource.ParallelTest(t, resource.TestCase{
@@ -88,6 +92,8 @@ func TestAccDataSourceRedisCloudEssentialsPlan_azure(t *testing.T) {
8892

8993
func TestAccDataSourceRedisCloudEssentialsPlan_subscriptionId(t *testing.T) {
9094

95+
testAccRequiresEnvVar(t, "EXECUTE_TESTS")
96+
9197
const examplePlan = "data.rediscloud_essentials_plan.example"
9298

9399
resource.ParallelTest(t, resource.TestCase{
@@ -130,6 +136,8 @@ func TestAccDataSourceRedisCloudEssentialsPlan_subscriptionId(t *testing.T) {
130136

131137
func TestAccDataSourceRedisCloudEssentialsPlan_ambiguous(t *testing.T) {
132138

139+
testAccRequiresEnvVar(t, "EXECUTE_TESTS")
140+
133141
resource.ParallelTest(t, resource.TestCase{
134142
PreCheck: func() { testAccPreCheck(t) },
135143
ProviderFactories: providerFactories,
@@ -145,6 +153,8 @@ func TestAccDataSourceRedisCloudEssentialsPlan_ambiguous(t *testing.T) {
145153

146154
func TestAccDataSourceRedisCloudEssentialsPlan_impossible(t *testing.T) {
147155

156+
testAccRequiresEnvVar(t, "EXECUTE_TESTS")
157+
148158
resource.ParallelTest(t, resource.TestCase{
149159
PreCheck: func() { testAccPreCheck(t) },
150160
ProviderFactories: providerFactories,

provider/datasource_rediscloud_payment_method_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88

99
func TestAccDataSourceRedisCloudPaymentMethod_basic(t *testing.T) {
1010

11+
testAccRequiresEnvVar(t, "EXECUTE_TESTS")
12+
1113
resource.ParallelTest(t, resource.TestCase{
1214
PreCheck: func() { testAccPreCheck(t) },
1315
ProviderFactories: providerFactories,

provider/datasource_rediscloud_pro_database_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import (
1010
)
1111

1212
func TestAccDataSourceRedisCloudProDatabase_basic(t *testing.T) {
13+
14+
testAccRequiresEnvVar(t, "EXECUTE_TESTS")
15+
1316
name := acctest.RandomWithPrefix(testResourcePrefix)
1417
password := acctest.RandString(20)
1518
testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME")

provider/datasource_rediscloud_pro_subscription_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import (
1111
)
1212

1313
func TestAccDataSourceRedisCloudProSubscription_basic(t *testing.T) {
14+
15+
testAccRequiresEnvVar(t, "EXECUTE_TESTS")
16+
1417
name := acctest.RandomWithPrefix("tf-test")
1518

1619
const resourceName = "rediscloud_subscription.example"
@@ -57,6 +60,9 @@ func TestAccDataSourceRedisCloudProSubscription_basic(t *testing.T) {
5760
}
5861

5962
func TestAccDataSourceRedisCloudProSubscription_ignoresAA(t *testing.T) {
63+
64+
testAccRequiresEnvVar(t, "EXECUTE_TESTS")
65+
6066
name := acctest.RandomWithPrefix(testResourcePrefix)
6167
password := acctest.RandString(20)
6268

0 commit comments

Comments
 (0)