Skip to content

Commit d2c3730

Browse files
adding datasource for autokeyconfig (#12611) (#20807)
[upstream:9ca4299ff15c8f81506bbed2696bd30919c440db] Signed-off-by: Modular Magician <magic-modules@google.com>
1 parent f2f60b6 commit d2c3730

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed

.changelog/12611.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:new-datasource
2+
`google_kms_autokey_config`
3+
```
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
package kms
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
package kms_test

google/services/kms/kms_utils.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ type KmsKeyHandleId struct {
2828
Name string
2929
}
3030

31+
type KmsAutokeyConfigId struct {
32+
Folder string
33+
}
34+
35+
func (s *KmsAutokeyConfigId) AutokeyConfigId() string {
36+
return fmt.Sprintf("%s/autokeyConfig", s.Folder)
37+
}
38+
3139
func (s *KmsKeyHandleId) KeyHandleId() string {
3240
return fmt.Sprintf("projects/%s/locations/%s/keyHandles/%s", s.Project, s.Location, s.Name)
3341
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
subcategory: "Cloud Key Management Service"
3+
description: |-
4+
Provides access to KMS Autokey config data with Google Cloud KMS.
5+
---
6+
7+
# google_kms_key_handle
8+
9+
Provides access to Google Cloud Platform KMS AutokeyConfig. A AutokeyConfig is a Cloud KMS resource that helps you safely span the separation of duties to create new Cloud KMS keys for CMEK using Autokey.
10+
11+
~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider.
12+
See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources.
13+
14+
15+
For more information see
16+
[the official documentation](https://cloud.google.com/kms/docs/reference/rest/v1/folders)
17+
and
18+
[API](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyHandles).
19+
20+
## Example Usage
21+
22+
```hcl
23+
data "google_kms_autokey_config" "my_autokey_config" {
24+
folder = "folders/123"
25+
}
26+
```
27+
28+
## Argument Reference
29+
30+
The following arguments are supported:
31+
32+
* `folder` - The folder in which the AutokeyConfig is configured. If it
33+
is not provided, the provider folder is used.
34+
35+
## Attributes Reference
36+
37+
In addition to the arguments listed above, the following computed attributes are
38+
exported:
39+
40+
* `id` - The identifier of the AutokeyConfig. Its format is `folders/{folderId}/autokeyConfig`.
41+
42+
* `key_project` - The identifier of the project hosting KMS KeyRings and Keys generated by Autokey. Its format is `projects/{projectId}`.

0 commit comments

Comments
 (0)