{"id":13795831,"url":"https://github.com/minamijoyo/tflock","last_synced_at":"2025-08-10T08:40:11.910Z","repository":{"id":49559585,"uuid":"229205509","full_name":"minamijoyo/tflock","owner":"minamijoyo","description":"Lock your Terraform state manually","archived":false,"fork":false,"pushed_at":"2021-06-14T16:58:43.000Z","size":86,"stargazers_count":70,"open_issues_count":5,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-30T09:15:19.422Z","etag":null,"topics":["go","terraform"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/minamijoyo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-20T06:38:27.000Z","updated_at":"2024-11-15T20:22:01.000Z","dependencies_parsed_at":"2022-09-26T18:41:03.233Z","dependency_job_id":null,"html_url":"https://github.com/minamijoyo/tflock","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/minamijoyo/tflock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minamijoyo%2Ftflock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minamijoyo%2Ftflock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minamijoyo%2Ftflock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minamijoyo%2Ftflock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/minamijoyo","download_url":"https://codeload.github.com/minamijoyo/tflock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minamijoyo%2Ftflock/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269698328,"owners_count":24461194,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","terraform"],"created_at":"2024-08-03T23:01:02.931Z","updated_at":"2025-08-10T08:40:11.865Z","avatar_url":"https://github.com/minamijoyo.png","language":"Go","funding_links":[],"categories":["Terraform"],"sub_categories":["Kubernetes // Storage"],"readme":"# tflock\n\nLock your Terraform state manually.\n\n# Why\n\nTerraform has a state lock mechanism and it works automatically.\nNevertheless, I found it's useful to lock state manually when refactoring Terraform configurations.\n\nIn team development, Terraform configurations are generally managed by VCS such as git, and states are shared via a remote state storage which outside of version control. Most Terraform refactorings require not only configuration changes but also state manipulations such as state mv / rm / import. It is not desirable to change state before merging configuration changes. My colleague may be working for another task. I don't want team members to change the state during refactoring to avoid unexpected conflicts.\n\nTerraform has the `terraform force-unlock` command in case something goes wrong, however it doesn't provide the `terraform lock` command.\nIt seems that this decision was intentional by design. Not all backend types can acquire explicit lock.\nFor more details, see https://github.com/hashicorp/terraform/issues/17203\n\nBut I want `terraform lock` command!\n\nNOTICE: I had written the tflock for refactoring Terraform configurations, but after using it, I figured out a more sophisticated way and I wrote a new tool: [tfmigrate](https://github.com/minamijoyo/tfmigrate). If your concern is only refactoring, I highly recommend you to use the tfmigrate rather than the tflock.\n\n# Features\n\n- Lock your Terraform state manually.\n\nThat's all.\n\nCurrently, it is tested only with Terraform 0.15 + AWS S3 (locked with DynamoDB).\n\nThe tflock uses a state lock function as same as Terraform uses under the hood.\nSo other backend types may or may not work.\n\n# Prerequisites\n\nState locking must be enabled in your Terraform backend configuration.\n\nIf you haven't set it up yet, see Terraform documentation:\nhttps://www.terraform.io/docs/state/locking.html\n\n# Install\n\nRequired: Go 1.16+.\n\n* Clone tflock repo\n\n```\n$ cd tflock\n$ go build .\n\n$ tflock --version\n0.0.1\n```\n\n# Usage\n\nTo lock your Terraform state, run `tflock` command in the same directory where you run the `terraform init` command.\n\n```\n$ tflock\n```\n\nIf you want to check if locked successfully , use `terraform plan` command.\n\nIf you want to unlock, use `terraform force-unlock` command.\n\n# License\nMIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminamijoyo%2Ftflock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fminamijoyo%2Ftflock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminamijoyo%2Ftflock/lists"}