-
Notifications
You must be signed in to change notification settings - Fork 118
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
Files are stored in the state file multiple times making the state huge #287
Comments
Hi @sashee 👋 The contents of the state file reflect the values associated with the resource or data source. This is a fundamental aspect of Terraform and represents a design feature that is used for tracking changes in state and for making the values available for use elsewhere, such as further Terraform configuration. Consequently, not storing the values in state would mean that these values were no longer accessible or available for use. |
Hi @bendbennett , Do you see a way to at least eliminate the repetition? Maybe an attribute that says which outputs are not needed. In the example above, I use the Alternatively, maybe a separate data source that writes the contents into a file would cover my use case as well. In that case, the state could omit the response body altogether. |
Hi @sashee, Thank you for the suggestion. We will consider your proposal in light of the level of community interest that this issue receives. In terms of the repetition, the |
We found the same issue while developing our Apps, it would be nice if the size of the file got reduced |
It would be nice if it was at least stored just once. |
In some cases it is a problem even if it's stored once. I have a ~20MB binary I download before packaging it with some other files for deployment. The resulting state is ~300 MB which is completely unmanageable. Perhaps one way to go about it is to store a hash of the body if it exceeds a certain size? |
Terraform CLI and Provider Versions
Terraform v1.5.1
on linux_amd64
Terraform Configuration
Expected Behavior
The state file is not too big.
Actual Behavior
Downloading a ~400kB image blows up the state file:
Looking into it I see that the file contains the entire contents of the file multiple times:
It would be nice if either the body would not be in the state file at all or at least it wouldn't be included multiple times.
Steps to Reproduce
terraform apply
How much impact is this issue causing?
Medium
Logs
https://gist.github.com/sashee/ee2392c311a64ec0a1f5789b319528f0
Additional Information
What I'm trying to do is to dynamically download a binary file (an image) and upload it to an S3 bucket. If there would be a way to specify a filename the http data source downloads the file without exposing the contents at all would also solve this problem.
Code of Conduct
The text was updated successfully, but these errors were encountered: