Skip to content

Commit 929e644

Browse files
committed
test: adding in connections and dbs into test so that the privatelink data can pick up on them
1 parent cc8b73f commit 929e644

File tree

7 files changed

+90
-73
lines changed

7 files changed

+90
-73
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
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+
7+
# 2.4.4 (3rd October 2025)
8+
9+
## Changed:
10+
- Fixed AA endpoint script calling wrong method
11+
- Fixed connection flattening not aligning to schema
12+
613
# 2.4.3 (1st October 2025)
714

815
## Added:
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
locals {
2+
rediscloud_subscription_name = "%s"
3+
rediscloud_cloud_account = "%s"
4+
rediscloud_private_link_share_name = "%s"
5+
}
6+
7+
data "rediscloud_payment_method" "card" {
8+
card_type = "Visa"
9+
last_four_numbers = "5556"
10+
}
11+
12+
data "rediscloud_cloud_account" "account" {
13+
exclude_internal_account = true
14+
provider_type = "AWS"
15+
name = local.rediscloud_cloud_account
16+
}
17+
18+
resource "rediscloud_subscription" "pro_subscription" {
19+
name = local.rediscloud_subscription_name
20+
payment_method_id = data.rediscloud_payment_method.card.id
21+
22+
cloud_provider {
23+
provider = data.rediscloud_cloud_account.account.provider_type
24+
cloud_account_id = data.rediscloud_cloud_account.account.id
25+
region {
26+
region = "eu-west-1"
27+
networking_deployment_cidr = "10.0.0.0/24"
28+
preferred_availability_zones = ["eu-west-1a"]
29+
}
30+
}
31+
32+
creation_plan {
33+
dataset_size_in_gb = 15
34+
quantity = 1
35+
replication = true
36+
throughput_measurement_by = "operations-per-second"
37+
throughput_measurement_value = 20000
38+
}
39+
}
40+
41+
resource "rediscloud_private_link" "private_link" {
42+
subscription_id = rediscloud_subscription.pro_subscription.id
43+
share_name = local.rediscloud_private_link_share_name
44+
45+
# principal {
46+
# principal = local.rediscloud_principal_1
47+
# principal_type = "aws_account"
48+
# principal_alias = "terraform test aws account"
49+
# }
50+
51+
principal {
52+
principal = "234567890123"
53+
principal_type = "aws_account"
54+
principal_alias = "terraform test aws account 2"
55+
}
56+
}
57+
58+
data "rediscloud_private_link" "private_link" {
59+
subscription_id = rediscloud_private_link.private_link.subscription_id
60+
}

provider/privatelink/testdata/testPrivateLink.tf renamed to provider/privatelink/testdata/pro_private_link.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ locals {
22
rediscloud_subscription_name = "%s"
33
rediscloud_cloud_account = "%s"
44
rediscloud_private_link_share_name = "%s"
5+
rediscloud_database_password = "%s"
56
}
67

78
data "rediscloud_payment_method" "card" {
@@ -38,6 +39,19 @@ resource "rediscloud_subscription" "pro_subscription" {
3839
}
3940
}
4041

42+
## this will give some connections and databases in the output
43+
resource "rediscloud_subscription_database" "pro_database" {
44+
subscription_id = rediscloud_subscription.pro_subscription.id
45+
name = "db"
46+
memory_limit_in_gb = 1
47+
password = local.rediscloud_database_password
48+
protocol = "redis"
49+
data_persistence = "none"
50+
throughput_measurement_by = "operations-per-second"
51+
throughput_measurement_value = 10000
52+
}
53+
54+
4155
resource "rediscloud_private_link" "pro_private_link" {
4256
subscription_id = rediscloud_subscription.pro_subscription.id
4357
share_name = local.rediscloud_private_link_share_name

provider/privatelink/testdata/testPrivateLinkUpdate.tf

Lines changed: 0 additions & 66 deletions
This file was deleted.

provider/rediscloud_active_active_private_link_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
1010
)
1111

12-
const testActiveActivePrivateLinkConfigFile = "./privatelink/testdata/testActiveActivePrivateLink.tf"
12+
const testActiveActivePrivateLinkConfigFile = "../privatelink/testdata/active_active_private_link.tf"
1313

1414
func TestAccResourceRedisCloudActiveActivePrivateLink_CRUDI(t *testing.T) {
1515

provider/rediscloud_private_link_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
1010
)
1111

12-
const testPrivateLinkConfigFile = "./privatelink/testdata/testPrivateLink.tf"
12+
const testPrivateLinkConfigFile = "./privatelink/testdata/pro_private_link.tf"
1313

1414
func TestAccResourceRedisCloudPrivateLink_CRUDI(t *testing.T) {
1515

@@ -39,8 +39,8 @@ func TestAccResourceRedisCloudPrivateLink_CRUDI(t *testing.T) {
3939
resource.TestCheckResourceAttrSet(resourceName, "resource_configuration_id"),
4040
resource.TestCheckResourceAttrSet(resourceName, "resource_configuration_arn"),
4141
resource.TestCheckResourceAttrSet(resourceName, "share_arn"),
42-
resource.TestCheckResourceAttr(resourceName, "connections.#", "0"),
43-
resource.TestCheckResourceAttr(resourceName, "databases.#", "0"),
42+
resource.TestCheckResourceAttrSet(resourceName, "connections.#"),
43+
resource.TestCheckResourceAttr(resourceName, "databases.#", "1"),
4444

4545
resource.TestCheckResourceAttrSet(datasourceName, "id"),
4646
resource.TestCheckResourceAttrSet(datasourceName, "subscription_id"),
@@ -49,8 +49,8 @@ func TestAccResourceRedisCloudPrivateLink_CRUDI(t *testing.T) {
4949
resource.TestCheckResourceAttrSet(datasourceName, "resource_configuration_id"),
5050
resource.TestCheckResourceAttrSet(datasourceName, "resource_configuration_arn"),
5151
resource.TestCheckResourceAttrSet(datasourceName, "share_arn"),
52-
resource.TestCheckResourceAttr(datasourceName, "connections.#", "0"),
53-
resource.TestCheckResourceAttr(datasourceName, "databases.#", "0"),
52+
resource.TestCheckResourceAttrSet(datasourceName, "connections.#"),
53+
resource.TestCheckResourceAttr(datasourceName, "databases.#", "1"),
5454

5555
//resource.TestCheckResourceAttrSet(datasourceScriptName, "id"),
5656
//resource.TestCheckResourceAttrSet(datasourceScriptName, "subscription_id"),
@@ -71,5 +71,7 @@ func getRedisPrivateLinkConfig(t *testing.T, shareName string) string {
7171
exampleCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME")
7272

7373
content := getTestConfig(t, testPrivateLinkConfigFile)
74-
return fmt.Sprintf(content, subName, exampleCloudAccountName, shareName)
74+
password := acctest.RandString(20)
75+
76+
return fmt.Sprintf(content, subName, exampleCloudAccountName, shareName, password)
7577
}

0 commit comments

Comments
 (0)