Skip to content

Commit

Permalink
11.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SupportSDM committed Sep 19, 2024
1 parent 5652290 commit e00b2fc
Show file tree
Hide file tree
Showing 24 changed files with 10,424 additions and 7,856 deletions.
6 changes: 6 additions & 0 deletions docs/data-sources/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ In addition to provided arguments above, the following attributes are returned b
* `name` - Unique human-readable name of the Gateway. Node names must include only letters, numbers, and hyphens (no spaces, underscores, or other special characters). Generated if not provided on create.
* `tags` - Tags is a map of key, value pairs.
* `version` - Version is a read only sdm binary version uploaded by the gateway process when it comes online.
* proxy_cluster:
* `address` - The public hostname/port tuple at which the proxy cluster will be accessible to clients.
* `id` - Unique identifier of the Proxy Cluster.
* `maintenance_window` - Maintenance Windows define when this node is allowed to restart. If a node is requested to restart, it will check each window to determine if any of them permit it to restart, and if any do, it will. This check is repeated per window until the restart is successfully completed. If not set here, may be set on the command line or via an environment variable on the process itself; any server setting will take precedence over local settings. This setting is ineffective for nodes below version 38.44.0. If this setting is not applied via this remote configuration or via local configuration, the default setting is used: always allow restarts if serving no connections, and allow a restart even if serving connections between 7-8 UTC, any day.
* `name` - Unique human-readable name of the proxy cluster. Names must include only letters, numbers, and hyphens (no spaces, underscores, or other special characters). Generated if not provided on create.
* `tags` - Tags is a map of key, value pairs.
* relay:
* `device` - Device is a read only device name uploaded by the gateway process when it comes online.
* `gateway_filter` - GatewayFilter can be used to restrict the peering between relays and gateways. Deprecated.
Expand Down
30 changes: 30 additions & 0 deletions docs/data-sources/proxy_cluster_key.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
page_title: "SDM: sdm_proxy_cluster_key"
description: |-
Query for existing ProxyClusterKeys instances.
layout: “sdm”
sidebar_current: “docs-sdm-datasource-proxy-cluster-key"
---
# Data Source: sdm_proxy_cluster_key

Proxy Cluster Keys are authentication keys for all proxies within a cluster.
The proxies within a cluster share the same key. One cluster can have
multiple keys in order to facilitate key rotation.
## Example Usage

```hcl
data "sdm_proxy_cluster_key" "proxy_cluster_key_query" {
proxy_cluster_id = "n-233332245"
}
```
## Argument Reference
The following arguments are supported by a ProxyClusterKeys data source:
* `id` - (Optional) Unique identifier of the Relay.
* `proxy_cluster_id` - (Optional) The ID of the proxy cluster which this key authenticates to.
## Attribute Reference
In addition to provided arguments above, the following attributes are returned by a ProxyClusterKeys data source:
* `id` - a generated id representing this request, unrelated to input id and sdm_proxy_cluster_key ids.
* `ids` - a list of strings of ids of data sources that match the given arguments.
* `proxy_cluster_keys` - A list where each element has the following attributes:
* `id` - Unique identifier of the Relay.
* `proxy_cluster_id` - The ID of the proxy cluster which this key authenticates to.
5 changes: 5 additions & 0 deletions docs/resources/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ The following arguments are supported by the Node resource:
* `maintenance_window` - (Optional) Maintenance Windows define when this node is allowed to restart. If a node is requested to restart, it will check each window to determine if any of them permit it to restart, and if any do, it will. This check is repeated per window until the restart is successfully completed. If not set here, may be set on the command line or via an environment variable on the process itself; any server setting will take precedence over local settings. This setting is ineffective for nodes below version 38.44.0. If this setting is not applied via this remote configuration or via local configuration, the default setting is used: always allow restarts if serving no connections, and allow a restart even if serving connections between 7-8 UTC, any day.
* `name` - (Optional) Unique human-readable name of the Gateway. Node names must include only letters, numbers, and hyphens (no spaces, underscores, or other special characters). Generated if not provided on create.
* `tags` - (Optional) Tags is a map of key, value pairs.
* proxy_cluster:
* `address` - (Required) The public hostname/port tuple at which the proxy cluster will be accessible to clients.
* `maintenance_window` - (Optional) Maintenance Windows define when this node is allowed to restart. If a node is requested to restart, it will check each window to determine if any of them permit it to restart, and if any do, it will. This check is repeated per window until the restart is successfully completed. If not set here, may be set on the command line or via an environment variable on the process itself; any server setting will take precedence over local settings. This setting is ineffective for nodes below version 38.44.0. If this setting is not applied via this remote configuration or via local configuration, the default setting is used: always allow restarts if serving no connections, and allow a restart even if serving connections between 7-8 UTC, any day.
* `name` - (Optional) Unique human-readable name of the proxy cluster. Names must include only letters, numbers, and hyphens (no spaces, underscores, or other special characters). Generated if not provided on create.
* `tags` - (Optional) Tags is a map of key, value pairs.
* relay:
* `gateway_filter` - (Optional) GatewayFilter can be used to restrict the peering between relays and gateways. Deprecated.
* `maintenance_window` - (Optional) Maintenance Windows define when this node is allowed to restart. If a node is requested to restart, it will check each window to determine if any of them permit it to restart, and if any do, it will. This check is repeated per window until the restart is successfully completed. If not set here, may be set on the command line or via an environment variable on the process itself; any server setting will take precedence over local settings. This setting is ineffective for nodes below version 38.44.0. If this setting is not applied via this remote configuration or via local configuration, the default setting is used: always allow restarts if serving no connections, and allow a restart even if serving connections between 7-8 UTC, any day.
Expand Down
32 changes: 32 additions & 0 deletions docs/resources/proxy_cluster_key.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
page_title: "SDM: sdm_proxy_cluster_key"
description: |-
Provides settings for ProxyClusterKey.
layout: “sdm”
sidebar_current: “docs-sdm-resource-proxy-cluster-key"
---
# Resource: sdm_proxy_cluster_key

Proxy Cluster Keys are authentication keys for all proxies within a cluster.
The proxies within a cluster share the same key. One cluster can have
multiple keys in order to facilitate key rotation.
## Example Usage

```hcl
resource "sdm_proxy_cluster_key" "test_proxy_cluster_key" {
proxy_cluster_id = "n-12345123"
}
```
This resource can be imported using the [import](https://www.terraform.io/docs/cli/commands/import.html) command.
## Argument Reference
The following arguments are supported by the ProxyClusterKey resource:
* `proxy_cluster_id` - (Required) The ID of the proxy cluster which this key authenticates to.
## Attribute Reference
In addition to provided arguments above, the following attributes are returned by the ProxyClusterKey resource:
* `id` - A unique identifier for the ProxyClusterKey resource.
## Import
A ProxyClusterKey can be imported using the id, e.g.,

```
$ terraform import sdm_proxy_cluster_key.example gk-12345678
```
44 changes: 44 additions & 0 deletions sdm/data_source_node.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

107 changes: 107 additions & 0 deletions sdm/data_source_proxy_cluster_key.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

113 changes: 113 additions & 0 deletions sdm/data_source_proxy_cluster_key_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
package sdm

import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccSDMProxyClusterKey_DataSourceGet(t *testing.T) {
initAcceptanceTest(t)

proxyCluster, err := createProxyClusterWithPrefix("test")
if err != nil {
t.Fatal("failed to create proxy cluster:", err)
}

if _, err := createProxyClusterKey(proxyCluster.ID); err != nil {
t.Fatal("failed to create proxy cluster key: ", err)
}

dataSourceName := randomWithPrefix("test")
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccSDMProxyClusterKeyGetFilterConfig(dataSourceName, proxyCluster.ID),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.sdm_proxy_cluster_key."+dataSourceName, "proxy_cluster_keys.0.proxy_cluster_id", proxyCluster.ID),
resource.TestCheckResourceAttr("data.sdm_proxy_cluster_key."+dataSourceName, "proxy_cluster_keys.#", "1"),
resource.TestCheckResourceAttr("data.sdm_proxy_cluster_key."+dataSourceName, "ids.#", "1"),
),
},
},
})
}

func TestAccSDMProxyClusterKey_DataSourceGetMultiple(t *testing.T) {
initAcceptanceTest(t)

proxyCluster1, err := createProxyClusterWithPrefix("test")
if err != nil {
t.Fatal("failed to create proxy cluster:", err)
}
proxyCluster2, err := createProxyClusterWithPrefix("test")
if err != nil {
t.Fatal("failed to create proxy cluster:", err)
}

if _, err := createProxyClusterKey(proxyCluster1.ID); err != nil {
t.Fatal("failed to create proxy cluster key: ", err)
}
if _, err := createProxyClusterKey(proxyCluster1.ID); err != nil {
t.Fatal("failed to create proxy cluster key: ", err)
}
if _, err := createProxyClusterKey(proxyCluster2.ID); err != nil {
t.Fatal("failed to create proxy cluster key: ", err)
}

dataSourceName := randomWithPrefix("test")
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccSDMProxyClusterKeyGetFilterConfig(dataSourceName, proxyCluster1.ID),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.sdm_proxy_cluster_key."+dataSourceName, "ids.#", "2"),
resource.TestCheckResourceAttr("data.sdm_proxy_cluster_key."+dataSourceName, "proxy_cluster_keys.0.proxy_cluster_id", proxyCluster1.ID),
resource.TestCheckResourceAttr("data.sdm_proxy_cluster_key."+dataSourceName, "proxy_cluster_keys.1.proxy_cluster_id", proxyCluster1.ID),
resource.TestCheckResourceAttr("data.sdm_proxy_cluster_key."+dataSourceName, "proxy_cluster_keys.#", "2"),
),
},
},
})
}

func TestAccSDMProxyClusterKey_DataSourceGetNone(t *testing.T) {
initAcceptanceTest(t)

proxyCluster, err := createProxyClusterWithPrefix("test")
if err != nil {
t.Fatal("failed to create proxy cluster:", err)
}
_, err = createProxyClusterKey(proxyCluster.ID)
if err != nil {
t.Fatal("failed to create test proxyClusterKey: ", err)
}

dataSourceName := randomWithPrefix("test")
resource.Test(t, resource.TestCase{
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccSDMProxyClusterKeyGetFilterConfig(dataSourceName, "n-00333000"),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.sdm_proxy_cluster_key."+dataSourceName, "proxy_cluster_keys.#", "0"),
resource.TestCheckResourceAttr("data.sdm_proxy_cluster_key."+dataSourceName, "ids.#", "0"),
),
},
},
})
}

func testAccSDMProxyClusterKeyGetFilterConfig(dataSourceName string, proxyClusterID string) string {
return fmt.Sprintf(
`
data "sdm_proxy_cluster_key" "%s" {
proxy_cluster_id = "%s"
}`,
dataSourceName,
proxyClusterID,
)
}
Loading

0 comments on commit e00b2fc

Please sign in to comment.