Skip to content

Commit

Permalink
Make acctest use bootstrapped KMS key, instead of making new key that…
Browse files Browse the repository at this point in the history
… resembles a shared key (#9926) (#17202)

[upstream:ad957b2163d533b15bc85fff8f2016127a15317e]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Feb 6, 2024
1 parent 2b711a4 commit a4564db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 24 deletions.
3 changes: 3 additions & 0 deletions .changelog/9926.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ func TestAccWorkbenchInstance_workbenchInstanceFullExample(t *testing.T) {

context := map[string]interface{}{
"service_account": envvar.GetTestServiceAccountFromEnv(t),
"key_name": acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name,
"random_suffix": acctest.RandString(t, 10),
}

Expand Down Expand Up @@ -205,16 +206,6 @@ resource "google_compute_subnetwork" "my_subnetwork" {
ip_cidr_range = "10.0.1.0/24"
}
resource "google_kms_key_ring" "keyring" {
name = "tf-test-tftest-shared-keyring-1%{random_suffix}"
location = "global"
}
resource "google_kms_crypto_key" "crypto-key" {
name = "tf-test-tftest-shared-key-1%{random_suffix}"
key_ring = google_kms_key_ring.keyring.id
}
resource "google_workbench_instance" "instance" {
name = "tf-test-workbench-instance%{random_suffix}"
location = "us-central1-a"
Expand All @@ -236,14 +227,14 @@ resource "google_workbench_instance" "instance" {
disk_size_gb = 310
disk_type = "PD_SSD"
disk_encryption = "GMEK"
kms_key = google_kms_crypto_key.crypto-key.id
kms_key = "%{key_name}"
}
data_disks {
disk_size_gb = 330
disk_type = "PD_SSD"
disk_encryption = "GMEK"
kms_key = google_kms_crypto_key.crypto-key.id
kms_key = "%{key_name}"
}
network_interfaces {
Expand Down
14 changes: 2 additions & 12 deletions website/docs/r/workbench_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,6 @@ resource "google_compute_subnetwork" "my_subnetwork" {
ip_cidr_range = "10.0.1.0/24"
}
resource "google_kms_key_ring" "keyring" {
name = "tftest-shared-keyring-1"
location = "global"
}
resource "google_kms_crypto_key" "crypto-key" {
name = "tftest-shared-key-1"
key_ring = google_kms_key_ring.keyring.id
}
resource "google_workbench_instance" "instance" {
name = "workbench-instance"
location = "us-central1-a"
Expand All @@ -138,14 +128,14 @@ resource "google_workbench_instance" "instance" {
disk_size_gb = 310
disk_type = "PD_SSD"
disk_encryption = "GMEK"
kms_key = google_kms_crypto_key.crypto-key.id
kms_key = "my-crypto-key"
}
data_disks {
disk_size_gb = 330
disk_type = "PD_SSD"
disk_encryption = "GMEK"
kms_key = google_kms_crypto_key.crypto-key.id
kms_key = "my-crypto-key"
}
network_interfaces {
Expand Down

0 comments on commit a4564db

Please sign in to comment.