-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5652290
commit e00b2fc
Showing
24 changed files
with
10,424 additions
and
7,856 deletions.
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
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,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. |
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
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,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 | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,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, | ||
) | ||
} |
Oops, something went wrong.