-
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
upgrade to terraform 0.9.0 - use legacy remote state #12792
Comments
Hey @SydOps, happy to help here. I'm not seeing the same behavior and could use some help to get there... here is what I have. Note that my end result was that Terraform guided me properly to upgrade the state, migrated my legacy state, and then removed my old legacy state config (though the data still remained, it doesn't delete it). I was unable to see your behavior... do you mind telling me what I'm missing? Thanks! 1. I setup an existing remote state with Terraform 0.8.8
I verified that the local state is not being used and that the "legacy" file has my state properly. 2. I ran I see this:
3. I added a backend config to my file and ran plan again I added this config:
And plan said this:
4. I ran
5. I ran
Conclusion Everything upgraded properly and no more deprecation warnings once I updated. Please let me know what I'm missing! |
Thanks, @mitchellh I updated part of
Back to my problem, I saw the message in step 4 at first time when run With |
Another difference I found, after in terraform 0.8.8, tfstat file at .terraform/terraform.tfstate But in terraform 0.9.0, there are two state files:
So with old version, clean |
Hey @SydOps. I just tried S3 + Docker-based TF and still can't reproduce your scenario... I'm confused but really want to help you here. A couple weird things:
Are you passing any flags to apply/plan/etc.? I'm sorry to ask for this but is there any way you can try to reproduce this with a fresh environment (using both the 0.8.8 and 0.9 binaries as I did above) so I can just try a step-by-step approach? |
I pass a varfile UPDATESI also run terraform plan with |
I'm experiencing the same, where Since our setup is a bit more complicated, I'll try to extract a minimal reproducible example and share the findings. |
@mitchellh Can you please give some example to configure s3 backend with and without locking state? I used below config but it could not able to see remote state configured properly using
It just output like this:
If you run terraform plan after this then it just create terraform.tfstate file locally instead of creating in s3 bucket. Please let me know your inputs for the same, thanks! |
People keep saying things like "Add this to config"
But what is "config"?! I have tons of state files, and tf files etc... what is all this talk about a "config" file? |
@voltechs Sorry, by "config" we mean "TF configuration files" (.tf files). |
I created a file with the same name, and same configuration. This is my output
And I run Exactly the same as yours so assuming something different again... |
I wrote this user groups email just now and only then I found this thread. These 2 points look very similar to what I am seeing in my paired down repo here, despite my repo demonstrates a non-upgrade approach. |
Hey @stephenchu I saw your email! I'm planning on taking a look right after lunch here so we can get a fix in as part of 0.9.1 (assuming I can repro). |
Plus to read the comments in below issue. There are two ways to set the backend config. |
Ah @stephenchu you're experiencing a bug that was just recently fixed where apply from a plan file didn't respect backend configurations. This is fixed in 0.9.1! |
@SydOps is this perhaps how you were getting a local state? Were you running a |
Thanks for the updates, I will run the plan/apply again on version 0.9.1 to confirm if my problem can be fixed or not. Yes, I run plan with |
By the way, @mitchellh Can we have the new docker image with terraform v0.9.1 |
Yes we will, it appears that Alpine had some issues with 0.9.0. @SydOps I'm confident your issue is the same as what was fixed yesterday then. 0.9.1 is building now and will be released within the hour and should resolve this. Also, you'll be happy to know i added |
I run
The However, not using plan output, i.e. |
I managed to fix this problem by downloading the tfstate file from S3, removing the "remote" section from the top
then uploading the modified version. After this, I can output and apply plan files successfully. This is the root bug, that the 0.8.x => 0.9.x migration doesn't remove the legacy remote and/or that the documentation doesn't mention this at all. |
Ah hah, there is a new issue tracking this I'm taking a look #12871 |
I'm still facing the problem while setting remote state with s3 where modules are used in main.tf files.
However if I use the same remote-state.tf file for testing, it could set s3 remote backend properly.
Please let me know your thoughts for the same and will able to provide more information on this. |
@sachincab I don't understand what incorrect behavior exists, please go into more detail. Thank you! |
Just trying to upgrade from TF 0.8.8. to 0.9.1 and encountered this problem. Even due this issues is closed it doesn't look like it has been solved in 0.9.1. Our situation:
Some observations:
Workaround to upgrade without editing state file manually:
Conclusion is that the remote state entry in the original pre-0.9 state file is not removed when migrating the state to the (new) backend, causing generating an invalid plan file. As |
@koenijn Thanks for your feedback! We fixed the removal of the "remote" section on migration in master and it will be part of 0.9.2 next week. |
thx for the quick fix! was hitting this today , right before an upgrade |
@mitchellh What do you think of a mailing list to notify users of deprecations and upcoming breaking changes? My team doesn't have well-formed expectations regarding the frequency at which we'll run plan or apply on our infrastructure, so it would be great to know ASAP of changes like this. |
@jdori Details of all changes (including upcoming releases it seems): https://github.com/hashicorp/terraform/blob/master/CHANGELOG.md And if you want notifications, you can subscribe to an atom feed for all new releases: |
I must be missing something fundamental here. I've been using Terraform since pre 0.7 (yay, me) and now I get the deprecation warning. I followed the instructions with no success and now I've tried your suggestion as well with no luck. I use s3 for state storage and also see the same state file on my local drive. Did you remove the remote section from both the s3 copy and the local copy? I'm currently on 0.9.9 and would really like to remove this deprecation warning. |
I really don't understand how this issue can be considered closed when following the instructions does not return desired results. I followed the instructions. Backed up my state file. Ran My state file contains the following:
|
@mitchellh Sorry to keep harping on this issue but I can't get rid of the deprecation warning. As you can see from my two previous messages, I followed the upgrade instructions and I'm sure I'm missing something silly. Thanks! |
Any update on this? I can't find any other ticket for this issue which is why I keep writing here |
Understood your frustration, but the information you provide is not detail enough, and here is not the right place to discuss and fix your issue. I recommend you to raise a ticket in stackoverflow for your problem with details tf codes, *.tfstate file, errors and other informations you can provide. Good luck |
I don't understand why this isn't the correct place. My issue is exactly
what the title of this issue is. I also provided my code snippet in a
previous message.
Regardless, I'll do what you suggest and try my luck there.
Thank you
…On Aug 14, 2017 18:12, "Bill Wang" ***@***.***> wrote:
@jmvbxx <https://github.com/jmvbxx>
Understood your frustration, but the information you provide is not detail
enough, and here is not the right place to discuss and fix your issue.
I recommend you to raise a ticket in stackoverflow for your problem with
details tf codes, *.tfstate file, errors and other informations you can
provide.
Good luck
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#12792 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJryY2UlofN08cU-5jFjwS4dn4so8V4Iks5sYNRdgaJpZM4MgFDb>
.
|
Hi @jmvbxx! Sorry the previous fixes aren't working for you. Given the age of this issue, and that you're using a newer Terraform version than was apparently last used to do these steps, I think it's best to start a fresh issue for this since you may have found a regression or a new bug introduced since 0.9.2. That will give us a fresh place to dig into the problem and avoid creating notification noise for the many people who previously participated in this issue. I understand that the symptoms seem similar but, often different bugs can have similar symptoms due to the complexity of Terraform's state migration codepaths. |
Thank you @apparentlymart! I'll do that right away and stop bugging in this dusty old ticket :-) |
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. |
Hi there,
Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.
Terraform Version
0.9.0
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
Debug Output
Upgrade exist stack from 0.8.8 to 0.9.0
run
terraform init
,run
terraform plan
, work as normalBut run
terraform apply
Re-run
terrafrom apply
several times, get same warning.Check the state file,
This part has been updated to 0.9.0
But still have the session of
remote
. If compare with a total new stack created by terraform 0.9.0, there is noremote
session any more.Panic Output
terraform apply is successful, no error, only warning
Expected Behavior
How to get the old state file converted to 0.9.0 properly?
Actual Behavior
State file gets version updates, but still with old format.
Steps to Reproduce
Detail in
Debug Output
Important Factoids
Run stack in AWS
old terraform stack has used s3 as backup to save the tfstate file.
I can't install new version of terraform command on the CI/CD build agent, run terraform from container
hashicorp/terraform:0.9.0
References
The text was updated successfully, but these errors were encountered: