mirror of https://github.com/kubernetes/kops.git
Add terraform rendering to GCP HTTP Health Check
This commit is contained in:
parent
b03544d4ae
commit
cb6908802d
|
|
@ -23,6 +23,8 @@ import (
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
"k8s.io/kops/upup/pkg/fi"
|
"k8s.io/kops/upup/pkg/fi"
|
||||||
"k8s.io/kops/upup/pkg/fi/cloudup/gce"
|
"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
|
// HTTPHealthcheck represents a GCE Healthcheck
|
||||||
|
|
@ -93,3 +95,20 @@ func (h *HTTPHealthcheck) RenderGCE(t *gce.GCEAPITarget, a, e, changes *HTTPHeal
|
||||||
}
|
}
|
||||||
return nil
|
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")
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue