-
Notifications
You must be signed in to change notification settings - Fork 142
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
Output variable refresh bug #388
Output variable refresh bug #388
Conversation
Rebased onto master, just going to retest |
Full acceptance test suite passing for me ✅ |
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.
LGTM but going to request another Terraform SME who has historical context to take a look as well.
Hmm it's hard to remember why we did this, trying to find context: |
This was discussed internally. @bengesoff will attempt to replicate issue with logging blocks, and if is unable to replicate we'll be OK proceeding with the understanding that this PR will include extra documentation to explain to users how to trim whitespace for their keys if this indeed does bubble back up as an issue in the future. |
Update from my logging whitespace investigations: As feared, the API handling of whitespace in the PEM blobs doesn’t appear to be consistent. It appears that at least Elasticsearch and Kafka logging both strip the whitespace off, whereas BigQuery and others preserve whatever is given to them. This means that the The result of this being that we essentially have three options:
|
In addition to the first bullet point of my previous comment: we could also augment the documentation with a func validateStringTrimmed(value interface{}, p cty.Path) diag.Diagnostics {
if value != strings.TrimSpace(value.(string)) {
return diag.FromErr(p.NewErrorf("string must not contain trailing whitespace"))
}
return nil
} This might be a good alternative to removing the |
Hi @bengesoff I was discussing this in more detail with @phamann and we came to the conclusion that regardless of what we do in the Terraform provider, the backend APIs need to be consistent by trimming excess whitespace. Additionally Patrick wondered if we could maybe utilise But again, we'd still need the data to be stored Fastly's side trimmed. Let me know you thoughts. |
Hi @Integralist Just to clarify, you guys reckon the direction is to always trim rather than never trim the whitespace? I did try the |
@bengesoff OK no worries, thanks for that feedback. re:
The thinking here is that only the BigQuery and GCS endpoints are different, and so adding trimming to those endpoints is a smaller blast radius than the reverse which would be removing trimming from everywhere. If the APIs do this then it would mean we'd use your ValidateFunc suggestion and have this change as part of a v1 release as this change would be 'breaking' in the sense that we're now forcing the requirement to trim the content back onto users where before it was handled internally by the provider. |
That makes sense, fair enough! Are you waiting for a final decision on this still? |
Yup! There's an internal ticket that I'm following to see how this progresses. I'll let you know whenever we have an update. |
@bengesoff FYI - might not affect this PR but the |
…oned_version and active_version attributes will be recomputed Also had to fiddle with some trimspace() on the BigQuery Logging block as the new custom diffs were failing with the StateFunc there. This needs a more permanent solution but it has got things passing for now.
This PR should now be safe without having to wait for our internal API work (thanks to #439). |
CustomizeDiff
function to the service resource to mark thecloned_version
andactive_version
attributes as recomputed when any of the other attributes change (with the exception ofname
,comment
andversion_comment
). This solves the problem where an output variable referencing these attributes wouldn't be updated after anapply
and would require anotherapply
orrefresh
for this to propagate through.StateFunc
s from all of the logging blocks as these were causing unnecessary whitespace diffs for theCustomizeDiff
s and forcing the tests to fail with non-empty plans (the version was being marked as recomputed). I couldn't find any adverse effects from doing this, but would appreciate some confirmation here as there were a lot of comments about a known issue and there might have been a good reason that they were added in.