Skip to content

Commit 9f9962c

Browse files
committed
docs: Add missing example templates and update Go dependencies
1 parent f6f2167 commit 9f9962c

File tree

4 files changed

+73
-0
lines changed

4 files changed

+73
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
resource "google_bigquery_analytics_hub_data_exchange" "{{$.PrimaryResourceId}}" {
2+
location = "us"
3+
data_exchange_id = "{{index $.Vars "data_exchange_id"}}"
4+
display_name = "{{index $.Vars "data_exchange_id"}}"
5+
description = "{{index $.Vars "description"}}"
6+
}
7+
8+
resource "google_bigquery_analytics_hub_listing" "{{$.PrimaryResourceId}}" {
9+
location = "us"
10+
data_exchange_id = google_bigquery_analytics_hub_data_exchange.{{$.PrimaryResourceId}}.data_exchange_id
11+
listing_id = "{{index $.Vars "listing_id"}}"
12+
display_name = "{{index $.Vars "listing_id"}}"
13+
description = "{{index $.Vars "description"}}"
14+
15+
bigquery_dataset {
16+
dataset = "projects/project_id/datasets/my_listing_example2"
17+
replica_locations = ["eu"]
18+
}
19+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
resource "google_bigquery_analytics_hub_data_exchange" "{{$.PrimaryResourceId}}" {
2+
location = "us"
3+
data_exchange_id = "{{index $.Vars "data_exchange_id"}}"
4+
display_name = "{{index $.Vars "data_exchange_id"}}"
5+
description = "{{index $.Vars "description"}}"
6+
}
7+
8+
resource "google_bigquery_analytics_hub_listing" "{{$.PrimaryResourceId}}" {
9+
location = "us"
10+
data_exchange_id = google_bigquery_analytics_hub_data_exchange.{{$.PrimaryResourceId}}.data_exchange_id
11+
listing_id = "{{index $.Vars "listing_id"}}"
12+
display_name = "{{index $.Vars "listing_id"}}"
13+
description = "{{index $.Vars "description"}}"
14+
15+
bigquery_dataset {
16+
dataset = "projects/project_id/datasets/my_listing_example2"
17+
replica_locations = ["eu"]
18+
}
19+
}
20+
21+
resource "google_bigquery_analytics_hub_listing_subscription" "{{$.PrimaryResourceId}}" {
22+
location = "US"
23+
data_exchange_id = google_bigquery_analytics_hub_data_exchange.{{$.PrimaryResourceId}}.data_exchange_id
24+
listing_id = google_bigquery_analytics_hub_listing.{{$.PrimaryResourceId}}.listing_id
25+
26+
destination_dataset {
27+
description = "{{index $.Vars "description"}}"
28+
friendly_name = "My Destination Dataset"
29+
labels = {
30+
testing = "123"
31+
}
32+
location = "US"
33+
dataset_reference {
34+
dataset_id = "{{index $.Vars "destination_dataset_id"}}"
35+
project_id = google_bigquery_analytics_hub_data_exchange.{{$.PrimaryResourceId}}.project
36+
}
37+
replica_locations = ["eu"]
38+
}
39+
}

mmv1/third_party/terraform/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ require (
4040
google.golang.org/grpc v1.77.0
4141
google.golang.org/protobuf v1.36.10
4242
gopkg.in/yaml.v2 v2.4.0
43+
cloud.google.com/go/bigquery v1.69.0
44+
4345
)
4446

4547
require (

mmv1/third_party/terraform/tpgresource/common_diff_suppress.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,19 @@ func ProjectNumberDiffSuppress(_, old, new string, _ *schema.ResourceData) bool
101101
return a2 == b2
102102
}
103103

104+
// Suppresses diffs where `routing_mode` is unset (empty string) vs. explicitly set
105+
// to "EXPLICIT_ROUTING_MODE". Since null/empty is treated as the default
106+
// EXPLICIT_ROUTING_MODE, both values collapse into the same state. This ensures
107+
// Terraform does not show unnecessary differences unless the value is explicitly
108+
// changed to "NEXT_HOP_ROUTING_MODE".
109+
func SuppressRoutingModeDefault(_, old, new string, _ *schema.ResourceData) bool {
110+
if old == new {
111+
return true
112+
}
113+
return (old == "" && new == "EXPLICIT_ROUTING_MODE") ||
114+
(old == "EXPLICIT_ROUTING_MODE" && new == "")
115+
}
116+
104117
// Suppress diffs when the value read from api
105118
// has the project ID instead of the project number
106119
func ProjectIDDiffSuppress(_, old, new string, _ *schema.ResourceData) bool {

0 commit comments

Comments
 (0)