-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
azurerm_kubernetes_cluster
- support for upgrade_override_setting
property
#27962
base: main
Are you sure you want to change the base?
azurerm_kubernetes_cluster
- support for upgrade_override_setting
property
#27962
Conversation
feat: implement upgrade settings for container service Revert "feat: implement upgrade settings for container service"
MaxItems: 1, | ||
Elem: &pluginsdk.Resource{ | ||
Schema: map[string]*pluginsdk.Schema{ | ||
"effective_until": { |
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.
According to the guideline suggestions, we may make it a top level property.
terraform-provider-azurerm/contributing/topics/schema-design-considerations.md
Lines 75 to 85 in 778c935
Finally there are instances where the addtional fields/properties for a object/feature are optional or few in number, as shown below. | |
Example C. | |
```go | |
type ManagedClusterStorageProfileDiskCSIDriver struct { | |
Enabled *bool `json:"enabled,omitempty"` | |
Version *string `json:"version,omitempty"` | |
} | |
``` | |
In cases like these one option is to flatten the block into two top level properties: |
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.
@wuxu92, totally agree with you here, however it appears that not all of the possible fields have been exposed here as well based on the REST API documentation for this property. We should also drop the _settings
part from the name of the exposed field in the provider, also per the contributing guide. 🙂
- For blocks avoid redundant words in the name that don't add informational value e.g.
firewall_properties can be shortened to firewall, the same can apply to individual properties e.g. email_address to email.
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.
The only other field in the block is forceUpgrade
as a boolean, which doesn't need to be exposed. So we may only need to expose one property named upgrade_override_until
and keep the expand/flatten logic as it is now.
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.
I am hesistant to add this as a top level as service team indicated there may be additional properties relevant to upgrade_override_setting
added later. We may, in future, need to wrap around these properties a layer down in upgrade_override_setting
as it doesn't make sense to expose all of them in top level.
I will update the naming to upgrade_override
.
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.
Thanks @hqhqhqhqhqhqhqhqhqhqhq - this looks mostly good, but I have questions on the schema design and the testing approach if you can take a look?
"upgrade_override_setting": { | ||
Type: pluginsdk.TypeList, | ||
Optional: true, | ||
MaxItems: 1, | ||
Elem: &pluginsdk.Resource{ | ||
Schema: map[string]*pluginsdk.Schema{ | ||
"effective_until": { | ||
Type: pluginsdk.TypeString, | ||
Optional: true, | ||
ValidateFunc: validation.IsRFC3339Time, | ||
}, | ||
}, | ||
}, | ||
}, |
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.
Is this the only configurable property in this block? If so, it might be worth flattening this down to a single property, for example upgrade_override_until
?
What happens to this value when the specified point in time passes, is it removed from the response, or still returned?
Should we also validate that the supplied time is in the future?
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.
- There is only one property that user should configure, but service team indicated more may be added later.
- When the value is in the past in time, it will stay in the response
- I prefer not to add this check because if the time is in the past, users don't need to update it every single time; they can leave it as is (and it will not have any impact).
if isUpgradeOverrideSettingEnabled { | ||
upgradeOverrideSetting = ` | ||
upgrade_override_setting { | ||
effective_until = "2024-01-01T00:00:00Z" |
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.
Does it make sense to be testing a time in the past here? It's unlikely this will be representative of user input? Could we generate a value for this based on time.Now()
plus some realistic duration?
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.
Updated
Hi @jackofallops @WodansSon |
@hqhqhqhqhqhqhqhqhqhqhq, Thanks for pushing those changes, this LGTM 🚀 |
Community Note
Description
Support for
upgrade_override_setting
property inazurerm_kubernetes_cluster
.PR Checklist
For example: “
resource_name_here
- description of change e.g. adding propertynew_property_name_here
”Changes to existing Resource / Data Source
Testing
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_resource
- support for thething1
property [GH-00000]This is a (please select all that apply):
Related Issue(s)
Note
If this PR changes meaningfully during the course of review please update the title and description as required.