Skip to content

Commit bdb5cdd

Browse files
committed
feat: adding privatelink
1 parent 64009d2 commit bdb5cdd

File tree

84 files changed

+2677
-561
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+2677
-561
lines changed

docs/data-sources/rediscloud_active_active_private_link.md

Whitespace-only changes.

docs/data-sources/rediscloud_private_link.md

Whitespace-only changes.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
layout: "rediscloud"
3+
page_title: "Redis Cloud: rediscloud_active_active_private_link"
4+
description: |-
5+
PrivateLink resource for Active Active Subscription in the Redis Cloud Terraform provider.
6+
---
7+
8+
# Resource: rediscloud_active_activeprivate_link
9+
10+
Manages a PrivateLink to a Active Active Subscription in your Redis Enterprise Cloud Account.
11+
12+
## Example Usage
13+
14+
## Argument Reference
15+
16+
* `subscription_id` - (Required) The ID of the Pro Subscription to **Modifying this attribute will force creation of a new resource.**
17+
* `share_name` - (Required)
18+
* `principal` - (Required) (block)
19+
* `region_id` - (Required)
20+
21+
## Attribute Reference
22+
23+
* `resource_configuration_id`
24+
* `resource_configuration_arn`
25+
* `share_arn`
26+
* `connections` (block)
27+
* `databases` (block)
28+
29+
## Import
30+
`rediscloud_private_link` can be imported using the ID of the subscription and the name of the PrivateLink share, e.g.
31+
32+
```
33+
$ terraform import rediscloud_active_active_private_link.id 1000/123456
34+
```
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
layout: "rediscloud"
3+
page_title: "Redis Cloud: rediscloud_private_link"
4+
description: |-
5+
PrivateLink resource for Pro Subscription in the Redis Cloud Terraform provider.
6+
---
7+
8+
# Resource: rediscloud_private_link
9+
10+
Manages a PrivateLink to a Pro Subscription in your Redis Enterprise Cloud Account.
11+
12+
## Example Usage
13+
14+
```hcl
15+
16+
locals {
17+
rediscloud_subscription_name = "..."
18+
rediscloud_cloud_account = "..."
19+
rediscloud_private_link_share_name = "..."
20+
}
21+
22+
data "rediscloud_payment_method" "card" {
23+
card_type = "Visa"
24+
}
25+
26+
data "rediscloud_cloud_account" "account" {
27+
exclude_internal_account = true
28+
provider_type = "AWS"
29+
name = local.rediscloud_cloud_account
30+
}
31+
32+
resource "rediscloud_subscription" "subscription" {
33+
name = local.rediscloud_subscription_name
34+
payment_method_id = data.rediscloud_payment_method.card.id
35+
36+
cloud_provider {
37+
provider = data.rediscloud_cloud_account.account.provider_type
38+
cloud_account_id = data.rediscloud_cloud_account.account.id
39+
region {
40+
region = "eu-west-1"
41+
networking_deployment_cidr = "10.0.0.0/24"
42+
preferred_availability_zones = ["eu-west-1a"]
43+
}
44+
}
45+
46+
creation_plan {
47+
dataset_size_in_gb = 15
48+
quantity = 1
49+
replication = true
50+
throughput_measurement_by = "operations-per-second"
51+
throughput_measurement_value = 20000
52+
}
53+
}
54+
55+
resource "rediscloud_private_link" "private_link" {
56+
subscription_id = rediscloud_subscription.subscription.id
57+
share_name = local.rediscloud_private_link_share_name
58+
59+
principal {
60+
principal = "123456789012"
61+
principal_type = "aws_account"
62+
principal_alias = "principal 1"
63+
}
64+
65+
principal {
66+
principal = "123456789013"
67+
principal_type = "aws_account"
68+
principal_alias = "principal 2"
69+
}
70+
}
71+
```
72+
73+
## Argument Reference
74+
75+
* `subscription_id` - (Required) The ID of the Pro Subscription to attach the PrivateLink to. **Modifying this attribute will force creation of a new resource.**
76+
* `share_name` - (Required) The share name of the PrivateLink.
77+
* `principal` - (Required) The principal(s) attached to the PrivateLink.
78+
79+
The `principal` block supports:
80+
* `principal` - (Required) The principal to be added to this PrivateLink. The format depends upon the type of principal you wish to attach.
81+
* `principal_type` - (Required) The principal type. Can be one of: `aws_account`, `organization`, `organization_unit`, `iam_role`, `iam_user`, `service_principal`.
82+
* `principal_alias` - The friendly name to refer to the principal.
83+
84+
85+
## Attribute Reference
86+
87+
* `resource_configuration_id`
88+
* `resource_configuration_arn`
89+
* `share_arn`
90+
* `connections`
91+
* `databases`
92+
93+
The `connections` object has these attributes:
94+
95+
* `association_id` - Association ID of the PrivateLink connection.
96+
* `connection_id` - Connection ID of the PrivateLink connection
97+
* `connection_type` - Type of the PrivateLink connection.
98+
* `owner_id` - Owner ID of the connection.
99+
* `association_date` - Date the connection was associated.
100+
101+
The `databases` object has these attributes:
102+
* `database_id` - ID of the database.
103+
* `port` - The port which the database is available on.
104+
* `resource_link_endpoint` - The resource link endpoint for the database.
105+
106+
## Import
107+
`rediscloud_private_link` can be imported using the ID of the subscription and the ID of the PrivateLink, e.g.
108+
109+
```
110+
$ terraform import rediscloud_private_service_connect.id 1000/123456
111+
```

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/bflad/tfproviderlint v0.31.0
1010
github.com/hashicorp/go-cty v1.5.0
1111
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0
12-
github.com/stretchr/testify v1.10.0
12+
github.com/stretchr/testify v1.11.1
1313
)
1414

1515
require (
@@ -70,4 +70,4 @@ require (
7070
)
7171

7272
// for local development, uncomment this
73-
//replace github.com/RedisLabs/rediscloud-go-api => ../rediscloud-go-api
73+
replace github.com/RedisLabs/rediscloud-go-api => ../rediscloud-go-api

go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo
44
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
55
github.com/ProtonMail/go-crypto v1.1.6 h1:ZcV+Ropw6Qn0AX9brlQLAUXfqLBc7Bl+f/DmNxpLfdw=
66
github.com/ProtonMail/go-crypto v1.1.6/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE=
7-
github.com/RedisLabs/rediscloud-go-api v0.34.2 h1:K31RyQ0Soow07k9oBdxMAyY45sS+yGcZYuCY0c3gqLU=
8-
github.com/RedisLabs/rediscloud-go-api v0.34.2/go.mod h1:SdjSIrfqR653L+K4Bcpr1HIoiCSluDGIKak+qBelB/M=
97
github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE=
108
github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
119
github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec=
@@ -144,8 +142,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
144142
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
145143
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
146144
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
147-
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
148-
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
145+
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
146+
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
149147
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
150148
github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI=
151149
github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=

provider/client/client.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package client
2+
3+
import (
4+
rediscloudApi "github.com/RedisLabs/rediscloud-go-api"
5+
)
6+
7+
type ApiClient struct {
8+
Client *rediscloudApi.Client
9+
}

provider/datasource_rediscloud_acl_role.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"github.com/RedisLabs/rediscloud-go-api/redis"
66
"github.com/RedisLabs/rediscloud-go-api/service/access_control_lists/roles"
7+
"github.com/RedisLabs/terraform-provider-rediscloud/provider/client"
78
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
89
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
910
"strconv"
@@ -67,7 +68,7 @@ func dataSourceRedisCloudAclRole() *schema.Resource {
6768

6869
func dataSourceRedisCloudAclRoleRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
6970
var diags diag.Diagnostics
70-
api := meta.(*apiClient)
71+
api := meta.(*client.ApiClient)
7172

7273
var filters []func(role *roles.GetRoleResponse) bool
7374
if v, ok := d.GetOk("name"); ok {
@@ -76,7 +77,7 @@ func dataSourceRedisCloudAclRoleRead(ctx context.Context, d *schema.ResourceData
7677
})
7778
}
7879

79-
list, err := api.client.Roles.List(ctx)
80+
list, err := api.Client.Roles.List(ctx)
8081
if err != nil {
8182
return diag.FromErr(err)
8283
}

provider/datasource_rediscloud_acl_rule.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"github.com/RedisLabs/rediscloud-go-api/redis"
66
"github.com/RedisLabs/rediscloud-go-api/service/access_control_lists/redis_rules"
7+
"github.com/RedisLabs/terraform-provider-rediscloud/provider/client"
78
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
89
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
910
"strconv"
@@ -31,7 +32,7 @@ func dataSourceRedisCloudAclRule() *schema.Resource {
3132

3233
func dataSourceRedisCloudAclRuleRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
3334
var diags diag.Diagnostics
34-
api := meta.(*apiClient)
35+
api := meta.(*client.ApiClient)
3536

3637
var filters []func(rule *redis_rules.GetRedisRuleResponse) bool
3738
if v, ok := d.GetOk("name"); ok {
@@ -40,7 +41,7 @@ func dataSourceRedisCloudAclRuleRead(ctx context.Context, d *schema.ResourceData
4041
})
4142
}
4243

43-
list, err := api.client.RedisRules.List(ctx)
44+
list, err := api.Client.RedisRules.List(ctx)
4445
if err != nil {
4546
return diag.FromErr(err)
4647
}

provider/datasource_rediscloud_acl_user.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"github.com/RedisLabs/rediscloud-go-api/redis"
66
"github.com/RedisLabs/rediscloud-go-api/service/access_control_lists/users"
7+
"github.com/RedisLabs/terraform-provider-rediscloud/provider/client"
78
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
89
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
910
"strconv"
@@ -31,7 +32,7 @@ func dataSourceRedisCloudAclUser() *schema.Resource {
3132

3233
func dataSourceRedisCloudAclUserRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
3334
var diags diag.Diagnostics
34-
api := meta.(*apiClient)
35+
api := meta.(*client.ApiClient)
3536

3637
var filters []func(user *users.GetUserResponse) bool
3738
if v, ok := d.GetOk("name"); ok {
@@ -40,7 +41,7 @@ func dataSourceRedisCloudAclUserRead(ctx context.Context, d *schema.ResourceData
4041
})
4142
}
4243

43-
list, err := api.client.Users.List(ctx)
44+
list, err := api.Client.Users.List(ctx)
4445
if err != nil {
4546
return diag.FromErr(err)
4647
}

0 commit comments

Comments
 (0)