Skip to content

Commit ad97acb

Browse files
mihirnimbalkarMihir Nimbalkar
authored and
Mihir Nimbalkar
committed
Fix workstations tags test by following a latest PR:
GoogleCloudPlatform#12085
1 parent e16e141 commit ad97acb

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

mmv1/products/workstations/WorkstationCluster.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ examples:
6767
workstation_cluster_name: 'workstation-cluster-tags'
6868
key_short_name: 'keyname'
6969
value_short_name: 'valuename'
70-
test_env_vars:
71-
org_id: "ORG_ID"
7270
test_vars_overrides:
7371
'key_short_name': '"tf-test-key-" + acctest.RandString(t, 10)'
7472
'value_short_name': '"tf-test-value-" + acctest.RandString(t, 10)'

mmv1/templates/terraform/examples/workstation_cluster_tags.tf.tmpl

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
resource "google_tags_tag_key" "tag_key1" {
1+
data "google_project" "project" {
2+
provider = google-beta
3+
}
4+
5+
resource "google_tags_tag_key" "tag_key" {
26
provider = google-beta
3-
parent = "organizations/{{index $.Vars "org_id"}}"
7+
parent = "projects/${data.google_project.project.number}"
48
short_name = "{{index $.Vars "key_short_name"}}"
59
}
610

7-
resource "google_tags_tag_value" "tag_value1" {
11+
resource "google_tags_tag_value" "tag_value" {
812
provider = google-beta
9-
parent = google_tags_tag_key.tag_key1.id
13+
parent = "tagKeys/${google_tags_tag_key.tag_key.name}"
1014
short_name = "{{index $.Vars "value_short_name"}}"
1115
}
1216

@@ -18,14 +22,10 @@ resource "google_workstations_workstation_cluster" "{{$.PrimaryResourceId}}" {
1822
location = "us-central1"
1923

2024
tags = {
21-
(google_tags_tag_key.tag_key1.id) = google_tags_tag_value.tag_value1.id
25+
"${data.google_project.project.project_id}/${google_tags_tag_key.tag_key.short_name}" = "${google_tags_tag_value.tag_value.short_name}"
2226
}
2327
}
2428

25-
data "google_project" "project" {
26-
provider = google-beta
27-
}
28-
2929
resource "google_compute_network" "default" {
3030
provider = google-beta
3131
name = "{{index $.Vars "workstation_cluster_name"}}"

0 commit comments

Comments
 (0)