From a52b62acad585b15e069a69513ced7be4350f6c2 Mon Sep 17 00:00:00 2001 From: Jonathan Lacefield Date: Mon, 4 Nov 2024 14:59:25 -0500 Subject: [PATCH] Updates to documentation * Initial Contributing.MD * Issues/PR and review language added * updates for CLA, license headers, and general improvements * updated the doc for Namespace ca certs and all resource import examples * run go generate --------- Co-authored-by: Abhinav Nekkanti <10552725+anekkanti@users.noreply.github.com> --- docs/resources/apikey.md | 7 ++++++- docs/resources/namespace.md | 9 +++++++-- docs/resources/namespace_search_attribute.md | 15 +++++++++++++++ docs/resources/service_account.md | 7 ++++++- docs/resources/user.md | 7 ++++++- examples/resources/temporalcloud_apikey/import.sh | 7 ++++++- .../resources/temporalcloud_namespace/import.sh | 7 ++++++- .../import.sh | 8 ++++++++ .../temporalcloud_service_account/import.sh | 7 ++++++- examples/resources/temporalcloud_user/import.sh | 7 ++++++- internal/provider/namespace_resource.go | 2 +- 11 files changed, 73 insertions(+), 10 deletions(-) create mode 100644 examples/resources/temporalcloud_namespace_search_attribute/import.sh diff --git a/docs/resources/apikey.md b/docs/resources/apikey.md index 36dbd0f..21e00ef 100644 --- a/docs/resources/apikey.md +++ b/docs/resources/apikey.md @@ -74,5 +74,10 @@ Optional: Import is supported using the following syntax: ```shell -terraform import temporalcloud_apikey.terraform terraform.badf00d +# API Keys can be imported to incorporate existing API Keys into your Terraform pipeline. +# To import an API Key, you need +# - a resource configuration in your Terraform configuration file/module to accept the imported API Key. In the example below, the placeholder is "temporalcloud_apikey" "tfapikey" +# - the API Key's ID, which is found when clicking into an API Key in the Temporal Cloud UI. In the example below, this is zJV5zQ3IhsAbw75dAkVNEMsAd3a5AemC + +terraform import temporalcloud_apikey.tfapikey zJV5zQ3IhsAbw75dAkVNEMsAd3a5AemC ``` diff --git a/docs/resources/namespace.md b/docs/resources/namespace.md index 785342a..d42f368 100644 --- a/docs/resources/namespace.md +++ b/docs/resources/namespace.md @@ -122,7 +122,7 @@ resource "temporalcloud_namespace" "terraform3" { ### Optional -- `accepted_client_ca` (String) The Base64-encoded CA cert in PEM format that clients use when authenticating with Temporal Cloud. +- `accepted_client_ca` (String) The Base64-encoded CA cert in PEM format that clients use when authenticating with Temporal Cloud. This is a required field when a Namespace uses mTLS authentication. - `api_key_auth` (Boolean) If true, Temporal Cloud will use API key authentication for this namespace. If false, mutual TLS (mTLS) authentication will be used. - `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. (see [below for nested schema](#nestedatt--certificate_filters)) - `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)) @@ -180,5 +180,10 @@ Read-Only: Import is supported using the following syntax: ```shell -terraform import temporalcloud_namespace.terraform terraform.badf00d +# Namespace can be imported to incorporate existing Namespaces into your Terraform pipeline. +# To import a Namespace, you need +# - a resource configuration in your Terraform configuration file/module to accept the imported Namespace. In the example below, the placeholder is "temporalcloud_namespace" "terraform" +# - the Namespace ID, which includes the Namespace Name and Account ID available at the top of the Namespace's page in the Temporal Cloud UI. In the example below, this is namespaceid.acctid + +terraform import temporalcloud_namespace.terraform namespaceid.acctid ``` diff --git a/docs/resources/namespace_search_attribute.md b/docs/resources/namespace_search_attribute.md index cf3ed73..9be2cba 100644 --- a/docs/resources/namespace_search_attribute.md +++ b/docs/resources/namespace_search_attribute.md @@ -63,3 +63,18 @@ resource "temporalcloud_namespace_search_attribute" "custom_search_attribute3" { ### Read-Only - `id` (String) The ID of this search attribute. + +## Import + +Import is supported using the following syntax: + +```shell +# Search Attributes can be imported to incorporate existing Namespace Search Attributes into your Terraform pipeline. +# To import a Search Attribute, you need +# - a resource configuration in your Terraform configuration file/module to accept the imported Search Attribute. In the example below, the placeholder is "temporalcloud_namespace_search_attribute" "saimport" +# - the Namespace ID, which includes the Namespace Name and Account ID available at the top of the Namespace's page in the Temporal Cloud UI. In the example below, this is namespaceid.acctid +# - the name of the Search Attribute, which is available in the Search Attribute configuration of Namespace's page in the Temporal Cloud UI. In the example below, this is searchAttr + + +terraform import temporalcloud_namespace_search_attribute.saimport namespaceid.acctid/searchAttr +``` diff --git a/docs/resources/service_account.md b/docs/resources/service_account.md index ede86db..1313b2c 100644 --- a/docs/resources/service_account.md +++ b/docs/resources/service_account.md @@ -89,5 +89,10 @@ Optional: Import is supported using the following syntax: ```shell -terraform import temporalcloud_service_account.terraform terraform.badf00d +# Service Accounts can be imported to incorporate existing Service Accounts into your Terraform pipeline. +# To import a Service Account, you need +# - a resource configuration in your Terraform configuration file/module to accept the imported Service Account. In the example below, the placeholder is "temporalcloud_service_account" "saimport" +# - the Service Accounts's ID, which is found using the Temporal Cloud CLI tcld sa l. In the example below, this is e3cb94fbdbb845f480044d053d00665b + +terraform import temporalcloud_service_account.saimport e3cb94fbdbb845f480044d053d00665b ``` diff --git a/docs/resources/user.md b/docs/resources/user.md index 6263db9..5cb89f3 100644 --- a/docs/resources/user.md +++ b/docs/resources/user.md @@ -89,5 +89,10 @@ Optional: Import is supported using the following syntax: ```shell -terraform import temporalcloud_user.terraform terraform.badf00d +# Users can be imported to incorporate existing Users into your Terraform pipeline. +# To import a User, you need +# - a resource configuration in your Terraform configuration file/module to accept the imported User. In the example below, the placeholder is "temporalcloud_user" "user" +# - the User's ID, which is found using the Temporal Cloud CLI tcld u l. In the example below, this is 72360058153949edb2f1d47019c1e85f + +terraform import temporalcloud_user.user 72360058153949edb2f1d47019c1e85f ``` diff --git a/examples/resources/temporalcloud_apikey/import.sh b/examples/resources/temporalcloud_apikey/import.sh index f889bfb..416b61e 100644 --- a/examples/resources/temporalcloud_apikey/import.sh +++ b/examples/resources/temporalcloud_apikey/import.sh @@ -1 +1,6 @@ -terraform import temporalcloud_apikey.terraform terraform.badf00d +# API Keys can be imported to incorporate existing API Keys into your Terraform pipeline. +# To import an API Key, you need +# - a resource configuration in your Terraform configuration file/module to accept the imported API Key. In the example below, the placeholder is "temporalcloud_apikey" "tfapikey" +# - the API Key's ID, which is found when clicking into an API Key in the Temporal Cloud UI. In the example below, this is zJV5zQ3IhsAbw75dAkVNEMsAd3a5AemC + +terraform import temporalcloud_apikey.tfapikey zJV5zQ3IhsAbw75dAkVNEMsAd3a5AemC \ No newline at end of file diff --git a/examples/resources/temporalcloud_namespace/import.sh b/examples/resources/temporalcloud_namespace/import.sh index daf457d..f300674 100644 --- a/examples/resources/temporalcloud_namespace/import.sh +++ b/examples/resources/temporalcloud_namespace/import.sh @@ -1 +1,6 @@ -terraform import temporalcloud_namespace.terraform terraform.badf00d \ No newline at end of file +# Namespace can be imported to incorporate existing Namespaces into your Terraform pipeline. +# To import a Namespace, you need +# - a resource configuration in your Terraform configuration file/module to accept the imported Namespace. In the example below, the placeholder is "temporalcloud_namespace" "terraform" +# - the Namespace ID, which includes the Namespace Name and Account ID available at the top of the Namespace's page in the Temporal Cloud UI. In the example below, this is namespaceid.acctid + +terraform import temporalcloud_namespace.terraform namespaceid.acctid \ No newline at end of file diff --git a/examples/resources/temporalcloud_namespace_search_attribute/import.sh b/examples/resources/temporalcloud_namespace_search_attribute/import.sh new file mode 100644 index 0000000..e916121 --- /dev/null +++ b/examples/resources/temporalcloud_namespace_search_attribute/import.sh @@ -0,0 +1,8 @@ +# Search Attributes can be imported to incorporate existing Namespace Search Attributes into your Terraform pipeline. +# To import a Search Attribute, you need +# - a resource configuration in your Terraform configuration file/module to accept the imported Search Attribute. In the example below, the placeholder is "temporalcloud_namespace_search_attribute" "saimport" +# - the Namespace ID, which includes the Namespace Name and Account ID available at the top of the Namespace's page in the Temporal Cloud UI. In the example below, this is namespaceid.acctid +# - the name of the Search Attribute, which is available in the Search Attribute configuration of Namespace's page in the Temporal Cloud UI. In the example below, this is searchAttr + + +terraform import temporalcloud_namespace_search_attribute.saimport namespaceid.acctid/searchAttr \ No newline at end of file diff --git a/examples/resources/temporalcloud_service_account/import.sh b/examples/resources/temporalcloud_service_account/import.sh index 3e355d8..8efaa09 100644 --- a/examples/resources/temporalcloud_service_account/import.sh +++ b/examples/resources/temporalcloud_service_account/import.sh @@ -1 +1,6 @@ -terraform import temporalcloud_service_account.terraform terraform.badf00d +# Service Accounts can be imported to incorporate existing Service Accounts into your Terraform pipeline. +# To import a Service Account, you need +# - a resource configuration in your Terraform configuration file/module to accept the imported Service Account. In the example below, the placeholder is "temporalcloud_service_account" "saimport" +# - the Service Accounts's ID, which is found using the Temporal Cloud CLI tcld sa l. In the example below, this is e3cb94fbdbb845f480044d053d00665b + +terraform import temporalcloud_service_account.saimport e3cb94fbdbb845f480044d053d00665b \ No newline at end of file diff --git a/examples/resources/temporalcloud_user/import.sh b/examples/resources/temporalcloud_user/import.sh index 2e65c27..e274b60 100644 --- a/examples/resources/temporalcloud_user/import.sh +++ b/examples/resources/temporalcloud_user/import.sh @@ -1 +1,6 @@ -terraform import temporalcloud_user.terraform terraform.badf00d \ No newline at end of file +# Users can be imported to incorporate existing Users into your Terraform pipeline. +# To import a User, you need +# - a resource configuration in your Terraform configuration file/module to accept the imported User. In the example below, the placeholder is "temporalcloud_user" "user" +# - the User's ID, which is found using the Temporal Cloud CLI tcld u l. In the example below, this is 72360058153949edb2f1d47019c1e85f + +terraform import temporalcloud_user.user 72360058153949edb2f1d47019c1e85f \ No newline at end of file diff --git a/internal/provider/namespace_resource.go b/internal/provider/namespace_resource.go index 5f826f6..ca711ba 100644 --- a/internal/provider/namespace_resource.go +++ b/internal/provider/namespace_resource.go @@ -173,7 +173,7 @@ func (r *namespaceResource) Schema(ctx context.Context, _ resource.SchemaRequest }, "accepted_client_ca": schema.StringAttribute{ CustomType: internaltypes.EncodedCAType{}, - Description: "The Base64-encoded CA cert in PEM format that clients use when authenticating with Temporal Cloud.", + Description: "The Base64-encoded CA cert in PEM format that clients use when authenticating with Temporal Cloud. This is a required field when a Namespace uses mTLS authentication.", Optional: true, }, "retention_days": schema.Int64Attribute{