-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dependent resources to compute.WindowsVirtualMachineScaleSet
and fix conflicts
#490
Conversation
/test-examples="examples/compute/windowsvirtualmachinescaleset.yaml" |
config/compute/config.go
Outdated
@@ -36,6 +36,10 @@ func Configure(p *config.Provider) { | |||
"virtual_machine_scale_set_id"}, | |||
} | |||
}) | |||
p.AddResourceConfigurator("azurerm_windows_virtual_machine_scale_set", func(r *config.Resource) { | |||
// In version 3.21.0 the `scale_in_policy` parameter was removed, and replaced by `scale_in` | |||
config.MoveToStatus(r.TerraformResource, "scale_in_policy") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not move this to status as it would violate the deprecation protocol, i.e., a parameter being deprecated stays available in deprecated state for a series of releases together with a replacement parameter (in this case the scale_in
parameter), until it's finally actually removed.
But if this deprecated parameter and the new parameter are mutually exclusive, then we need to do a late initialization configuration. I will also open an upjet issue to make these configurations automatically.
We also need to add a deprecation comment to the spec.forProvider
field. We can utilize the ArgumentDocs
resource configuration parameter for this purpose. An example for this can be found here:
https://github.com/upbound/provider-gcp/blob/81dcd6d783f700deeab4e8a77335bc14758d2b4a/config/notebooks/config.go#L29
Please also see: https://github.com/golang/go/wiki/Deprecated
/test-examples="examples/compute/windowsvirtualmachinescaleset.yaml" |
/test-examples="examples/compute/windowsvirtualmachinescaleset.yaml" |
1 similar comment
/test-examples="examples/compute/windowsvirtualmachinescaleset.yaml" |
@@ -680,6 +680,7 @@ type WindowsVirtualMachineScaleSetObservation struct { | |||
// A scale_in block as defined below. | |||
ScaleIn []WindowsVirtualMachineScaleSetScaleInObservation `json:"scaleIn,omitempty" tf:"scale_in,omitempty"` | |||
|
|||
// Deprecated, scale_in_policy will be removed in favour of the scale_in code block. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Deprecated, scale_in_policy will be removed in favour of the scale_in code block. | |
// Deprecated: ... |
Please also see: https://github.com/golang/go/wiki/Deprecated
config/compute/config.go
Outdated
r.LateInitializer = config.LateInitializer{ | ||
IgnoredFields: []string{"scale_in_policy"}, | ||
} | ||
r.MetaResource.ArgumentDocs["scale_in_policy"] = "Deprecated, scale_in_policy will be removed in favour of the scale_in code block." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had better use the CRD field names instead of the Terraform configuration parameter names:
r.MetaResource.ArgumentDocs["scale_in_policy"] = "Deprecated, scale_in_policy will be removed in favour of the scale_in code block." | |
r.MetaResource.ArgumentDocs["scale_in_policy"] = "Deprecated, scaleInPolicy will be removed in favour of the scaleIn code block." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @turkenf, lgtm.
Description of your changes
This PR fixes the conflicting parameters and adds dependent resources to make uptestable to
compute.WindowsVirtualMachineScaleSet
resource.Fixes: #487
I have:
make reviewable test
to ensure this PR is ready for review.How has this code been tested
Manually and Uptest: https://github.com/upbound/provider-azure/actions/runs/5512679934