Title: Warn if your .terraform.lock.hcl is modified after running `terraform init` · Issue #18237 · coder/coder · GitHub
Open Graph Title: Warn if your .terraform.lock.hcl is modified after running `terraform init` · Issue #18237 · coder/coder
X Title: Warn if your .terraform.lock.hcl is modified after running `terraform init` · Issue #18237 · coder/coder
Description: Background When we run a Terraform provisioner job, we run terraform init to download modules before running the plan / apply. When uploading a template, we encourage users to run terraform init locally to ensure that a .terraform.lock.h...
Open Graph Description: Background When we run a Terraform provisioner job, we run terraform init to download modules before running the plan / apply. When uploading a template, we encourage users to run terraform init lo...
X Description: Background When we run a Terraform provisioner job, we run terraform init to download modules before running the plan / apply. When uploading a template, we encourage users to run terraform init lo...
Opengraph URL: https://github.com/coder/coder/issues/18237
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Warn if your .terraform.lock.hcl is modified after running `terraform init`","articleBody":"# Background\n\nWhen we run a Terraform provisioner job, we run `terraform init` to download modules before running the plan / apply.\n\nWhen uploading a template, we encourage users to run `terraform init` locally to ensure that a `.terraform.lock.hcl` file is created. This allows Coder to improve provisioning speeds by re-using previously downloaded provider versions.\n\n# Problem\n\nIf you run `terraform init` to create a `.terraform.lock.hcl`, Terraform will initialise the lock file with provider hashes based on your OS/arch. If you run this on a different architecture to your target Coder instance, you may end up with missing hashes in your lock file.\n\nYour only warning of this will be the following message in the provisioner job log:\n\n```\n- Reusing previous version of hashicorp/aws from the dependency lock file\n- Installing hashicorp/aws v5.99.1...\n- Installed hashicorp/aws v5.99.1 (signed by HashiCorp)\nTerraform has made some changes to the provider dependency selections recorded\nin the .terraform.lock.hcl file. Review those changes and commit them to your\nversion control system if they represent changes you intended to make.\nTerraform has been successfully initialized!\n```\n\nWhat you really want to see is:\n```\n- Reusing previous version of hashicorp/aws from the dependency lock file\n- Using hashicorp/aws v5.99.1 from the shared cache directory\nTerraform has been successfully initialized!\n```\n\nThe fix for this is to re-run `terraform init` on a version of Terraform with the same OS/arch.\n\n# Proposed Solution\n\n* Record the checksum of `.terraform.lock.hcl` before and after running `terraform init`.\n* If the checksum changes, warn the user that they may be downloading Terraform providers unnecessarily and direct them to re-generate the lockfile manually on the same OS/arch as Coder.\n* We can also attempt to highlight the message regarding changes to the lockfile in the UI.\n* Stretch goal: expose a provisioner method to run `terraform init` _and update the lockfile if there are any changes_.","author":{"url":"https://github.com/johnstcn","@type":"Person","name":"johnstcn"},"datePublished":"2025-06-04T20:02:48Z","url":"https://github.com/coder/coder/issues/18237"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:65f7d640-dfa7-18d5-c3c6-edd7fa58f006 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8664:2D02CB:3A21EA:4C976C:6B0170C1 |
| html-safe-nonce | b8aa9c3d702081396cdd15942fe3d0804411a178a06398454dae41f673886bbe |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NjY0OjJEMDJDQjozQTIxRUE6NEM5NzZDOjZCMDE3MEMxIiwidmlzaXRvcl9pZCI6IjQwNDM4NDcxMDEyMzMzMjgzMjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f2950dd40512c6e767957521d0d00dc4d7283ca7c3f0fde44d495a737afb5a6e |
| hovercard-subject-tag | issue:3118973471 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/18237/issue_layout |
| twitter:image | https://opengraph.githubassets.com/70657ab58008c7573dd80f1da3b57966498249b55ea626dc82b2ba2f14454457/coder/coder/issues/18237 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/70657ab58008c7573dd80f1da3b57966498249b55ea626dc82b2ba2f14454457/coder/coder/issues/18237 |
| og:image:alt | Background When we run a Terraform provisioner job, we run terraform init to download modules before running the plan / apply. When uploading a template, we encourage users to run terraform init lo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | johnstcn |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/coder git https://github.com/coder/coder.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 440752086 |
| octolytics-dimension-repository_nwo | coder/coder |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 440752086 |
| octolytics-dimension-repository_network_root_nwo | coder/coder |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width