📼 ensure that load balancer always sets model state for health checks (#32)

This commit is contained in:
Oscar Hermoso
2024-10-25 10:39:11 +08:00
committed by GitHub
parent e1aac7ec1f
commit e18d2424d0
4 changed files with 11 additions and 3 deletions
+1
View File
@@ -39,4 +39,5 @@ cat <<<$(jq '.components.schemas.AdvancedFirewallRule.properties.source_addresse
## Load Balancer
cat <<<$(jq '.components.schemas.CreateLoadBalancerRequest.properties.forwarding_rules += {"x-oapi-codegen-extra-tags": {"tfsdk": "forwarding_rules"}}' $OPENAPI_FILE) >$OPENAPI_FILE
cat <<<$(jq '.components.schemas.ForwardingRule.properties.entry_protocol += {"x-oapi-codegen-extra-tags": {"tfsdk": "entry_protocol"}}' $OPENAPI_FILE) >$OPENAPI_FILE
cat <<<$(jq '.components.schemas.LoadBalancer.properties.health_check += {"x-oapi-codegen-extra-tags": {"tfsdk": "health_check"}}' $OPENAPI_FILE) >$OPENAPI_FILE
cat <<<$(jq '.components.schemas.HealthCheckProtocol |= del(.enum)' $OPENAPI_FILE) >$OPENAPI_FILE
+4 -1
View File
@@ -11845,7 +11845,10 @@
}
],
"description": "The rules that determine which servers are considered 'healthy' and in the server pool for the load balancer.",
"readOnly": true
"readOnly": true,
"x-oapi-codegen-extra-tags": {
"tfsdk": "health_check"
}
},
"region": {
"allOf": [
+1 -1
View File
@@ -1860,7 +1860,7 @@ type LoadBalancer struct {
ForwardingRules *[]ForwardingRule `json:"forwarding_rules,omitempty"`
// HealthCheck The rules that determine which servers are considered 'healthy' and in the server pool for the load balancer.
HealthCheck *HealthCheck `json:"health_check,omitempty"`
HealthCheck *HealthCheck `json:"health_check,omitempty" tfsdk:"health_check"`
// Id The ID of the load balancer.
Id *int64 `json:"id,omitempty"`
+5 -1
View File
@@ -175,7 +175,11 @@ retryLoop:
return
}
data.Id = types.Int64Value(*lbResp.JSON200.LoadBalancer.Id)
diags = SetLoadBalancerModelState(ctx, &data.LoadBalancerModel, lbResp.JSON200.LoadBalancer)
resp.Diagnostics.Append(diags...)
if diags.HasError() {
return
}
// Save data into Terraform state
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)