Skip to content

Commit f16b4e9

Browse files
Merge pull request #635 from RedisLabs/feat/OPCR-6-cmk
OPCR-6: Customer Managed Key support for pro and active active subscriptions
2 parents 7ad6bfb + ecc3da2 commit f16b4e9

File tree

33 files changed

+841
-141
lines changed

33 files changed

+841
-141
lines changed

CHANGELOG.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,23 @@
33
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

6+
# 2.1.6 (31st July 2025)
7+
8+
### Added
9+
10+
- Customer Managed Key support for active-active and pro subscriptions. Only supports redis internal GCP cloud subscriptions. CMKs are externally provided by a customer-supplied GCP account and are managed externally by the user.
611

712
# 2.1.5 (1st July 2025)
813

914
### Added
1015

11-
Feature: Support Marketplace as a payment method for Essentials subscription
12-
Feature: Add TLS certificate to databases’ data sources
16+
- Feature: Support Marketplace as a payment method for Essentials subscription
17+
- Feature: Add TLS certificate to databases’ data sources
1318

1419
### Fixed:
1520

16-
Unexpected state `dynamic-endpoints-creation-pending'
17-
Can not disable default user on essentials db
21+
- Unexpected state `dynamic-endpoints-creation-pending'
22+
- Can not disable default user on essentials db
1823

1924
# 2.1.4 (22nd May 2025)
2025

docs/resources/rediscloud_active_active_subscription.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ subscription, then the databases defined as separate resources will be attached
1919
the subscription. The creation_plan block can ONLY be used for provisioning new
2020
subscriptions, the block will be ignored if you make any further changes or try importing the resource (e.g. `terraform import` ...).
2121

22+
~> **Note:** The CMK (customer managed encryption key) fields require a specific flow which involves a multi step apply. Please refer to the relevant documents if using these fields.
23+
2224
## Example Usage
2325

2426
```hcl
@@ -62,6 +64,9 @@ The following arguments are supported:
6264
* `redis_version` - (Optional) The Redis version of the databases in the subscription. If omitted, the Redis version will be the default. **Modifying this attribute will force creation of a new resource.**
6365
* `creation_plan` - (Required) A creation plan object, documented below. Ignored after creation.
6466
* `maintenance_windows` - (Optional) The subscription's maintenance window specification, documented below.
67+
* `customer_managed_key_enabled` - (Optional) Whether to enable the CMK flow.
68+
* `customer_managed_key_deletion_grace_period` - (Optional) The grace period for deleting the subscription. If not set, will default to immediate deletion grace period.
69+
* `customer_managed_key` - (Optional) The customer managed keys (CMK) to use for this subscription. If is active-active subscription, must set a key for each region.
6570

6671
The `creation_plan` block supports:
6772

@@ -78,6 +83,10 @@ The creation_plan `region` block supports:
7883
* `write_operations_per_second` - (Required) Throughput measurement for an active-active subscription
7984
* `read_operations_per_second` - (Required) Throughput measurement for an active-active subscription
8085

86+
The `customer_managed_key` block supports:
87+
* `resource_name` - Resource name of the customer managed key as defined by the cloud provider, e.g. projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME
88+
* `region` - Name of the region for the customer managed key as defined by the cloud provider.
89+
8190
The `maintenance_windows` object has these attributes:
8291

8392
* `mode` - Either `automatic` (Redis specified) or `manual` (User specified)
@@ -93,6 +102,8 @@ The `window` object has these attributes:
93102

94103
## Attribute reference
95104

105+
* `customer_managed_key_redis_service_account` - Outputs the id of the service account associated with the subscription. Useful as part of the CMK flow.
106+
96107
* `pricing` - A list of pricing objects, documented below
97108

98109
The `pricing` object has these attributes:

docs/resources/rediscloud_subscription.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ subscription, then the databases defined as separate resources will be attached
2020
the subscription. The creation_plan block can ONLY be used for provisioning new
2121
subscriptions, the block will be ignored if you make any further changes or try importing the resource (e.g. `terraform import` ...).
2222

23+
~> **Note:** The CMK (customer managed encryption key) fields require a specific flow which involves a multi step apply. Please refer to the relevant documents if using these fields.
24+
2325
## Example Usage
2426

2527
```hcl
@@ -80,6 +82,9 @@ The following arguments are supported:
8082
* `cloud_provider` - (Required) A cloud provider object, documented below. **Modifying this attribute will force creation of a new resource.**
8183
* `creation_plan` - (Required) A creation plan object, documented below.
8284
* `maintenance_windows` - (Optional) The subscription's maintenance window specification, documented below.
85+
* `customer_managed_key_enabled` - (Optional) Whether to enable the customer managed encryption key flow.
86+
* `customer_managed_key_deletion_grace_period` - (Optional) The grace period for deleting the subscription. If not set, will default to immediate deletion grace period.
87+
* `customer_managed_key` - (Optional) The customer managed keys (CMK) to use for this subscription. If is active-active subscription, must set a key for each region.
8388

8489
The `allowlist` block supports:
8590

@@ -128,6 +133,9 @@ The cloud_provider `region` block supports:
128133
~> **Note:** The preferred_availability_zones parameter is required for Terraform, but is optional within the Redis Enterprise Cloud UI.
129134
This difference in behaviour is to guarantee that a plan after an apply does not generate differences. In AWS Redis internal cloud account, please set the zone IDs (for example: `["use-az2", "use-az3", "use-az5"]`).
130135

136+
The `customer_managed_key` block supports:
137+
* `resource_name` - The resource name of the customer managed key as defined by the cloud provider, e.g. projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME
138+
131139
The `maintenance_windows` object has these attributes:
132140

133141
* `mode` - Either `automatic` (Redis specified) or `manual` (User specified)
@@ -149,6 +157,8 @@ The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/d
149157

150158
## Attribute reference
151159

160+
* `customer_managed_key_redis_service_account` - Outputs the id of the service account associated with the subscription. Useful as part of the CMK flow.
161+
152162
The `region` block has these attributes:
153163

154164
* `networks` - List of generated network configuration

go.mod

Lines changed: 1 addition & 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.29.0
6+
github.com/RedisLabs/rediscloud-go-api v0.31.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

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.29.0 h1:XLVBMSgHwaaHFmf+TXrsU2veQ67J+e5Xrz54FggnwTY=
8-
github.com/RedisLabs/rediscloud-go-api v0.29.0/go.mod h1:3/oVb71rv2OstFRYEc65QCIbfwnJTgZeQhtPCcdHook=
7+
github.com/RedisLabs/rediscloud-go-api v0.31.0 h1:hFdR7nrJcCVQN8h3DeXtP0g4zVQP6X5wtS5FoinG8bo=
8+
github.com/RedisLabs/rediscloud-go-api v0.31.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_essentials_plan_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ data "rediscloud_essentials_plan" "impossible" {
196196
const testAccResourceRedisCloudPaidEssentialsSubscriptionDataSource = `
197197
data "rediscloud_payment_method" "card" {
198198
card_type = "Visa"
199+
last_four_numbers = "5556"
199200
}
200201
201202
data "rediscloud_essentials_plan" "fixed" {

provider/datasource_rediscloud_payment_method_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ func TestAccDataSourceRedisCloudPaymentMethod_basic(t *testing.T) {
3131
}
3232

3333
const testAccDataSourceRedisCloudPaymentMethod = `
34-
data "rediscloud_payment_method" "foo" {
35-
card_type = "Visa"
34+
data "rediscloud_payment_method" "card" {
35+
card_type = "Visa"
36+
last_four_numbers = "5556"
3637
}
3738
`

provider/datasource_rediscloud_pro_database_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ func TestAccDataSourceRedisCloudProDatabase_basic(t *testing.T) {
6969

7070
const testAccDatasourceRedisCloudProDatabase = `
7171
data "rediscloud_payment_method" "card" {
72-
card_type = "Visa"
72+
card_type = "Visa"
73+
last_four_numbers = "5556"
7374
}
75+
7476
data "rediscloud_cloud_account" "account" {
7577
exclude_internal_account = true
7678
provider_type = "AWS"

provider/datasource_rediscloud_pro_subscription_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ func TestAccDataSourceRedisCloudProSubscription_ignoresAA(t *testing.T) {
8181

8282
const testAccDatasourceRedisCloudProSubscription = `
8383
data "rediscloud_payment_method" "card" {
84-
card_type = "Visa"
84+
card_type = "Visa"
85+
last_four_numbers = "5556"
8586
}
87+
8688
data "rediscloud_cloud_account" "account" {
8789
exclude_internal_account = true
8890
provider_type = "AWS"
@@ -132,7 +134,9 @@ data "rediscloud_subscription" "example" {
132134
const testAccDatasourceRedisCloudAADatabaseWithProDataSource = `
133135
data "rediscloud_payment_method" "card" {
134136
card_type = "Visa"
137+
last_four_numbers = "5556"
135138
}
139+
136140
resource "rediscloud_active_active_subscription" "example" {
137141
name = "%s"
138142
payment_method_id = data.rediscloud_payment_method.card.id

provider/datasource_rediscloud_subscription_peerings_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ func TestAccDataSourceRedisCloudSubscriptionPeerings_basic(t *testing.T) {
6060

6161
const testAccDatasourceRedisCloudSubscriptionPeeringsDataSource = `
6262
data "rediscloud_payment_method" "card" {
63-
card_type = "Visa"
63+
card_type = "Visa"
64+
last_four_numbers = "5556"
6465
}
6566
6667
data "rediscloud_cloud_account" "account" {

0 commit comments

Comments
 (0)