-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
user-data forces new resource when you move from windows to linux #8467
Comments
My team is having this issue as well. Passing modules with user-data between MacBooks will cause the SHA to change. To stop this, we just add: |
Tested and working, thanks! |
Are you specifying user data as a direct string or via the |
I am using the file function call.
|
Having the same problem here in 7.0.1 using template_file resource in userdata. |
Same thing using |
Still seeing this in 0.9.2. @PeteGoo I think it's definitely line endings. When I flip the script file's line endings the checksum once again matches the before side of the |
I was able to recover by running |
Same problem with terraform 1.11.11 |
Hi all, Terraform explicitly does not normalize line endings by platform, so you must ensure that nothing else in your workflow is causing line endings to be different by platform. Terraform does not automatically normalize line endings specifically because files loaded in to Terraform are often intended to be submitted to a remote system that may be running a different operating system and thus Terraform cannot predict with certainty which line ending convention would be appropriate. In particular, it's important to ensure that your version control system is not rewriting line endings when pushing and pulling changes between platforms. For Git, one way to force that is to tell Git to treat the files in question as binary by placing a file called
You can find more details on this in GitHub's guide to line endings in Git. We're going to close this now because unfortunately Terraform is working as expected here and the problem is with some other system (often Git) making unexpected changes to the files. Terraform itself cannot detect that this has happened or prevent it, so there's unfortunately nothing we can do within Terraform itself to avoid this problem. Sorry for the long delay in responding. Hopefully the above is helpful to those who have encountered this problem. |
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 v0.7.1
user-data forces new resource when you move terraform apply from windows to linux and vice versa
When I launch infrastructure on a windows platform and commit to code commit and a colleague on a linux platform pulls down down latest commit, user_data will want to force a new resource. I have verified this also happens from Linux to windows when the apply is done from the linux OS and latest commit pulled down from to windows.
I have ensured the file line endings are CRLF when running in windows and LF in in Linux as I had seen this mentioned as a potential issue.
This is a hindrance as I have to comment out user-data once an environment is launched to allow users on linux platforms platforms to manage the infrastructure without destroying the entire infrastructure with a terraform apply. This has obvious consequences if I ever want to increase the count of my instances since user-data is then commented out.
Anyone seeing this?
The text was updated successfully, but these errors were encountered: