diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 03b0c3e5..d5cd0715 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -14,9 +14,6 @@ ## 📋 Checklist -- [ ] Rebased from the main (or release if patching) branch (before testing) - [ ] Added/updated applicable tests - [ ] Added/updated examples in the `examples/` directory -- [ ] Tested against [Astro-API](https://github.com/astronomer/astro/) -- [ ] Communicated to/tagged owners of respective clients potentially impacted by these changes. - [ ] Updated any related [documentation](https://github.com/astronomer/docs/) diff --git a/internal/provider/resources/resource_deployment.go b/internal/provider/resources/resource_deployment.go index 91e13761..94fab4e3 100644 --- a/internal/provider/resources/resource_deployment.go +++ b/internal/provider/resources/resource_deployment.go @@ -960,8 +960,8 @@ func validateClusterIdConfig(ctx context.Context, data *models.DeploymentResourc // RequestScalingSpec converts a Terraform object to a platform.DeploymentScalingSpecRequest to be used in create and update requests func RequestScalingSpec(ctx context.Context, scalingSpecObj types.Object) (*platform.DeploymentScalingSpecRequest, diag.Diagnostics) { if scalingSpecObj.IsNull() { - // If the scaling spec is not set, return nil for the request - return nil, nil + // If the scaling spec is not set, return an empty scaling spec for the request + return &platform.DeploymentScalingSpecRequest{}, nil } var scalingSpec models.DeploymentScalingSpec diags := scalingSpecObj.As(ctx, &scalingSpec, basetypes.ObjectAsOptions{ diff --git a/internal/provider/resources/resource_deployment_test.go b/internal/provider/resources/resource_deployment_test.go index 4ad0b256..83ad788d 100644 --- a/internal/provider/resources/resource_deployment_test.go +++ b/internal/provider/resources/resource_deployment_test.go @@ -438,6 +438,14 @@ func TestAcc_ResourceDeploymentStandardScalingSpec(t *testing.T) { resource.TestCheckNoResourceAttr(scalingSpecResourceVar, "scaling_spec.hibernation_spec.schedules"), ), }, + // Make scaling spec null to test that it is removed from the deployment with no errors + { + Config: astronomerprovider.ProviderConfig(t, true) + developmentDeployment(scalingSpecDeploymentName, + ` `), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(scalingSpecResourceVar, "scaling_spec.%", "0"), + ), + }, { Config: astronomerprovider.ProviderConfig(t, true) + developmentDeployment(scalingSpecDeploymentName, `scaling_spec = {