diff --git a/pkg/model/awsmodel/api_loadbalancer.go b/pkg/model/awsmodel/api_loadbalancer.go index 1f72d03a59..e893238740 100644 --- a/pkg/model/awsmodel/api_loadbalancer.go +++ b/pkg/model/awsmodel/api_loadbalancer.go @@ -278,6 +278,7 @@ func (b *APILoadBalancerBuilder) Build(c *fi.ModelBuilderContext) error { Tags: tcpGroupTags, Protocol: fi.String("TCP"), Port: fi.Int64(443), + Interval: fi.Int64(10), HealthyThreshold: fi.Int64(2), UnhealthyThreshold: fi.Int64(2), Shared: fi.Bool(false), @@ -300,6 +301,7 @@ func (b *APILoadBalancerBuilder) Build(c *fi.ModelBuilderContext) error { Tags: tlsGroupTags, Protocol: fi.String("TLS"), Port: fi.Int64(443), + Interval: fi.Int64(10), HealthyThreshold: fi.Int64(2), UnhealthyThreshold: fi.Int64(2), Shared: fi.Bool(false), diff --git a/upup/pkg/fi/cloudup/awstasks/targetgroup.go b/upup/pkg/fi/cloudup/awstasks/targetgroup.go index 0b2c64d6e4..5411b7141f 100644 --- a/upup/pkg/fi/cloudup/awstasks/targetgroup.go +++ b/upup/pkg/fi/cloudup/awstasks/targetgroup.go @@ -45,6 +45,7 @@ type TargetGroup struct { // Shared is set if this is an external LB (one we don't create or own) Shared *bool + Interval *int64 HealthyThreshold *int64 UnhealthyThreshold *int64 } @@ -88,10 +89,14 @@ func (e *TargetGroup) Find(c *fi.Context) (*TargetGroup, error) { Port: tg.Port, Protocol: tg.Protocol, ARN: tg.TargetGroupArn, + Interval: tg.HealthCheckIntervalSeconds, HealthyThreshold: tg.HealthyThresholdCount, UnhealthyThreshold: tg.UnhealthyThresholdCount, VPC: &VPC{ID: tg.VpcId}, } + // Interval cannot be changed after TargetGroup creation + e.Interval = actual.Interval + e.ARN = tg.TargetGroupArn tagsResp, err := cloud.ELBV2().DescribeTags(&elbv2.DescribeTagsInput{ @@ -215,6 +220,7 @@ type terraformTargetGroup struct { } type terraformTargetGroupHealthCheck struct { + Interval int64 `cty:"interval"` HealthyThreshold int64 `cty:"healthy_threshold"` UnhealthyThreshold int64 `cty:"unhealthy_threshold"` Protocol string `cty:"protocol"` @@ -237,6 +243,7 @@ func (_ *TargetGroup) RenderTerraform(t *terraform.TerraformTarget, a, e, change VPCID: *e.VPC.TerraformLink(), Tags: e.Tags, HealthCheck: terraformTargetGroupHealthCheck{ + Interval: *e.Interval, HealthyThreshold: *e.HealthyThreshold, UnhealthyThreshold: *e.UnhealthyThreshold, Protocol: elbv2.ProtocolEnumTcp,