-
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
scheduler_job_collection: Renamed max_retry_interval to max_recurrence_interval to better match azure #1218
Conversation
…ecurrence_interval to better match azure
9dfd377
to
cc2142e
Compare
cc2142e
to
b243043
Compare
Tests pass:
|
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.
A couple of minor points - but if we can clean up the comments this otherwise LGTM 👍
@@ -69,6 +69,7 @@ func resourceArmSchedulerJobCollection() *schema.Resource { | |||
"quota": { | |||
Type: schema.TypeList, | |||
Optional: true, | |||
MinItems: 1, |
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.
if this isn't required then this can be removed
@@ -102,7 +102,7 @@ func dataSourceArmSchedulerJobCollectionRead(d *schema.ResourceData, meta interf | |||
} | |||
d.Set("state", string(properties.State)) | |||
|
|||
if err := d.Set("quota", flattenAzureArmSchedulerJobCollectionQuota(properties.Quota)); err != nil { | |||
if err := d.Set("quota", flattenAzureArmSchedulerJobCollectionQuota(properties.Quota, d.Get("quota").([]interface{}))); err != nil { |
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.
in general we shouldn't access properties via d.Get
in the Read method - since they can be absent when importing
if v, ok := b["max_retry_interval"].(int); ok && v > 0 { | ||
maxRecurrenceField = "max_retry_interval" | ||
} //else max_recurrence_interval is in use, or we default to max_recurrence_interval | ||
} |
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.
rather than doing this, we can instead just assign both of these values, since one's deprecated
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.
as discussed IRL
ValidateFunc: validation.IntAtLeast(1), //changes depending on the frequency, unknown maximums | ||
Type: schema.TypeInt, | ||
Optional: true, | ||
Deprecated: "Renamed to match azure", |
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 can make this Computed and remove the ConflictsWith
if v, ok := quotaBlock["max_retry_interval"].(int); ok && v > 0 { | ||
quota.MaxRecurrence.Interval = utils.Int32(int32(v)) | ||
} | ||
if v, ok := quotaBlock["max_recurrence_interval"].(int); ok && v > 0 { | ||
quota.MaxRecurrence.Interval = utils.Int32(int32(v)) | ||
} |
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.
if v, ok := quotaBlock["max_recurrence_interval"]; ok {
// use the new value
quota.MaxRecurrence.Interval = utils.Int32(int32(v))
} elseif v, ok := quotaBlock["max_retry_interval"]; ok {
// use the old value
quota.MaxRecurrence.Interval = utils.Int32(int32(v))
}
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.
now LGTM 👍
tests pass:
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
No description provided.