-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Panic creating/reading remote state #7455
Comments
Hi @agonzalezro My apologies this has happened - please can you tell me post the piece of the debug output that has the panic in it? We don't need anything that has any config in it, just the actual panic message and the few lines after it that with give us an idea Paul |
Hi @stack72, thanks for the quick response. Could this help? https://gist.github.com/agonzalezro/69097ba7c3488c8ab7a802c18129ae81#file-error_console |
@agonzalezro was the remote state you're reading also generated by Terraform 0.7.0, or was that produced by an earlier version of Terraform? There were some changes to the state format for 0.7.0 so I'm wondering if you've hit a bug in the state upgrade code. |
Hi @agonzalezro, Thanks for the extra info. I can reproduce this locally, and we will look into it. |
@apparentlymart it doesn't seem like it. I tried in a completely clean state (no previous tfstate). @jbardin thanks! Good luck & let me know if there is something else I can help with. |
The following config will produce a crash on resource "aws_s3_bucket" "state_bucket" {
bucket = "terraform-state-bucket-1234567"
}
data "terraform_remote_state" "remote_state" {
backend = "s3"
config {
bucket = "${aws_s3_bucket.state_bucket.bucket}"
key = "terraform.tfstate"
}
} |
Hi @agonzalezro, After reading more carefully, I think the part of the problem here is that you're not starting with any remote state. This config won't create a remote state, because the The crash when the remote state is missing is still a bug, which we can fix for the next release. |
Do you mean that I require a manual step before being able to use the remote state? If I need to run
knowing the values o We are trying to create different states per environment based on Is it possible perhaps to work around this adding an empty file to the s3 bucket with an empty state? Do you perhaps know how other people ended up managing this? Thanks! |
I have build this from source I am hitting this as well. Crash on creating the remote state.
Debug message available here : https://gist.github.com/rmenn/88fe8528ab4396138a7539da2bd81deb |
core: Return an error when there's no remote state
Hi @rmenn, The above PR wasn't merged yet. The latest version on master should no longer crash in this case. The terraform_remote_state resource, which is now referred to as a data source, is read only. You can use the |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Terraform Version
Terraform v0.7.0-dev
Affected Resource(s)
Terraform Configuration Files
Debug Output
I can privately share it or anonymized it if needed.
Panic Output
I can privately share it or anonymized it if needed.
Expected Behavior
Actual Behavior
Steps to Reproduce
terraform apply
Important Factoids
We are using roles for the accounts.
The text was updated successfully, but these errors were encountered: