Add terraform rendering to GCP HTTP Health Check

This commit is contained in:
Peter Rifel 2023-03-15 18:45:39 -05:00
parent b03544d4ae
commit cb6908802d
No known key found for this signature in database
GPG Key ID: BC6469E5B16DB2B6
1 changed files with 19 additions and 0 deletions

View File

@ -23,6 +23,8 @@ import (
"k8s.io/klog/v2"
"k8s.io/kops/upup/pkg/fi"
"k8s.io/kops/upup/pkg/fi/cloudup/gce"
"k8s.io/kops/upup/pkg/fi/cloudup/terraform"
"k8s.io/kops/upup/pkg/fi/cloudup/terraformWriter"
)
// HTTPHealthcheck represents a GCE Healthcheck
@ -93,3 +95,20 @@ func (h *HTTPHealthcheck) RenderGCE(t *gce.GCEAPITarget, a, e, changes *HTTPHeal
}
return nil
}
type terraformHTTPHealthcheck struct {
Name string `cty:"name"`
Port *int64 `cty:"port"`
}
func (_ *HTTPHealthcheck) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *HTTPHealthcheck) error {
tf := &terraformHTTPHealthcheck{
Name: *e.Name,
Port: e.Port,
}
return t.RenderResource("google_compute_http_health_check", *e.Name, tf)
}
func (e *HTTPHealthcheck) TerraformAddress() *terraformWriter.Literal {
return terraformWriter.LiteralProperty("google_compute_http_health_check", *e.Name, "id")
}