{"id":16989518,"url":"https://github.com/jottenlips/terraform-state-s3-backend-example","last_synced_at":"2025-09-13T12:37:22.829Z","repository":{"id":52564827,"uuid":"521002291","full_name":"jottenlips/terraform-state-s3-backend-example","owner":"jottenlips","description":"🌀 terraform your terraform s3 backend","archived":false,"fork":false,"pushed_at":"2022-12-19T16:33:41.000Z","size":16,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-28T19:01:03.126Z","etag":null,"topics":["aws","backend","devops","iac","s3","terraform","terraform-backend","terraform-backend-s3"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jottenlips.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-03T19:09:02.000Z","updated_at":"2023-11-21T22:00:10.000Z","dependencies_parsed_at":"2023-01-29T22:15:29.755Z","dependency_job_id":null,"html_url":"https://github.com/jottenlips/terraform-state-s3-backend-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/jottenlips/terraform-state-s3-backend-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jottenlips%2Fterraform-state-s3-backend-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jottenlips%2Fterraform-state-s3-backend-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jottenlips%2Fterraform-state-s3-backend-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jottenlips%2Fterraform-state-s3-backend-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jottenlips","download_url":"https://codeload.github.com/jottenlips/terraform-state-s3-backend-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jottenlips%2Fterraform-state-s3-backend-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274961747,"owners_count":25381892,"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-09-13T02:00:10.085Z","response_time":70,"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":["aws","backend","devops","iac","s3","terraform","terraform-backend","terraform-backend-s3"],"created_at":"2024-10-14T03:06:52.851Z","updated_at":"2025-09-13T12:37:22.787Z","avatar_url":"https://github.com/jottenlips.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Getting started with Terraform state, using an s3 backend\n\n## Chicken or Egg?\n\nIn order to use terraform to keep track of your infrastructure, you need a terraform backend. A terraform backend on AWS requires a dynamodb table and an s3 bucket. You could spin up these resources in the console or the aws cli, but what if you want these resources under terraform as well? These 3 steps will get your terraform state under terraform.\n\n1. comment out the terraform backend to deploy bucket and dynamodb, deploy\n\n```\nterraform init\nterraform plan\nterraform apply\n```\n\n2. uncomment terraform backend, import dynamodb and s3_bucket that were created, deploy\n\n```\nterraform import aws_dynamodb_table.terraform_state_lock \"tf-lock-table\"\nterraform import aws_s3_bucket.terraform_states \"tf-states-s3backend\"\nterraform plan\nterraform apply\n```\n\nYou now have a terraform backend on s3!\n\n3. Use terraform state in other repos for you aws account\n\n```\nterraform {\n  backend \"s3\" {\n    bucket                  = \"tf-states-s3backend\"\n    key                     = \"environments/develop/network.tfstate\"\n    region                  = \"us-east-1\"\n    encrypt                 = true\n    profile                 = \"default\"\n    dynamodb_table          = \"tf-lock-table\"\n    shared_credentials_file = \"$HOME/.aws/credentials\"\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjottenlips%2Fterraform-state-s3-backend-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjottenlips%2Fterraform-state-s3-backend-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjottenlips%2Fterraform-state-s3-backend-example/lists"}