Skip to content

Commit

Permalink
Add support for google_compute_healthcheck to TGC (#10538)
Browse files Browse the repository at this point in the history
  • Loading branch information
kotarsky committed May 16, 2024
1 parent ed21548 commit 9601417
Show file tree
Hide file tree
Showing 3 changed files with 53 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_forwarding_rule": {compute.ResourceConverterComputeForwardingRule()},
"google_compute_global_address": {compute.ResourceConverterComputeGlobalAddress()},
"google_compute_global_forwarding_rule": {compute.ResourceConverterComputeGlobalForwardingRule()},
"google_compute_health_check": {compute.ResourceConverterComputeHealthCheck()},
"google_compute_instance": {compute.ResourceConverterComputeInstance()},
"google_compute_network": {compute.ResourceConverterComputeNetwork()},
"google_compute_node_template": {compute.ResourceConverterComputeNodeTemplate()},
Expand Down
30 changes: 30 additions & 0 deletions mmv1/third_party/tgc/tests/data/example_compute_health_check.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
{
"name": "//compute.googleapis.com/projects/{{.Provider.project}}/global/healthChecks/http-health-check",
"ancestry_path": "{{.Ancestry}}/project/{{.Provider.project}}",
"asset_type": "compute.googleapis.com/HealthCheck",
"resource": {
"version": "beta",
"discovery_document_uri": "https://www.googleapis.com/discovery/v1/apis/compute/beta/rest",
"discovery_name": "HealthCheck",
"parent": "//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
"data": {
"checkIntervalSec": 1,
"description": "",
"healthyThreshold": 2,
"httpHealthCheck": {
"port": 80,
"proxyHeader": "NONE",
"requestPath": "/"
},
"name": "http-health-check",
"timeoutSec": 1,
"type": "HTTP",
"unhealthyThreshold": 2
}
},
"ancestors": [
"organizations/{{.OrgID}}"
]
}
]
22 changes: 22 additions & 0 deletions mmv1/third_party/tgc/tests/data/example_compute_health_check.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
terraform {
required_providers {
google = {
source = "hashicorp/google-beta"
version = "~> {{.Provider.version}}"
}
}
}

provider "google" {
{{if .Provider.credentials }}credentials = "{{.Provider.credentials}}"{{end}}
}
resource "google_compute_health_check" "http-health-check" {
name = "http-health-check"

timeout_sec = 1
check_interval_sec = 1

http_health_check {
port = 80
}
}

0 comments on commit 9601417

Please sign in to comment.