-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #614 from rawmind0/secretv2
New rancher2_secret_v2 resource and datausource
- Loading branch information
Showing
17 changed files
with
1,030 additions
and
96 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 |
---|---|---|
|
@@ -16,7 +16,7 @@ build-rancher: validate-rancher | |
|
||
validate-rancher: validate test | ||
|
||
validate: fmtcheck vet lint | ||
validate: fmtcheck lint vet | ||
|
||
package-rancher: | ||
@sh -c "'$(CURDIR)/scripts/gopackage.sh'" | ||
|
@@ -38,11 +38,13 @@ upgrade-rancher: | |
|
||
vet: | ||
@echo "==> Checking that code complies with go vet requirements..." | ||
@go vet $$(go list ./... | grep -v vendor/) ; if [ $$? -gt 0 ]; then \ | ||
@go vet $$(go list ./... | grep -v vendor/); if [ $$? -gt 0 ]; then \ | ||
echo ""; \ | ||
echo "Vet found suspicious constructs. Please check the reported constructs"; \ | ||
echo "and fix them if necessary before submitting the code for review."; \ | ||
exit 1; \ | ||
echo "WARNING!! Expected vet reported construct:"; \ | ||
echo "rancher2/schema_secret_v2.go:20:2: struct field Type repeats json tag \"type\" also at ../../../../github.com/rancher/[email protected]/types/types.go:66"; \ | ||
echo "";\ | ||
echo "If vet reported more suspicious constructs, please check and"; \ | ||
echo "fix them if necessary, before submitting the code for review."; \ | ||
fi | ||
|
||
lint: | ||
|
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,38 @@ | ||
--- | ||
page_title: "rancher2_secret_v2 Datasource" | ||
--- | ||
|
||
# rancher2\_secret\_v2 Datasource | ||
|
||
Use this data source to retrieve information about a Rancher2 secret v2. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
data "rancher2_secret_v2" "foo" { | ||
cluster_id = <CLUSTER_ID> | ||
name = <SECRET_V2_NAME> | ||
namespace = <SECRET_V2_NAMESPACE> | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `cluster_id` - (Required) The cluster id of the secret V2 (string) | ||
* `name` - (Required) The name of the secret v2 (string) | ||
* `namespace` - (Optional) The namespaces of the secret v2. Default: `default` (string) | ||
|
||
|
||
## Attributes Reference | ||
|
||
The following attributes are exported: | ||
|
||
* `id` - (Computed) The ID of the resource (string) | ||
* `resource_version` - (Computed) The k8s resource version (string) | ||
* `data` - (Computed/Sensitive) The data of the secret v2 (map) | ||
* `type` - (Computed) The type of the k8s secret, used to facilitate programmatic handling of secret data, [More info](https://github.com/kubernetes/api/blob/release-1.20/core/v1/types.go#L5772) about k8s secret types and expected format (string) | ||
* `immutable` - (Computed) If set to true, any secret update will remove and recreate the secret. This is a beta field enabled by k8s `ImmutableEphemeralVolumes` feature gate (bool) | ||
* `annotations` - (Computed) Annotations for the secret v2 (map) | ||
* `labels` - (Computed) Labels for the secret v2 (map) |
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,70 @@ | ||
--- | ||
page_title: "Rancher2: rancher2_secret_v2 Resource" | ||
--- | ||
|
||
# rancher2\_secret\_v2 Resource | ||
|
||
Provides a Rancher Secret v2 resource. This can be used to create k8s secrets for Rancher v2 environments and retrieve their information. Secret v2 resource is available at Rancher v2.5.x and above. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
# Create a new Rancher2 Secret V2 | ||
resource "rancher2_secret_v2" "foo" { | ||
cluster_id = <CLUSTER_ID> | ||
name = "foo" | ||
data = { | ||
mydata1 = "<data1>" | ||
mydata2 = "<data2>" | ||
mydata3 = "<data3>" | ||
} | ||
} | ||
# Create a new Rancher2 Secret V2 basic-auth | ||
resource "rancher2_secret_v2" "foo" { | ||
cluster_id = <CLUSTER_ID> | ||
name = "foo" | ||
namespace = "<mynamespace>" | ||
type = "kubernetes.io/basic-auth" | ||
data = { | ||
password = "<mysecret>" | ||
username = "<myuser>" | ||
} | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `cluster_id` - (Required/ForceNew) The cluster id of the secret V2 (string) | ||
* `data` - (Required/Sensitive) The data of the secret v2 (map) | ||
* `name` - (Required) The name of the secret v2 (string) | ||
* `namespace` - (Optional/ForceNew) The namespaces of the secret v2. Default: `default` (string) | ||
* `type` - (Optional) The type of the k8s secret, used to facilitate programmatic handling of secret data, [More info](https://github.com/kubernetes/api/blob/release-1.20/core/v1/types.go#L5772) about k8s secret types and expected format. Default: `Opaque` (string) | ||
* `immutable` - (Optional) If set to true, any secret update will remove and recreate the secret. This is a beta field enabled by k8s `ImmutableEphemeralVolumes` feature gate. Default: `false` (bool) | ||
* `annotations` - (Optional/Computed) Annotations for the secret v2 (map) | ||
* `labels` - (Optional/Computed) Labels for the secret v2 (map) | ||
|
||
## Attributes Reference | ||
|
||
The following attributes are exported: | ||
|
||
* `id` - (Computed) The ID of the resource (string) | ||
* `resource_version` - (Computed) The k8s resource version (string) | ||
|
||
## Timeouts | ||
|
||
`rancher2_secret` provides the following | ||
[Timeouts](https://www.terraform.io/docs/configuration/resources.html#operation-timeouts) configuration options: | ||
|
||
- `create` - (Default `10 minutes`) Used for creating v2 secrets. | ||
- `update` - (Default `10 minutes`) Used for v2 secret modifications. | ||
- `delete` - (Default `10 minutes`) Used for deleting v2 secrets. | ||
|
||
## Import | ||
|
||
V2 secrets can be imported using the Rancher cluster ID, Secret V2 namespace and name. | ||
|
||
``` | ||
$ terraform import rancher2_secret_v2.foo <CLUSTER_ID>.<SECRET_V2_NAMESPACE>/<SECRET_V2_NAME> | ||
``` |
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
Oops, something went wrong.