Skip to content

Commit c8ac611

Browse files
authored
add connectivity rule support (#338)
* add connectivity rule support * set cr on namespace * Update cloud-sdk reference * fixing * adding namespace update with cr example * fix tests * address comments * fixing null case for connectivity rule ids * fixing test * address code comments * add validator more than 1 * add RemoveResource state back in Read
1 parent 76d4a8b commit c8ac611

File tree

18 files changed

+1012
-27
lines changed

18 files changed

+1012
-27
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ testacc:
1515
test-namespace-export-sink:
1616
TF_ACC=1 go test ./internal/provider -run TestAccNamespaceExportSink_GCS -v $(TESTARGS) -timeout 120m
1717

18+
test-connectivity-rule:
19+
TF_ACC=1 go test ./internal/provider -run TestAccNamespaceWithCodecServer -v $(TESTARGS) -timeout 120m

docs/data-sources/user.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "temporalcloud_user Data Source - terraform-provider-temporalcloud"
4+
subcategory: ""
5+
description: |-
6+
Fetches details about a User.
7+
---
8+
9+
# temporalcloud_user (Data Source)
10+
11+
Fetches details about a User.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `id` (String) The unique identifier of the User.
21+
22+
### Optional
23+
24+
- `namespace_accesses` (Attributes Set) The set of namespace permissions for this user, including each namespace and its role. (see [below for nested schema](#nestedatt--namespace_accesses))
25+
26+
### Read-Only
27+
28+
- `account_access` (String) The role on the account. Must be one of admin, developer, or read (case-insensitive).
29+
- `created_at` (String) The creation time of the User.
30+
- `email` (String) The email of the User.
31+
- `state` (String) The current state of the User.
32+
- `updated_at` (String) The last update time of the User.
33+
34+
<a id="nestedatt--namespace_accesses"></a>
35+
### Nested Schema for `namespace_accesses`
36+
37+
Read-Only:
38+
39+
- `namespace_id` (String) The namespace to assign permissions to.
40+
- `permission` (String) The permission to assign. Must be one of admin, write, or read (case-insensitive)

docs/data-sources/users.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "temporalcloud_users Data Source - terraform-provider-temporalcloud"
4+
subcategory: ""
5+
description: |-
6+
Fetches details about all Users.
7+
---
8+
9+
# temporalcloud_users (Data Source)
10+
11+
Fetches details about all Users.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Read-Only
19+
20+
- `id` (String) The unique identifier of the Users data source.
21+
- `users` (Attributes List) The list of Users. (see [below for nested schema](#nestedatt--users))
22+
23+
<a id="nestedatt--users"></a>
24+
### Nested Schema for `users`
25+
26+
Optional:
27+
28+
- `namespace_accesses` (Attributes Set) The set of namespace permissions for this user, including each namespace and its role. (see [below for nested schema](#nestedatt--users--namespace_accesses))
29+
30+
Read-Only:
31+
32+
- `account_access` (String) The role on the account. Must be one of admin, developer, or read (case-insensitive).
33+
- `created_at` (String) The creation time of the User.
34+
- `email` (String) The email of the User.
35+
- `id` (String) The unique identifier of the User.
36+
- `state` (String) The current state of the User.
37+
- `updated_at` (String) The last update time of the User.
38+
39+
<a id="nestedatt--users--namespace_accesses"></a>
40+
### Nested Schema for `users.namespace_accesses`
41+
42+
Read-Only:
43+
44+
- `namespace_id` (String) The namespace to assign permissions to.
45+
- `permission` (String) The permission to assign. Must be one of admin, write, or read (case-insensitive)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "temporalcloud_connectivity_rule Resource - terraform-provider-temporalcloud"
4+
subcategory: ""
5+
description: |-
6+
Provisions a Temporal Cloud Connectivity Rule.
7+
---
8+
9+
# temporalcloud_connectivity_rule (Resource)
10+
11+
Provisions a Temporal Cloud Connectivity Rule.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `connectivity_type` (String) The type of connectivity. Must be one of 'public' or 'private'.
21+
22+
### Optional
23+
24+
- `connection_id` (String) The connection ID of the private connection.
25+
- `gcp_project_id` (String) The GCP project ID. Required when cloud_provider is 'gcp'.
26+
- `region` (String) The region of the connection. Example: 'aws-us-west-2'.
27+
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
28+
29+
### Read-Only
30+
31+
- `id` (String) The unique identifier of the Connectivity Rule.
32+
33+
<a id="nestedblock--timeouts"></a>
34+
### Nested Schema for `timeouts`
35+
36+
Optional:
37+
38+
- `create` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
39+
- `delete` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.

docs/resources/namespace.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,19 @@ resource "temporalcloud_namespace" "terraform3" {
130130
prevent_destroy = true
131131
}
132132
}
133+
134+
// Attaching connectivity rules to a namespace
135+
resource "temporalcloud_namespace" "terraform4" {
136+
name = "terraform4"
137+
regions = ["aws-us-east-1"]
138+
accepted_client_ca = base64encode(tls_self_signed_cert.ca.cert_pem)
139+
retention_days = 14
140+
// This is a placeholder rule ID. Please create a connectivity rule first,
141+
// then replace this value with the actual ID returned after creation.
142+
connectivity_rule_ids = [
143+
"0f806bg8-fe63-461c-81b3-17e3tcb0574b"
144+
]
145+
}
133146
```
134147

135148
<!-- schema generated by tfplugindocs -->
@@ -147,6 +160,7 @@ resource "temporalcloud_namespace" "terraform3" {
147160
- `api_key_auth` (Boolean) If true, Temporal Cloud will enable API key authentication for this namespace.
148161
- `certificate_filters` (Attributes List) A list of filters to apply to client certificates when initiating a connection Temporal Cloud. If present, connections will only be allowed from client certificates whose distinguished name properties match at least one of the filters. Empty lists are not allowed, omit the attribute instead. (see [below for nested schema](#nestedatt--certificate_filters))
149162
- `codec_server` (Attributes) A codec server is used by the Temporal Cloud UI to decode payloads for all users interacting with this namespace, even if the workflow history itself is encrypted. (see [below for nested schema](#nestedatt--codec_server))
163+
- `connectivity_rule_ids` (List of String) The IDs of the connectivity rules for this namespace.
150164
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
151165

152166
### Read-Only
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
terraform {
2+
required_providers {
3+
temporalcloud = {
4+
source = "temporalio/temporalcloud"
5+
}
6+
}
7+
}
8+
9+
provider "temporalcloud" {
10+
11+
}
12+
13+
// Create Public Connectivity Rule
14+
resource "temporalcloud_connectivity_rule" "public_rule" {
15+
connectivity_type = "public"
16+
}
17+
18+
// Create Private Connectivity Rule for AWS
19+
resource "temporalcloud_connectivity_rule" "private_aws" {
20+
connectivity_type = "private"
21+
connection_id = "vpce-12345678"
22+
region = "aws-us-west-2"
23+
}
24+
25+
// Create Private Connectivity Rule for GCP
26+
resource "temporalcloud_connectivity_rule" "private_gcp" {
27+
connectivity_type = "private"
28+
connection_id = "vpce-12345678"
29+
region = "gcp-us-central1"
30+
gcp_project_id = "my-gcp-project-id"
31+
}
32+

examples/resources/temporalcloud_namespace/resource.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,16 @@ resource "temporalcloud_namespace" "terraform3" {
109109
prevent_destroy = true
110110
}
111111
}
112+
113+
// Attaching connectivity rules to a namespace
114+
resource "temporalcloud_namespace" "terraform4" {
115+
name = "terraform4"
116+
regions = ["aws-us-east-1"]
117+
accepted_client_ca = base64encode(tls_self_signed_cert.ca.cert_pem)
118+
retention_days = 14
119+
// This is a placeholder rule ID. Please create a connectivity rule first,
120+
// then replace this value with the actual ID returned after creation.
121+
connectivity_rule_ids = [
122+
"0f806bg8-fe63-461c-81b3-17e3tcb0574b"
123+
]
124+
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ require (
1515
github.com/hashicorp/terraform-plugin-testing v1.13.1
1616
github.com/jpillora/maplock v0.0.0-20160420012925-5c725ac6e22a
1717
go.temporal.io/api v1.50.0
18-
go.temporal.io/cloud-sdk v0.3.1
18+
go.temporal.io/cloud-sdk v0.4.1
1919
go.temporal.io/sdk v1.35.0
2020
google.golang.org/grpc v1.73.0
2121
google.golang.org/protobuf v1.36.6

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt
238238
go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc=
239239
go.temporal.io/api v1.50.0 h1:7s8Cn+fKfNx9G0v2Ge9We6X2WiCA3JvJ9JryeNbx1Bc=
240240
go.temporal.io/api v1.50.0/go.mod h1:iaxoP/9OXMJcQkETTECfwYq4cw/bj4nwov8b3ZLVnXM=
241-
go.temporal.io/cloud-sdk v0.3.1 h1:yhS0XnPOnsu80opXIgFnihGU3tBeHHQA479GHUo/cv8=
242-
go.temporal.io/cloud-sdk v0.3.1/go.mod h1:AueDDyuayosk+zalfrnuftRqnRQTHwD0HYwNgEQc0YE=
241+
go.temporal.io/cloud-sdk v0.4.1 h1:hvf6Hqto+1lwlfpvSLOKO/0ATpoYC8Cfh1w0gjWo39A=
242+
go.temporal.io/cloud-sdk v0.4.1/go.mod h1:AueDDyuayosk+zalfrnuftRqnRQTHwD0HYwNgEQc0YE=
243243
go.temporal.io/sdk v1.35.0 h1:lRNAQ5As9rLgYa7HBvnmKyzxLcdElTuoFJ0FXM/AsLQ=
244244
go.temporal.io/sdk v1.35.0/go.mod h1:1q5MuLc2MEJ4lneZTHJzpVebW2oZnyxoIOWX3oFVebw=
245245
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=

0 commit comments

Comments
 (0)