-
Notifications
You must be signed in to change notification settings - Fork 31
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
feat: do not save imported state to statefile #589
Conversation
0b82070
to
9f9113d
Compare
9f9113d
to
0f79292
Compare
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.
just one super small thing, otherwise lgtm
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.
Agreed with @peterdeme that we should drop comments to explain the why. Otherwise, makes sense to me 👍🏻
Thanks @eliecharra and @peterdeme I've updated the PR with comments. |
@Apollorion approved, thanks! |
We should not save peoples state to our state file. If an admin stack is managing many stacks with
import_state
it could cause peoples state to explode in size and it also causes memory to explode because of internal terraform comparisons. I have examples of this, if you'd like to see them.Because of this attributes'
DiffSuppressFunc
, we will never see a change here so whats in state does not matter. I can also think of an easy way to allow diffing of this when usingForceNew
as well, but I was unsure if this was purposefully added here since we're dealing with state so I left that alone. Happy to discuss that if warranted.This change will:
import_state
will not save the imported state to this state file.import_state
keys value from the state file.Migration Proof
Proof that state migration works, note the
.resources[0].instances[0].schema_version
changes from0
to1
and that.resources[0].instances[0].attributes.import_state
changes from a whole state file to""
.Schema Version Change
Attribute Change
Full Old State (v1.19.0 of the provider)
Full New State
Clean Tofu Apply with Dev Override
Proof State is still uploaded