Skip to content

Commit

Permalink
add compute route tests (GoogleCloudPlatform#10521)
Browse files Browse the repository at this point in the history
  • Loading branch information
kotarsky authored and pcostell committed Jul 16, 2024
1 parent 2f3a6ab commit 294e26c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions mmv1/templates/tgc/resource_converters.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func ResourceConverters() map[string][]cai.ResourceConverter {
"google_compute_global_forwarding_rule": {compute.ResourceConverterComputeGlobalForwardingRule()},
"google_compute_instance": {compute.ResourceConverterComputeInstance()},
"google_compute_network": {compute.ResourceConverterComputeNetwork()},
"google_compute_route": {compute.ResourceConverterComputeRoute()},
"google_compute_security_policy": {resourceConverterComputeSecurityPolicy()},
"google_compute_snapshot": {compute.ResourceConverterComputeSnapshot()},
"google_compute_subnetwork": {compute.ResourceConverterComputeSubnetwork()},
Expand Down
23 changes: 23 additions & 0 deletions mmv1/third_party/tgc/tests/data/example_compute_route.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"name": "//compute.googleapis.com/projects/{{.Provider.project}}/global/routes/my-route",
"ancestry_path": "{{.Ancestry}}/project/{{.Provider.project}}",
"asset_type": "compute.googleapis.com/Route",
"resource": {
"version": "beta",
"discovery_document_uri": "https://www.googleapis.com/discovery/v1/apis/compute/beta/rest",
"discovery_name": "Route",
"parent": "//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
"data": {
"destRange": "10.1.0.0/16",
"name": "my-route",
"network": "projects/{{.Provider.project}}/global/networks/my-network",
"nextHopIp": "10.0.0.1",
"priority": 1000
}
},
"ancestors": [
"organizations/{{.OrgID}}"
]
}
]
19 changes: 19 additions & 0 deletions mmv1/third_party/tgc/tests/data/example_compute_route.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
terraform {
required_providers {
google = {
source = "hashicorp/google-beta"
version = "~> {{.Provider.version}}"
}
}
}

provider "google" {
{{if .Provider.credentials }}credentials = "{{.Provider.credentials}}"{{end}}
}

resource "google_compute_route" "my_route" {
name = "my-route"
dest_range = "10.1.0.0/16"
next_hop_ip = "10.0.0.1"
network = "my-network"
}

0 comments on commit 294e26c

Please sign in to comment.