-
Notifications
You must be signed in to change notification settings - Fork 93
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
fix: add vra_deployment.recreate_if_expired_at
attribute
#514
base: main
Are you sure you want to change the base?
Conversation
0e9fd3e
to
1c6ae3a
Compare
DCO signed. before merge, please note the alternatives described in the linked issue comment |
vra_deployment.recreate_if_expired_at
attribute
Signed-off-by: Jonathan Biegert <[email protected]>
1c6ae3a
to
6f5fdf7
Compare
Rebased to current main due to merge conflict. @tenthirtyam you assigned me, but I have no permissions to merge here / need a review by some maintainer. Who's able to do that? |
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.
Suggesting a change as follows that would be a bit more simplified and idiomatic.
CustomizeDiff: customdiff.ForceNewIf(
"recreate_if_expired_at",
func(ctx context.Context, d *schema.ResourceDiff, meta interface{}) bool {
planTime, valid := getParsedTime(d, "recreate_if_expired_at")
if !valid {
return false
}
expirationTime, valid := getParsedTime(d, "lease_expire_at")
if !valid {
return false
}
return expirationTime.Before(planTime)
}
),
and
func getParsedTime(d *schema.ResourceDiff, key string) (time.Time, bool) {
timeStr, ok := d.GetOk(key)
if !ok {
log.Printf("[INFO] Missing or invalid time string for key %s: %#v", key, timeStr)
return time.Time{}, false
}
parsedTime, err := strfmt.ParseDateTime(timeStr.(string))
if err != nil {
log.Printf("[INFO] Failed to parse DateTime for key %s: %#v", key, timeStr)
return time.Time{}, false
}
return time.Time(parsedTime), true
}
see #473 especially #473 (comment)