-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nexus Endpoint resource #221
Open
nikki-dag
wants to merge
4
commits into
main
Choose a base branch
from
nikki/nexus
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+722
−0
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "temporalcloud_nexus_endpoint Resource - terraform-provider-temporalcloud" | ||
subcategory: "" | ||
description: |- | ||
Provisions a Temporal Cloud Nexus endpoint. | ||
--- | ||
|
||
# temporalcloud_nexus_endpoint (Resource) | ||
|
||
Provisions a Temporal Cloud Nexus endpoint. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
terraform { | ||
required_providers { | ||
temporalcloud = { | ||
source = "temporalio/temporalcloud" | ||
} | ||
} | ||
} | ||
|
||
resource "temporalcloud_namespace" "target_namespace" { | ||
name = "terraform-target-namespace" | ||
regions = ["aws-us-west-2"] | ||
api_key_auth = true | ||
retention_days = 14 | ||
timeouts { | ||
create = "10m" | ||
delete = "10m" | ||
} | ||
} | ||
|
||
resource "temporalcloud_namespace" "caller_namespace" { | ||
name = "terraform-caller-namespace" | ||
regions = ["aws-us-east-1"] | ||
api_key_auth = true | ||
retention_days = 14 | ||
timeouts { | ||
create = "10m" | ||
delete = "10m" | ||
} | ||
} | ||
|
||
resource "temporalcloud_namespace" "caller_namespace_2" { | ||
name = "terraform-caller-namespace-2" | ||
regions = ["gcp-us-central1"] | ||
api_key_auth = true | ||
retention_days = 14 | ||
timeouts { | ||
create = "10m" | ||
delete = "10m" | ||
} | ||
} | ||
|
||
resource "temporalcloud_nexus_endpoint" "nexus_endpoint" { | ||
name = "terraform-nexus-endpoint" | ||
description = <<-EOT | ||
Service Name: | ||
my-hello-service | ||
Operation Names: | ||
echo | ||
say-hello | ||
|
||
Input / Output arguments are in the following repository: | ||
https://github.com/temporalio/samples-go/blob/main/nexus/service/api.go | ||
EOT | ||
worker_target_spec = { | ||
namespace_id = temporalcloud_namespace.target_namespace.id | ||
task_queue = "terraform-task-queue" | ||
} | ||
allowed_caller_namespaces = [ | ||
temporalcloud_namespace.caller_namespace.id, | ||
temporalcloud_namespace.caller_namespace_2.id, | ||
] | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `allowed_caller_namespaces` (Set of String) Namespace(s) that are allowed to call this Endpoint. | ||
- `name` (String) The name of the endpoint. Must be unique within an account and match `^[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9]$` | ||
- `worker_target_spec` (Attributes) A target spec for routing nexus requests to a specific cloud namespace worker. (see [below for nested schema](#nestedatt--worker_target_spec)) | ||
|
||
### Optional | ||
|
||
- `description` (String, Sensitive) The description for the Nexus endpoint. | ||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The unique identifier of the Nexus endpoint. | ||
|
||
<a id="nestedatt--worker_target_spec"></a> | ||
### Nested Schema for `worker_target_spec` | ||
|
||
Required: | ||
|
||
- `namespace_id` (String) The target cloud namespace to route requests to. Namespace must be in same account as the endpoint. | ||
- `task_queue` (String) The task queue on the cloud namespace to route requests to. | ||
|
||
|
||
<a id="nestedblock--timeouts"></a> | ||
### Nested Schema for `timeouts` | ||
|
||
Optional: | ||
|
||
- `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). | ||
- `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. | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
# Nexus Endpoints can be imported to incorporate existing Nexus Endpoints into your Terraform pipeline. | ||
# To import a Nexus Endpoint, you need | ||
# - a resource configuration in your Terraform configuration file/module to accept the imported Nexus Endpoint. In the example below, the placeholder is "temporalcloud_nexus_endpoint" "nexus_endpoint" | ||
# - the Nexus Endpoint's ID, which is found using the Temporal Cloud CLI tcld nexus endpoint list. In the example below, this is 405f7da4224a43d99c211904ed9b3819 | ||
|
||
terraform import temporalcloud_nexus_endpoint.nexus_endpoint 405f7da4224a43d99c211904ed9b3819 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Nexus Endpoints can be imported to incorporate existing Nexus Endpoints into your Terraform pipeline. | ||
# To import a Nexus Endpoint, you need | ||
# - a resource configuration in your Terraform configuration file/module to accept the imported Nexus Endpoint. In the example below, the placeholder is "temporalcloud_nexus_endpoint" "nexus_endpoint" | ||
# - the Nexus Endpoint's ID, which is found using the Temporal Cloud CLI tcld nexus endpoint list. In the example below, this is 405f7da4224a43d99c211904ed9b3819 | ||
|
||
terraform import temporalcloud_nexus_endpoint.nexus_endpoint 405f7da4224a43d99c211904ed9b3819 |
62 changes: 62 additions & 0 deletions
62
examples/resources/temporalcloud_nexus_endpoint/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
terraform { | ||
required_providers { | ||
temporalcloud = { | ||
source = "temporalio/temporalcloud" | ||
} | ||
} | ||
} | ||
|
||
resource "temporalcloud_namespace" "target_namespace" { | ||
name = "terraform-target-namespace" | ||
regions = ["aws-us-west-2"] | ||
api_key_auth = true | ||
retention_days = 14 | ||
timeouts { | ||
create = "10m" | ||
delete = "10m" | ||
} | ||
} | ||
|
||
resource "temporalcloud_namespace" "caller_namespace" { | ||
name = "terraform-caller-namespace" | ||
regions = ["aws-us-east-1"] | ||
api_key_auth = true | ||
retention_days = 14 | ||
timeouts { | ||
create = "10m" | ||
delete = "10m" | ||
} | ||
} | ||
|
||
resource "temporalcloud_namespace" "caller_namespace_2" { | ||
name = "terraform-caller-namespace-2" | ||
regions = ["gcp-us-central1"] | ||
api_key_auth = true | ||
retention_days = 14 | ||
timeouts { | ||
create = "10m" | ||
delete = "10m" | ||
} | ||
} | ||
|
||
resource "temporalcloud_nexus_endpoint" "nexus_endpoint" { | ||
name = "terraform-nexus-endpoint" | ||
description = <<-EOT | ||
Service Name: | ||
my-hello-service | ||
Operation Names: | ||
echo | ||
say-hello | ||
|
||
Input / Output arguments are in the following repository: | ||
https://github.com/temporalio/samples-go/blob/main/nexus/service/api.go | ||
EOT | ||
worker_target_spec = { | ||
namespace_id = temporalcloud_namespace.target_namespace.id | ||
task_queue = "terraform-task-queue" | ||
} | ||
allowed_caller_namespaces = [ | ||
temporalcloud_namespace.caller_namespace.id, | ||
temporalcloud_namespace.caller_namespace_2.id, | ||
] | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine but I'm wondering if it'd be better to make the API a little more future-proof. Here's an example:
But what you have is probably better for type safety.
Let's keep it as is.