Skip to content
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

Don't force a new resource when updating early renewal time. #34

Merged
merged 5 commits into from
Jun 14, 2019

Conversation

anuraaga
Copy link
Contributor

@anuraaga anuraaga commented Nov 6, 2018

Early renewal time is not a feature of a certificate and just used by terraform to determine whether to recreate a cert. Updating the time itself doesn't need to update the cert. If users used the wrong value for early renewal (for example, specifying a time from issuance instead of the correct time from expiration), they will be forced to rotate certs instead of just tweaking this value.

Also updates go.mod / vendor - couldn't get it to build when it depended on the alpha SDK.

@ghost ghost added the size/XS label Nov 6, 2018
@anuraaga
Copy link
Contributor Author

anuraaga commented Nov 6, 2018

@mildwonkey Hope you can take a look at this PR, otherwise we'll have to directly muck with our state since we messed up the value :-)

@ghost ghost added size/S and removed size/XS labels Nov 6, 2018
@anuraaga
Copy link
Contributor Author

@mildwonkey Ping - would be cool if you get a chance to look at this. Thanks!

@apparentlymart
Copy link
Contributor

Hi @anuraaga! Thanks for working on this and sorry for the slow response.

The Terraform team is currently 100% focused on finishing up the v0.12.0 release so we probably won't be able to look at this for a few more weeks at least. Unfortunately I think directly editing the state here is probably the most expedient path, so that our work on the v0.12.0 release isn't a blocker for you to be able to move forward with terraform apply. 😖

@anuraaga
Copy link
Contributor Author

Actually we still have about half a year (instead of the intended 8 and a half years) before the certs get renewed so we may be able to wait until after 0.12.0. Thanks for the note :)

@anuraaga
Copy link
Contributor Author

@apparentlymart Congratulations on the release of 0.12 :) Just wanted to bring this back in case it's possible to take a look now.

Copy link
Contributor

@apparentlymart apparentlymart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @anuraaga! Sorry for the delay and thanks for your patience here.

I left a comment inline about a possible alternative way to get the result you wanted here that should avoid some annoying safety check errors from Terraform Core in the 0.12 release. Terraform Core includes various additional checks to ensure that providers behave as they planned because in prior versions such unexpected changes would tend to cause confusing downstream errors: dependent resources have their plans built from what they depend on, so it's very important that the apply step produce exactly the planned result to avoid invalidating the plans for other resources.

The different approach I proposed would integrate this logic into Terraform's plan step, thus avoiding the apply-time inconsistency and also (as a bonus) improving the rendered plan output.

However, I know you worked on this a while ago and may not have the time or motivation to rework it to a different approach. If you don't, then no worries! Totally understandable. The Terraform team should be able to spend time here in the not-too-distant future (once we've finished wrapping up some loose ends on the 0.12 release) and we'd be happy to take this over the line if you cannot.

Thanks again for working on this, and sorry for the delay in reviewing it. 😖

tls/resource_certificate.go Outdated Show resolved Hide resolved
…g diff computation. Only force new resources when updating early_renewal_hours if it causes this time to go negative.
@anuraaga
Copy link
Contributor Author

anuraaga commented Jun 14, 2019

@apparentlymart Thanks for the advice - I've updated to use CustomizeDiff and added test cases that seem to verify the behavior. Haven't written such large change in the terraform codebase before though welcome to any style, etc suggestions.

Also, while I have your attention, if I can point you at this completely unrelated PR for possibly a push...

It's been approved for a while and is quite critical for using terraform with k8s - I ended up forking the provider since I couldn't upgrade to 0.12 without downtime since parser whitespace changes were triggering a destroy instead of update ><

…e to prevent extraneous output during terraformApply before renewal.
@ghost ghost added size/XXL and removed size/XL labels Jun 14, 2019
@apparentlymart
Copy link
Contributor

Thanks for working on these updates @anuraaga! This looks great to me. I'm going to merge it now.


(On the subject of the Kubernetes provider PR: I'm not on the team for that provider and so I can't influence that team's prioritization. It looks like one of the team members is already participating and has been repeatedly tagged on it, so I'm sure it's on the team's radar and they'll get to it.)

@apparentlymart apparentlymart merged commit f708ada into hashicorp:master Jun 14, 2019
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants