Skip to content

Commit f6e6d8f

Browse files
committed
Set labels fields in data source
1 parent 3241faf commit f6e6d8f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

mmv1/third_party/terraform/services/container/data_source_google_container_cluster.go

+9
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ func datasourceContainerClusterRead(d *schema.ResourceData, meta interface{}) er
4747
return err
4848
}
4949

50+
// Sets the "resource_labels" field and "terraform_labels" with the value of the field "effective_labels".
51+
effectiveLabels := d.Get("effective_labels")
52+
if err := d.Set("resource_labels", effectiveLabels); err != nil {
53+
return fmt.Errorf("Error setting labels in data source: %s", err)
54+
}
55+
if err := d.Set("terraform_labels", effectiveLabels); err != nil {
56+
return fmt.Errorf("Error setting terraform_labels in data source: %s", err)
57+
}
58+
5059
if d.Id() == "" {
5160
return fmt.Errorf("%s not found", id)
5261
}

mmv1/third_party/terraform/services/container/data_source_google_container_cluster_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ resource "google_container_cluster" "kubes" {
9696
deletion_protection = false
9797
network = "%s"
9898
subnetwork = "%s"
99-
99+
resource_labels = {
100+
created-by = "terraform"
101+
}
100102
}
101103
102104
data "google_container_cluster" "kubes" {

0 commit comments

Comments
 (0)