Skip to content

Commit 3512a8c

Browse files
authored
tgc-revival: add kms key ring resources (#15771)
1 parent d0afc4d commit 3512a8c

File tree

7 files changed

+18
-2
lines changed

7 files changed

+18
-2
lines changed

mmv1/products/kms/EkmConnection.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ update_mask: true
3333
exclude_delete: true
3434
import_format:
3535
- 'projects/{{project}}/locations/{{location}}/ekmConnections/{{name}}'
36+
include_in_tgc_next_DO_NOT_USE: true
37+
tgc_include_handwritten_tests: true
3638
timeouts:
3739
insert_minutes: 20
3840
update_minutes: 20

mmv1/products/kms/KeyRing.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,17 @@ exclude_delete: true
3333
immutable: true
3434
import_format:
3535
- 'projects/{{project}}/locations/{{location}}/keyRings/{{name}}'
36+
include_in_tgc_next_DO_NOT_USE: true
37+
tgc_include_handwritten_tests: true
38+
tgc_ignore_terraform_decoder: true
3639
timeouts:
3740
insert_minutes: 20
3841
update_minutes: 20
3942
delete_minutes: 20
4043
custom_code:
4144
encoder: 'templates/terraform/encoders/send_nil_body.go.tmpl'
4245
decoder: 'templates/terraform/decoders/kms.go.tmpl'
46+
tgc_decoder: 'templates/tgc_next/decoders/noop.go.tmpl'
4347
examples:
4448
- name: 'kms_key_ring_basic'
4549
primary_resource_id: 'example-keyring'
@@ -58,9 +62,11 @@ parameters:
5862
A full list of valid locations can be found by running `gcloud kms locations list`.
5963
required: true
6064
ignore_read: true
65+
tgc_ignore_read: true
6166
properties:
6267
- name: 'name'
6368
type: String
6469
description: |
6570
The resource name for the KeyRing.
6671
required: true
72+
tgc_ignore_read: true

mmv1/products/kms/KeyRingImportJob.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ create_url: '{{key_ring}}/importJobs?importJobId={{import_job_id}}'
3636
immutable: true
3737
import_format:
3838
- '{{name}}'
39+
include_in_tgc_next_DO_NOT_USE: true
40+
tgc_include_handwritten_tests: true
41+
cai_asset_name_format: '{{key_ring}}/importJobs/{{import_job_id}}'
3942
timeouts:
4043
insert_minutes: 20
4144
update_minutes: 20
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// To avoid the errors "declared and not used" for res, config, d
2+
return res, hclData, nil

mmv1/templates/tgc_next/tfplan2cai/resource_converter.go.tmpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ func Get{{ $.ResourceName -}}CaiObject(d tpgresource.TerraformResourceData, conf
134134
if err != nil {
135135
return nil, err
136136
}
137+
if obj == nil {
138+
obj = make(map[string]interface{})
139+
}
137140
{{- end }}
138141

139142
{{- if $.CustomCode.TgcEncoder }}

mmv1/third_party/tgc/tests/data/example_kms_import_job.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"name": "//cloudkms.googleapis.com/placeholder-CTVJTU1w",
3+
"name": "//cloudkms.googleapis.com/projects/{{.Provider.project}}/locations/global/keyRings/keyring-id-example/importJobs/my-import-job",
44
"ancestry_path": "{{.Ancestry}}/project/{{.Provider.project}}",
55
"asset_type": "cloudkms.googleapis.com/KeyRingImportJob",
66
"resource": {

mmv1/third_party/tgc/tests/data/example_kms_import_job.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ provider "google" {
1313

1414

1515
resource "google_kms_key_ring_import_job" "import-job" {
16-
key_ring = "keyring-id-example"
16+
key_ring = "projects/{{.Provider.project}}/locations/global/keyRings/keyring-id-example"
1717
import_job_id = "my-import-job"
1818

1919
import_method = "RSA_OAEP_3072_SHA1_AES_256"

0 commit comments

Comments
 (0)