Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5f00727
feat: adding payment method to schema of essentials sub
burythehammer Apr 17, 2025
8368b94
docs: updating schema for essentials subscription
burythehammer May 27, 2025
c06ff1e
provider/rediscloud_essentials_subscription_test.go
burythehammer May 27, 2025
14a4e32
refactor: updating code to reflect new API which splits response and …
burythehammer May 28, 2025
4d21235
chore: updating rediscloud go api to incorporate latest changes
burythehammer May 28, 2025
bd16dd5
chore: removing temporary changes to tests to allow to test locally
burythehammer May 28, 2025
0b35af9
chore: adding in new essentials sub tests into pr workflow
burythehammer May 29, 2025
7eaa407
fix: wrong name for essentials sub test
burythehammer May 29, 2025
a9317af
feat: now fast fails if you give a payment-id for anything other than…
burythehammer May 29, 2025
2775e42
fix: add checkdestroy
burythehammer May 29, 2025
109c483
fix: fixing issues with the payment_method_id check
burythehammer May 29, 2025
91c009f
test: commenting out marketplace test as it is not testable in staging
burythehammer May 29, 2025
fa63040
fix: fixing tests and flags
burythehammer May 30, 2025
b961768
Merge pull request #621 from RedisLabs/feat/marketplace-payment-essen…
burythehammer May 30, 2025
53b8a4b
fix: adding new pending status
burythehammer Jun 30, 2025
c6ca042
fix: also adding new status to essentials db check
burythehammer Jun 30, 2025
6baec68
chore: commenting out replace in go mod
burythehammer Jun 30, 2025
d2d9b16
Merge pull request #627 from RedisLabs/bugfix/OPCR-2-fix-dynamic-endp…
burythehammer Jun 30, 2025
fc1ffa6
feat: adding cert to aa db schema
burythehammer Jun 23, 2025
010f4e2
feat: logic for fetching tls certificate from db api
burythehammer Jun 24, 2025
17d91a3
chore: minor renaming
burythehammer Jun 25, 2025
5603ff2
fix: setting string instead of struct
burythehammer Jun 25, 2025
ce0e76a
Merge pull request #625 from RedisLabs/feat/add-tls-cert-to-datasources
burythehammer Jul 1, 2025
e3f37f7
fix: adding tests and potential fix in database update
burythehammer Jul 1, 2025
c1b2dd7
test: fixing tests
burythehammer Jul 1, 2025
85ec7f8
test: rearranging tests
burythehammer Jul 1, 2025
cf5c870
test: move test over to correct file, can't have acceptance tests clash
burythehammer Jul 1, 2025
d0fd105
Merge pull request #629 from RedisLabs/bugfix/OPCR-3-cannot-disable-d…
burythehammer Jul 1, 2025
3c1cdd4
docs: adding changelog
burythehammer Jul 1, 2025
a54efe3
docs: updating the documentation for the release
burythehammer Jul 1, 2025
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
12 changes: 12 additions & 0 deletions .github/workflows/terraform_provider_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,18 @@ jobs:
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloudEssentialsDatabase_CRUDI"'


go_test_smoke_essentials_sub:
name: go test smoke essentials sub
needs: [go_build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
with:
go-version-file: go.mod
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloudEssentialsSubscription"'


go_test_smoke_pro_db:
name: go test smoke pro db
needs: [go_build]
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file.
See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)


# 2.1.5 (1st July 2025)

### Added

Feature: Support Marketplace as a payment method for Essentials subscription
Feature: Add TLS certificate to databases’ data sources

### Fixed:

Unexpected state `dynamic-endpoints-creation-pending'
Can not disable default user on essentials db

# 2.1.4 (22nd May 2025)

### Added

- Documentation for `rediscloud_active_active_subscription_regions` added.
- Schema documentation amended to match documentation above.

# 2.1.3 (21st May 2025)

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ data "rediscloud_active_active_subscription_database" "example" {
* `support_oss_cluster_api` - Supports the Redis open-source (OSS) Cluster API.
* `external_endpoint_for_oss_cluster_api` - Use the external endpoint for open-source (OSS) Cluster API.
* `enable_tls` - Enable TLS for database.
* `tls_certificate` - TLS certificate used for authentication.
* `data_eviction` - The data items eviction policy.
* `global_modules` - A list of modules to be enabled on all deployments of this database.
* `public_endpoint` - Public endpoint to access the database.
Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/rediscloud_essentials_subscription.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ output "rediscloud_essentials_subscription" {

* `status` - The current status of the subscription
* `plan_id` - The plan to which this subscription belongs
* `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.
* `payment_method_id` - A valid payment method pre-defined in the current account
* `creation_date` - When the subscription was created
2 changes: 1 addition & 1 deletion docs/resources/rediscloud_essentials_database.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ The following arguments are supported:
* `replica` - (Optional) If specified, this database will be a replica of the specified Redis databases provided, documented below.
* `client_tls_certificates` - (Optional) A list of TLS/SSL certificates (public keys) with new line characters replaced by \n.
* `password` - (Optional) Password to access the database. If not specified, a random 32 character long alphanumeric password will be automatically generated.
* `enable_default_user` - (Optional) When `true` enables connecting to the database with the default user. Default `true`.
* `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.
* `alert` - (Optional) A block defining Redis database alert. Can be specified multiple times. Documented below.
* `tags` - (Optional) A string/string map of tags to associate with this database. Note that all keys and values must be lowercase.
* `modules` - (Optional) A list of modules objects, documented below. **Modifying this attribute will force creation of a new resource.**
Expand Down
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/RedisLabs/terraform-provider-rediscloud
go 1.22.4

require (
github.com/RedisLabs/rediscloud-go-api v0.26.0
github.com/RedisLabs/rediscloud-go-api v0.29.0
github.com/bflad/tfproviderlint v0.31.0
github.com/hashicorp/go-cty v1.5.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.1
Expand Down Expand Up @@ -66,3 +66,6 @@ require (
google.golang.org/protobuf v1.36.3 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

// for local development, uncomment this
//replace github.com/RedisLabs/rediscloud-go-api => ../rediscloud-go-api
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
github.com/ProtonMail/go-crypto v1.1.3 h1:nRBOetoydLeUb4nHajyO2bKqMLfWQ/ZPwkXqXxPxCFk=
github.com/ProtonMail/go-crypto v1.1.3/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE=
github.com/RedisLabs/rediscloud-go-api v0.26.0 h1:ka6CN2O+Ti6igkfH8lDT9Ua1/ksEh2H5dj1GF/pnKKQ=
github.com/RedisLabs/rediscloud-go-api v0.26.0/go.mod h1:3/oVb71rv2OstFRYEc65QCIbfwnJTgZeQhtPCcdHook=
github.com/RedisLabs/rediscloud-go-api v0.29.0 h1:XLVBMSgHwaaHFmf+TXrsU2veQ67J+e5Xrz54FggnwTY=
github.com/RedisLabs/rediscloud-go-api v0.29.0/go.mod h1:3/oVb71rv2OstFRYEc65QCIbfwnJTgZeQhtPCcdHook=
github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE=
github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec=
Expand Down
26 changes: 26 additions & 0 deletions provider/datasource_rediscloud_active_active_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ func dataSourceRedisCloudActiveActiveDatabase() *schema.Resource {
Type: schema.TypeBool,
Computed: true,
},
"tls_certificate": {
Description: "TLS certificate used for authentication.",
Type: schema.TypeString,
Computed: true,
},
"data_eviction": {
Description: "Data eviction items policy",
Type: schema.TypeString,
Expand Down Expand Up @@ -362,9 +367,30 @@ func dataSourceRedisCloudActiveActiveDatabaseRead(ctx context.Context, d *schema
return diag.FromErr(err)
}

if dbTlsCertificate, err := getCertificateData(ctx, api, subId, dbId); err != nil {
return diag.FromErr(err)
} else if dbTlsCertificate != nil {
if err := d.Set("tls_certificate", dbTlsCertificate.PublicCertificatePEMString); err != nil {
return diag.FromErr(err)
}
}

return diags
}

func getCertificateData(ctx context.Context, api *apiClient, subId int, dbId int) (*databases.DatabaseCertificate, error) {
dbTlsCertificate, err := api.client.Database.GetCertificate(ctx, subId, dbId)

if err != nil {
return nil, err
}

if dbTlsCertificate == nil {
return nil, fmt.Errorf("no certificate found for database %d", dbId)
}
return dbTlsCertificate, nil
}

func filterAADatabases(list *databases.ListActiveActiveDatabase, filters []func(db *databases.ActiveActiveDatabase) bool) ([]*databases.ActiveActiveDatabase, error) {
var filtered []*databases.ActiveActiveDatabase
for list.Next() {
Expand Down
14 changes: 7 additions & 7 deletions provider/datasource_rediscloud_essentials_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strconv"

"github.com/RedisLabs/rediscloud-go-api/redis"
fixedSubscriptions "github.com/RedisLabs/rediscloud-go-api/service/fixed/subscriptions"
fs "github.com/RedisLabs/rediscloud-go-api/service/fixed/subscriptions"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down Expand Up @@ -60,16 +60,16 @@ func dataSourceRedisCloudEssentialsSubscriptionRead(ctx context.Context, d *sche
return diag.FromErr(err)
}

var filters []func(method *fixedSubscriptions.FixedSubscription) bool
var filters []func(method *fs.FixedSubscriptionResponse) bool

if id, ok := d.GetOk("id"); ok {
filters = append(filters, func(sub *fixedSubscriptions.FixedSubscription) bool {
filters = append(filters, func(sub *fs.FixedSubscriptionResponse) bool {
return redis.IntValue(sub.ID) == id
})
}

if name, ok := d.GetOk("name"); ok {
filters = append(filters, func(sub *fixedSubscriptions.FixedSubscription) bool {
filters = append(filters, func(sub *fs.FixedSubscriptionResponse) bool {
return redis.StringValue(sub.Name) == name
})
}
Expand Down Expand Up @@ -109,8 +109,8 @@ func dataSourceRedisCloudEssentialsSubscriptionRead(ctx context.Context, d *sche
return diags
}

func filterFixedSubscriptions(subs []*fixedSubscriptions.FixedSubscription, filters []func(sub *fixedSubscriptions.FixedSubscription) bool) []*fixedSubscriptions.FixedSubscription {
var filteredSubs []*fixedSubscriptions.FixedSubscription
func filterFixedSubscriptions(subs []*fs.FixedSubscriptionResponse, filters []func(sub *fs.FixedSubscriptionResponse) bool) []*fs.FixedSubscriptionResponse {
var filteredSubs []*fs.FixedSubscriptionResponse
for _, sub := range subs {
if filterFixedSub(sub, filters) {
filteredSubs = append(filteredSubs, sub)
Expand All @@ -120,7 +120,7 @@ func filterFixedSubscriptions(subs []*fixedSubscriptions.FixedSubscription, filt
return filteredSubs
}

func filterFixedSub(method *fixedSubscriptions.FixedSubscription, filters []func(method *fixedSubscriptions.FixedSubscription) bool) bool {
func filterFixedSub(method *fs.FixedSubscriptionResponse, filters []func(method *fs.FixedSubscriptionResponse) bool) bool {
for _, f := range filters {
if !f(method) {
return false
Expand Down
2 changes: 2 additions & 0 deletions provider/rediscloud_active_active_database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ func TestAccResourceRedisCloudActiveActiveDatabase_CRUDI(t *testing.T) {
resource.TestCheckResourceAttr(datasourceName, "support_oss_cluster_api", "false"),
resource.TestCheckResourceAttr(datasourceName, "external_endpoint_for_oss_cluster_api", "false"),
resource.TestCheckResourceAttr(datasourceName, "enable_tls", "false"),
resource.TestCheckResourceAttrSet(datasourceName, "tls_certificate"),

resource.TestCheckResourceAttr(datasourceName, "data_eviction", "volatile-lru"),
resource.TestCheckResourceAttr(datasourceName, "global_modules.#", "1"),
resource.TestCheckResourceAttr(datasourceName, "global_modules.0", "RedisJSON"),
Expand Down
2 changes: 1 addition & 1 deletion provider/rediscloud_active_active_subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var activeActiveMarketplaceFlag = flag.Bool("activeActiveMarketplace", false,
// Also checks active-active subscription regions.
func TestAccResourceRedisCloudActiveActiveSubscription_CRUDI(t *testing.T) {

//testAccRequiresEnvVar(t, "EXECUTE_TESTS")
testAccRequiresEnvVar(t, "EXECUTE_TESTS")

name := acctest.RandomWithPrefix(testResourcePrefix)
const resourceName = "rediscloud_active_active_subscription.example"
Expand Down
Loading
Loading