Skip to content

Commit 354287e

Browse files
committed
add ssm examples and docs
1 parent 80657d5 commit 354287e

12 files changed

+372
-0
lines changed

examples/tencentcloud-ssm/main.tf

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
provider "tencentcloud" {
2+
region = "ap-guangzhou"
3+
}
4+
5+
resource "tencentcloud_ssm_secret" "foo" {
6+
secret_name = "test"
7+
description = "test secret"
8+
recovery_window_in_days = 0
9+
is_enabled = true
10+
11+
init_secret {
12+
version_id = "v1"
13+
secret_string = "123456"
14+
}
15+
16+
tags = {
17+
test-tag = "test"
18+
}
19+
}
20+
21+
resource "tencentcloud_ssm_secret_version" "v2" {
22+
secret_name = tencentcloud_ssm_secret.foo.secret_name
23+
version_id = "v2"
24+
secret_binary = "MTIzMTIzMTIzMTIzMTIzQQ=="
25+
}
26+
27+
data "tencentcloud_ssm_secrets" "secret_list" {
28+
secret_name = tencentcloud_ssm_secret.foo.secret_name
29+
order_type = 1
30+
state = 1
31+
}
32+
33+
data "tencentcloud_ssm_secret_versions" "secret_version_list" {
34+
secret_name = tencentcloud_ssm_secret_version.v2.secret_name
35+
version_id = tencentcloud_ssm_secret_version.v2.version_id
36+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
terraform {
2+
required_version = ">= 0.12"
3+
}

tencentcloud/data_source_tc_ssm_secret_versions.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
/*
2+
Use this data source to query detailed information of SSM secret version
3+
Example Usage
4+
```hcl
5+
6+
data "tencentcloud_ssm_secret_versions" "foo" {
7+
secret_name = "test"
8+
version_id = "v1"
9+
}
10+
```
11+
*/
112
package tencentcloud
213

314
import (

tencentcloud/data_source_tc_ssm_secrets.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/*
2+
Use this data source to query detailed information of SSM secret
3+
Example Usage
4+
```hcl
5+
6+
data "tencentcloud_ssm_secrets" "foo" {
7+
secret_name = "test"
8+
order_type = 1
9+
state = 1
10+
}
11+
```
12+
*/
113
package tencentcloud
214

315
import (

tencentcloud/provider.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,15 @@ SSL Certificates
412412
tencentcloud_ssl_certificate
413413
tencentcloud_ssl_pay_certificate
414414
415+
SSM
416+
Data Source
417+
tencentcloud_ssm_secrets
418+
tencentcloud_ssm_secret_versions
419+
420+
Resource
421+
tencentcloud_ssm_secret
422+
tencentcloud_ssm_secret_version
423+
415424
TcaplusDB
416425
Data Source
417426
tencentcloud_tcaplus_clusters

tencentcloud/resource_tc_ssm_secret.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
/*
2+
Provide a resource to create a SSM secret.
3+
Example Usage
4+
```hcl
5+
resource "tencentcloud_ssm_secret" "foo" {
6+
secret_name = "test"
7+
description = "test secret"
8+
recovery_window_in_days = 0
9+
is_enabled = true
10+
11+
init_secret {
12+
version_id = "v1"
13+
secret_string = "123456"
14+
}
15+
16+
tags = {
17+
test-tag = "test"
18+
}
19+
}
20+
```
21+
Import
22+
SSM secret can be imported using the secretName, e.g.
23+
```
24+
$ terraform import tencentcloud_ssm_secret.foo test
25+
```
26+
*/
127
package tencentcloud
228

329
import (

tencentcloud/resource_tc_ssm_secret_version.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
/*
2+
Provide a resource to create a SSM secret version.
3+
Example Usage
4+
```hcl
5+
resource "tencentcloud_ssm_secret" "foo" {
6+
secret_name = "test"
7+
description = "test secret"
8+
recovery_window_in_days = 0
9+
is_enabled = true
10+
11+
init_secret {
12+
version_id = "v1"
13+
secret_string = "123456"
14+
}
15+
16+
tags = {
17+
test-tag = "test"
18+
}
19+
}
20+
21+
resource "tencentcloud_ssm_secret_version" "v2" {
22+
secret_name = tencentcloud_ssm_secret.foo.secret_name
23+
version_id = "v2"
24+
secret_binary = "MTIzMTIzMTIzMTIzMTIzQQ=="
25+
}
26+
```
27+
Import
28+
SSM secret version can be imported using the secretName#versionId, e.g.
29+
```
30+
$ terraform import tencentcloud_ssm_secret_version.v2 test#v2
31+
```
32+
*/
133
package tencentcloud
234

335
import (
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
subcategory: "SSM"
3+
layout: "tencentcloud"
4+
page_title: "TencentCloud: tencentcloud_ssm_secret_versions"
5+
sidebar_current: "docs-tencentcloud-datasource-ssm_secret_versions"
6+
description: |-
7+
Use this data source to query detailed information of SSM secret version
8+
---
9+
10+
# tencentcloud_ssm_secret_versions
11+
12+
Use this data source to query detailed information of SSM secret version
13+
14+
## Example Usage
15+
16+
```hcl
17+
data "tencentcloud_ssm_secret_versions" "foo" {
18+
secret_name = "test"
19+
version_id = "v1"
20+
}
21+
```
22+
23+
## Argument Reference
24+
25+
The following arguments are supported:
26+
27+
* `secret_name` - (Required) Secret name used to filter result.
28+
* `result_output_file` - (Optional) Used to save results.
29+
* `version_id` - (Optional) VersionId used to filter result.
30+
31+
## Attributes Reference
32+
33+
In addition to all arguments above, the following attributes are exported:
34+
35+
* `secret_version_list` - A list of SSM secret versions.
36+
* `secret_binary` - The base64-encoded binary secret.
37+
* `secret_string` - The string text of secret.
38+
* `version_id` - Version of secret.
39+
40+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
subcategory: "SSM"
3+
layout: "tencentcloud"
4+
page_title: "TencentCloud: tencentcloud_ssm_secrets"
5+
sidebar_current: "docs-tencentcloud-datasource-ssm_secrets"
6+
description: |-
7+
Use this data source to query detailed information of SSM secret
8+
---
9+
10+
# tencentcloud_ssm_secrets
11+
12+
Use this data source to query detailed information of SSM secret
13+
14+
## Example Usage
15+
16+
```hcl
17+
data "tencentcloud_ssm_secrets" "foo" {
18+
secret_name = "test"
19+
order_type = 1
20+
state = 1
21+
}
22+
```
23+
24+
## Argument Reference
25+
26+
The following arguments are supported:
27+
28+
* `order_type` - (Optional) The order to sort the create time of secret. `0` - desc, `1` - asc. Default value is `0`.
29+
* `result_output_file` - (Optional) Used to save results.
30+
* `secret_name` - (Optional) Secret name used to filter result.
31+
* `state` - (Optional) Filter by state of secret. `0` - all secrets are queried, `1` - only Enabled secrets are queried, `2` - only Disabled secrets are queried, `3` - only PendingDelete secrets are queried.
32+
* `tags` - (Optional) Tags to filter secret.
33+
34+
## Attributes Reference
35+
36+
In addition to all arguments above, the following attributes are exported:
37+
38+
* `secret_list` - A list of SSM secrets.
39+
* `create_time` - Create time of secret.
40+
* `create_uin` - Uin of Creator.
41+
* `delete_time` - Delete time of CMK.
42+
* `description` - Description of secret.
43+
* `kms_key_id` - KMS keyId used to encrypt secret.
44+
* `secret_name` - Name of secret.
45+
* `status` - Status of secret.
46+
47+
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
subcategory: "SSM"
3+
layout: "tencentcloud"
4+
page_title: "TencentCloud: tencentcloud_ssm_secret"
5+
sidebar_current: "docs-tencentcloud-resource-ssm_secret"
6+
description: |-
7+
Provide a resource to create a SSM secret.
8+
---
9+
10+
# tencentcloud_ssm_secret
11+
12+
Provide a resource to create a SSM secret.
13+
14+
## Example Usage
15+
16+
```hcl
17+
resource "tencentcloud_ssm_secret" "foo" {
18+
secret_name = "test"
19+
description = "test secret"
20+
recovery_window_in_days = 0
21+
is_enabled = true
22+
23+
init_secret {
24+
version_id = "v1"
25+
secret_string = "123456"
26+
}
27+
28+
tags = {
29+
test-tag = "test"
30+
}
31+
}
32+
```
33+
34+
## Argument Reference
35+
36+
The following arguments are supported:
37+
38+
* `init_secret` - (Required) The secret of initial version.
39+
* `secret_name` - (Required, ForceNew) Name of secret which cannot be repeated in the same region. The maximum length is 128 bytes. The name can only contain English letters, numbers, underscore and hyphen '-'. The first character must be a letter or number.
40+
* `description` - (Optional) Description of secret. The maximum is 2048 bytes.
41+
* `is_enabled` - (Optional) Specify whether to enable secret. Default value is `true`.
42+
* `kms_key_id` - (Optional, ForceNew) KMS keyId used to encrypt secret. If it is empty, it means that the CMK created by SSM for you by default is used for encryption. You can also specify the KMS CMK created by yourself in the same region for encryption.
43+
* `recovery_window_in_days` - (Optional) Specify the scheduled deletion date. Default value is `0` that means to delete immediately. 1-30 means the number of days reserved, completely deleted after this date.
44+
* `tags` - (Optional) Tags of secret.
45+
46+
The `init_secret` object supports the following:
47+
48+
* `version_id` - (Required) Version of secret. The maximum length is 64 bytes. The version_id can only contain English letters, numbers, underscore and hyphen '-'. The first character must be a letter or number.
49+
* `secret_binary` - (Optional) The base64-encoded binary secret. secret_binary and secret_string must be set only one, and the maximum support is 4096 bytes. When secret status is `Disabled`, this field will not update anymore.
50+
* `secret_string` - (Optional) The string text of secret. secret_binary and secret_string must be set only one, and the maximum support is 4096 bytes. When secret status is `Disabled`, this field will not update anymore.
51+
52+
## Attributes Reference
53+
54+
In addition to all arguments above, the following attributes are exported:
55+
56+
* `id` - ID of the resource.
57+
* `status` - Status of secret.
58+
59+
60+
## Import
61+
62+
SSM secret can be imported using the secretName, e.g.
63+
```
64+
$ terraform import tencentcloud_ssm_secret.foo test
65+
```
66+

0 commit comments

Comments
 (0)