diff --git a/internal/binarylane/fetch-openapi.sh b/internal/binarylane/fetch-openapi.sh index 23569e0..272e2c8 100755 --- a/internal/binarylane/fetch-openapi.sh +++ b/internal/binarylane/fetch-openapi.sh @@ -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 diff --git a/internal/binarylane/openapi.json b/internal/binarylane/openapi.json index 9e4bd46..c319afc 100644 --- a/internal/binarylane/openapi.json +++ b/internal/binarylane/openapi.json @@ -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": [ diff --git a/internal/binarylane/types_gen.go b/internal/binarylane/types_gen.go index 2ad0b4a..b178dd2 100644 --- a/internal/binarylane/types_gen.go +++ b/internal/binarylane/types_gen.go @@ -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"` diff --git a/internal/provider/load_balancer_resource.go b/internal/provider/load_balancer_resource.go index ef9f88b..f0d3be1 100644 --- a/internal/provider/load_balancer_resource.go +++ b/internal/provider/load_balancer_resource.go @@ -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)...)