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

Simplify DefaultFunc to just Default #379

Merged
merged 1 commit into from
Mar 29, 2019

Conversation

VladRassokhin
Copy link
Contributor

There's no need for functions and it can be inlined.
This change will help showing proper default values in IntelliJ-Terraform plugin.

@ghost ghost added the size/XS label Mar 28, 2019
@pdecat
Copy link
Contributor

pdecat commented Mar 28, 2019

Indeed!

This used to be dynamic at some point: b89dbbd#diff-87d7af58ecf86062f1ac897d735c8c0dR216

But that was later changed.

Edit: can't recollect the actual use case back then, #193 was a long running PR that was reworked/rebased several times.

Copy link
Contributor

@pdecat pdecat left a comment

Choose a reason for hiding this comment

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

LGTM!

@alexsomesan
Copy link
Member

Change looks good at first glance.

Have you considered the implications of the default function now being evaluated a different time during runtime? Can that raise any issues? (I have to look into the differences myself).

@VladRassokhin
Copy link
Contributor Author

Given how DefaultValue() works it's safe change.

Yes, execution time changes, but effect is still the same as function only relates on 'isComputed' which cannot differ over time because it's value, not pointer.

@pdecat
Copy link
Contributor

pdecat commented Mar 28, 2019

AFAIR, the default value of some specific field was dynamic, but that was useless, so I removed it.
In the current implementation, all default values are static.
The only remaining "dynamic" part is if the isComputed parameter is true of false.

@VladRassokhin
Copy link
Contributor Author

So, it's ok to merge? :)

Copy link
Member

@alexsomesan alexsomesan left a comment

Choose a reason for hiding this comment

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

CI is green, I think we are good to merge.

@alexsomesan alexsomesan merged commit 2c87cda into hashicorp:master Mar 29, 2019
@VladRassokhin VladRassokhin deleted the simplify-default-func branch March 29, 2019 12:37
@ghost ghost locked and limited conversation to collaborators Apr 21, 2020
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.

3 participants