Skip to content

Commit 7ad6bfb

Browse files
Merge pull request #630 from RedisLabs/develop
2.1.5 release
2 parents 1e70f87 + a54efe3 commit 7ad6bfb

16 files changed

+497
-20
lines changed

.github/workflows/terraform_provider_pr.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ jobs:
126126
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloudEssentialsDatabase_CRUDI"'
127127

128128

129+
go_test_smoke_essentials_sub:
130+
name: go test smoke essentials sub
131+
needs: [go_build]
132+
runs-on: ubuntu-latest
133+
steps:
134+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
135+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
136+
with:
137+
go-version-file: go.mod
138+
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloudEssentialsSubscription"'
139+
140+
129141
go_test_smoke_pro_db:
130142
name: go test smoke pro db
131143
needs: [go_build]

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file.
44
See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)
55

66

7+
# 2.1.5 (1st July 2025)
8+
9+
### Added
10+
11+
Feature: Support Marketplace as a payment method for Essentials subscription
12+
Feature: Add TLS certificate to databases’ data sources
13+
14+
### Fixed:
15+
16+
Unexpected state `dynamic-endpoints-creation-pending'
17+
Can not disable default user on essentials db
18+
19+
# 2.1.4 (22nd May 2025)
20+
21+
### Added
22+
23+
- Documentation for `rediscloud_active_active_subscription_regions` added.
24+
- Schema documentation amended to match documentation above.
25+
726
# 2.1.3 (21st May 2025)
827

928
### Added

docs/data-sources/rediscloud_active_active_subscription_database.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ data "rediscloud_active_active_subscription_database" "example" {
4747
* `support_oss_cluster_api` - Supports the Redis open-source (OSS) Cluster API.
4848
* `external_endpoint_for_oss_cluster_api` - Use the external endpoint for open-source (OSS) Cluster API.
4949
* `enable_tls` - Enable TLS for database.
50+
* `tls_certificate` - TLS certificate used for authentication.
5051
* `data_eviction` - The data items eviction policy.
5152
* `global_modules` - A list of modules to be enabled on all deployments of this database.
5253
* `public_endpoint` - Public endpoint to access the database.

docs/data-sources/rediscloud_essentials_subscription.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ output "rediscloud_essentials_subscription" {
3333

3434
* `status` - The current status of the subscription
3535
* `plan_id` - The plan to which this subscription belongs
36+
* `payment_method` - Payment method for the requested subscription. If `credit-card` is specified, the payment method id must be defined. This information is only used when creating a new subscription and any changes will be ignored after this.
3637
* `payment_method_id` - A valid payment method pre-defined in the current account
3738
* `creation_date` - When the subscription was created

docs/resources/rediscloud_essentials_database.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The following arguments are supported:
6767
* `replica` - (Optional) If specified, this database will be a replica of the specified Redis databases provided, documented below.
6868
* `client_tls_certificates` - (Optional) A list of TLS/SSL certificates (public keys) with new line characters replaced by \n.
6969
* `password` - (Optional) Password to access the database. If not specified, a random 32 character long alphanumeric password will be automatically generated.
70-
* `enable_default_user` - (Optional) When `true` enables connecting to the database with the default user. Default `true`.
70+
* `enable_default_user` - (Optional) When `true` enables connecting to the database with the default user. Default `true`. If set to `false`, any value for `password` will be ignored.
7171
* `alert` - (Optional) A block defining Redis database alert. Can be specified multiple times. Documented below.
7272
* `tags` - (Optional) A string/string map of tags to associate with this database. Note that all keys and values must be lowercase.
7373
* `modules` - (Optional) A list of modules objects, documented below. **Modifying this attribute will force creation of a new resource.**

go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/RedisLabs/terraform-provider-rediscloud
33
go 1.22.4
44

55
require (
6-
github.com/RedisLabs/rediscloud-go-api v0.26.0
6+
github.com/RedisLabs/rediscloud-go-api v0.29.0
77
github.com/bflad/tfproviderlint v0.31.0
88
github.com/hashicorp/go-cty v1.5.0
99
github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.1
@@ -66,3 +66,6 @@ require (
6666
google.golang.org/protobuf v1.36.3 // indirect
6767
gopkg.in/yaml.v3 v3.0.1 // indirect
6868
)
69+
70+
// for local development, uncomment this
71+
//replace github.com/RedisLabs/rediscloud-go-api => ../rediscloud-go-api

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc
44
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
55
github.com/ProtonMail/go-crypto v1.1.3 h1:nRBOetoydLeUb4nHajyO2bKqMLfWQ/ZPwkXqXxPxCFk=
66
github.com/ProtonMail/go-crypto v1.1.3/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE=
7-
github.com/RedisLabs/rediscloud-go-api v0.26.0 h1:ka6CN2O+Ti6igkfH8lDT9Ua1/ksEh2H5dj1GF/pnKKQ=
8-
github.com/RedisLabs/rediscloud-go-api v0.26.0/go.mod h1:3/oVb71rv2OstFRYEc65QCIbfwnJTgZeQhtPCcdHook=
7+
github.com/RedisLabs/rediscloud-go-api v0.29.0 h1:XLVBMSgHwaaHFmf+TXrsU2veQ67J+e5Xrz54FggnwTY=
8+
github.com/RedisLabs/rediscloud-go-api v0.29.0/go.mod h1:3/oVb71rv2OstFRYEc65QCIbfwnJTgZeQhtPCcdHook=
99
github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE=
1010
github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
1111
github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec=

provider/datasource_rediscloud_active_active_database.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ func dataSourceRedisCloudActiveActiveDatabase() *schema.Resource {
5858
Type: schema.TypeBool,
5959
Computed: true,
6060
},
61+
"tls_certificate": {
62+
Description: "TLS certificate used for authentication.",
63+
Type: schema.TypeString,
64+
Computed: true,
65+
},
6166
"data_eviction": {
6267
Description: "Data eviction items policy",
6368
Type: schema.TypeString,
@@ -362,9 +367,30 @@ func dataSourceRedisCloudActiveActiveDatabaseRead(ctx context.Context, d *schema
362367
return diag.FromErr(err)
363368
}
364369

370+
if dbTlsCertificate, err := getCertificateData(ctx, api, subId, dbId); err != nil {
371+
return diag.FromErr(err)
372+
} else if dbTlsCertificate != nil {
373+
if err := d.Set("tls_certificate", dbTlsCertificate.PublicCertificatePEMString); err != nil {
374+
return diag.FromErr(err)
375+
}
376+
}
377+
365378
return diags
366379
}
367380

381+
func getCertificateData(ctx context.Context, api *apiClient, subId int, dbId int) (*databases.DatabaseCertificate, error) {
382+
dbTlsCertificate, err := api.client.Database.GetCertificate(ctx, subId, dbId)
383+
384+
if err != nil {
385+
return nil, err
386+
}
387+
388+
if dbTlsCertificate == nil {
389+
return nil, fmt.Errorf("no certificate found for database %d", dbId)
390+
}
391+
return dbTlsCertificate, nil
392+
}
393+
368394
func filterAADatabases(list *databases.ListActiveActiveDatabase, filters []func(db *databases.ActiveActiveDatabase) bool) ([]*databases.ActiveActiveDatabase, error) {
369395
var filtered []*databases.ActiveActiveDatabase
370396
for list.Next() {

provider/datasource_rediscloud_essentials_subscription.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"strconv"
66

77
"github.com/RedisLabs/rediscloud-go-api/redis"
8-
fixedSubscriptions "github.com/RedisLabs/rediscloud-go-api/service/fixed/subscriptions"
8+
fs "github.com/RedisLabs/rediscloud-go-api/service/fixed/subscriptions"
99
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1010
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1111
)
@@ -60,16 +60,16 @@ func dataSourceRedisCloudEssentialsSubscriptionRead(ctx context.Context, d *sche
6060
return diag.FromErr(err)
6161
}
6262

63-
var filters []func(method *fixedSubscriptions.FixedSubscription) bool
63+
var filters []func(method *fs.FixedSubscriptionResponse) bool
6464

6565
if id, ok := d.GetOk("id"); ok {
66-
filters = append(filters, func(sub *fixedSubscriptions.FixedSubscription) bool {
66+
filters = append(filters, func(sub *fs.FixedSubscriptionResponse) bool {
6767
return redis.IntValue(sub.ID) == id
6868
})
6969
}
7070

7171
if name, ok := d.GetOk("name"); ok {
72-
filters = append(filters, func(sub *fixedSubscriptions.FixedSubscription) bool {
72+
filters = append(filters, func(sub *fs.FixedSubscriptionResponse) bool {
7373
return redis.StringValue(sub.Name) == name
7474
})
7575
}
@@ -109,8 +109,8 @@ func dataSourceRedisCloudEssentialsSubscriptionRead(ctx context.Context, d *sche
109109
return diags
110110
}
111111

112-
func filterFixedSubscriptions(subs []*fixedSubscriptions.FixedSubscription, filters []func(sub *fixedSubscriptions.FixedSubscription) bool) []*fixedSubscriptions.FixedSubscription {
113-
var filteredSubs []*fixedSubscriptions.FixedSubscription
112+
func filterFixedSubscriptions(subs []*fs.FixedSubscriptionResponse, filters []func(sub *fs.FixedSubscriptionResponse) bool) []*fs.FixedSubscriptionResponse {
113+
var filteredSubs []*fs.FixedSubscriptionResponse
114114
for _, sub := range subs {
115115
if filterFixedSub(sub, filters) {
116116
filteredSubs = append(filteredSubs, sub)
@@ -120,7 +120,7 @@ func filterFixedSubscriptions(subs []*fixedSubscriptions.FixedSubscription, filt
120120
return filteredSubs
121121
}
122122

123-
func filterFixedSub(method *fixedSubscriptions.FixedSubscription, filters []func(method *fixedSubscriptions.FixedSubscription) bool) bool {
123+
func filterFixedSub(method *fs.FixedSubscriptionResponse, filters []func(method *fs.FixedSubscriptionResponse) bool) bool {
124124
for _, f := range filters {
125125
if !f(method) {
126126
return false

provider/rediscloud_active_active_database_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ func TestAccResourceRedisCloudActiveActiveDatabase_CRUDI(t *testing.T) {
112112
resource.TestCheckResourceAttr(datasourceName, "support_oss_cluster_api", "false"),
113113
resource.TestCheckResourceAttr(datasourceName, "external_endpoint_for_oss_cluster_api", "false"),
114114
resource.TestCheckResourceAttr(datasourceName, "enable_tls", "false"),
115+
resource.TestCheckResourceAttrSet(datasourceName, "tls_certificate"),
116+
115117
resource.TestCheckResourceAttr(datasourceName, "data_eviction", "volatile-lru"),
116118
resource.TestCheckResourceAttr(datasourceName, "global_modules.#", "1"),
117119
resource.TestCheckResourceAttr(datasourceName, "global_modules.0", "RedisJSON"),

0 commit comments

Comments
 (0)