Skip to content

Commit 5425dbd

Browse files
authored
added encryption_config field to google_backup_dr_backup_vault (#15583)
1 parent 0d67e28 commit 5425dbd

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

mmv1/products/backupdr/BackupVault.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,24 @@ custom_code:
4141
pre_delete: 'templates/terraform/pre_delete/backup_dr_backup_vault.go.tmpl'
4242
include_in_tgc_next_DO_NOT_USE: true
4343
examples:
44-
- name: 'backup_dr_backup_vault_full'
44+
- name: 'backup_dr_backup_vault_simple'
4545
primary_resource_id: 'backup-vault-test'
4646
vars:
4747
backup_vault_id: 'backup-vault-test'
4848
test_env_vars:
4949
project: 'PROJECT_NAME'
50+
- name: 'backup_dr_backup_vault_cmek'
51+
primary_resource_id: 'backup-vault-cmek'
52+
bootstrap_iam:
53+
- member: "serviceAccount:service-{project_number}@gcp-sa-backupdr.iam.gserviceaccount.com"
54+
role: "roles/cloudkms.cryptoKeyEncrypterDecrypter"
55+
vars:
56+
backup_vault_id: 'backup-vault-cmek'
57+
kms_key_name: 'bkpvault-key'
58+
test_env_vars:
59+
project: 'PROJECT_NAME'
60+
test_vars_overrides:
61+
kms_key_name: 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name'
5062
parameters:
5163
- name: 'location'
5264
type: String
@@ -192,3 +204,10 @@ properties:
192204
- 'BACKUP_RETENTION_INHERITANCE_UNSPECIFIED'
193205
- 'INHERIT_VAULT_RETENTION'
194206
- 'MATCH_BACKUP_EXPIRE_TIME'
207+
- name: 'encryptionConfig'
208+
type: NestedObject
209+
description: 'Encryption configuration for the backup vault.'
210+
properties:
211+
- name: 'kmsKeyName'
212+
type: String
213+
description: 'The Resource name of the Cloud KMS key to be used to encrypt new backups. The key must be in the same location as the backup vault. The key must be a Cloud KMS CryptoKey.'
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
data "google_project" "test_project" {
2+
project_id = "{{index $.TestEnvVars "project"}}"
3+
}
4+
5+
resource "google_backup_dr_backup_vault" "{{$.PrimaryResourceId}}" {
6+
location = "us-central1"
7+
backup_vault_id = "{{index $.Vars "backup_vault_id"}}"
8+
description = "This is a second backup vault built by Terraform."
9+
backup_minimum_enforced_retention_duration = "100000s"
10+
annotations = {
11+
annotations1 = "bar1"
12+
annotations2 = "baz1"
13+
}
14+
labels = {
15+
foo = "bar1"
16+
bar = "baz1"
17+
}
18+
encryption_config {
19+
kms_key_name = "{{index $.Vars "kms_key_name"}}"
20+
}
21+
force_update = "true"
22+
access_restriction = "WITHIN_ORGANIZATION"
23+
backup_retention_inheritance = "INHERIT_VAULT_RETENTION"
24+
ignore_inactive_datasources = "true"
25+
ignore_backup_plan_references = "true"
26+
allow_missing = "true"
27+
}

mmv1/templates/terraform/examples/backup_dr_backup_vault_full.tf.tmpl renamed to mmv1/templates/terraform/examples/backup_dr_backup_vault_simple.tf.tmpl

File renamed without changes.

0 commit comments

Comments
 (0)