{"id":19156390,"url":"https://github.com/kyegomez/terraform-cheatsheet","last_synced_at":"2026-04-18T00:07:54.869Z","repository":{"id":225530537,"uuid":"766222448","full_name":"kyegomez/terraform-cheatsheet","owner":"kyegomez","description":"A simple cheat sheet for terraform commands.","archived":false,"fork":false,"pushed_at":"2024-03-02T17:08:19.000Z","size":3,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-22T21:42:10.596Z","etag":null,"topics":["aws","azure","cloud","developer-tools","devops","devops-tools","google-cloud","hashicorp","terraform"],"latest_commit_sha":null,"homepage":"https://discord.gg/GYbXvDGevY","language":null,"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/kyegomez.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-03-02T17:08:00.000Z","updated_at":"2024-05-21T20:19:46.000Z","dependencies_parsed_at":"2024-03-02T18:25:25.203Z","dependency_job_id":"18c8a7c9-d31d-4b0e-8033-d02f8766d682","html_url":"https://github.com/kyegomez/terraform-cheatsheet","commit_stats":null,"previous_names":["kyegomez/terraform-cheatsheet"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kyegomez/terraform-cheatsheet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyegomez%2Fterraform-cheatsheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyegomez%2Fterraform-cheatsheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyegomez%2Fterraform-cheatsheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyegomez%2Fterraform-cheatsheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kyegomez","download_url":"https://codeload.github.com/kyegomez/terraform-cheatsheet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyegomez%2Fterraform-cheatsheet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31950895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T17:29:20.459Z","status":"ssl_error","status_checked_at":"2026-04-17T17:28:47.801Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","azure","cloud","developer-tools","devops","devops-tools","google-cloud","hashicorp","terraform"],"created_at":"2024-11-09T08:34:18.741Z","updated_at":"2026-04-18T00:07:54.834Z","avatar_url":"https://github.com/kyegomez.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform Cheat Sheet\n\nTerraform is an Infrastructure as Code (IaC) tool used for building, changing, and versioning infrastructure safely and efficiently. This cheat sheet provides a quick reference to common Terraform commands and configurations.\n\n## Table of Contents\n\n1. [Terraform Basics](#terraform-basics)\n2. [Terraform Commands](#terraform-commands)\n3. [File Structure](#file-structure)\n4. [Resource Configuration](#resource-configuration)\n5. [Variables](#variables)\n6. [Outputs](#outputs)\n7. [Modules](#modules)\n8. [Backend Configuration](#backend-configuration)\n9. [Providers](#providers)\n\n## Terraform Basics\n\n- **Infrastructure as Code (IaC):** Terraform allows you to define your infrastructure using a high-level configuration language.\n- **Execution Plan:** Terraform generates an execution plan. This shows what Terraform will do when you call `terraform apply`.\n- **Resource Management:** Terraform allows for the creation, modification, and destruction of infrastructure resources.\n\n## Terraform Commands\n\n- `terraform init` - Initialize a Terraform working directory.\n- `terraform plan` - Generate and show an execution plan.\n- `terraform apply` - Apply the changes required to reach the desired state of the configuration.\n- `terraform destroy` - Destroy the Terraform-managed infrastructure.\n- `terraform validate` - Validates the Terraform files for syntax.\n- `terraform fmt` - Rewrites Terraform configuration files to a canonical format and style.\n\n## File Structure\n\n- `main.tf` - The primary entry point for Terraform configuration.\n- `variables.tf` - Defines variables used within the configuration.\n- `outputs.tf` - Defines output values that can be useful for understanding the resources created.\n- `provider.tf` - Specifies and configures the providers Terraform will use.\n\n## Resource Configuration\n\n```hcl\nresource \"aws_instance\" \"example\" {\n  ami           = \"ami-abc123\"\n  instance_type = \"t2.micro\"\n}\n```\n\n- Define a resource with `resource` followed by the resource type and a name.\n- Inside the block, configure the resource with required and optional arguments.\n\n## Variables\n\n```hcl\nvariable \"instance_type\" {\n  description = \"The instance type of the EC2 instance\"\n  type        = string\n  default     = \"t2.micro\"\n}\n```\n\n- Declare variables in `variables.tf` and reference them using `var.\u003cvariable_name\u003e`.\n\n## Outputs\n\n```hcl\noutput \"instance_ip_addr\" {\n  value = aws_instance.example.public_ip\n}\n```\n\n- Outputs allow you to extract information about your resources, which can be displayed after `terraform apply` or accessed by other configurations.\n\n## Modules\n\n- Modules allow you to create reusable components.\n\n```hcl\nmodule \"vpc\" {\n  source = \"./modules/vpc\"\n  cidr_block = \"10.0.0.0/16\"\n}\n```\n\n- Use modules by specifying a `source` path and any required inputs.\n\n## Backend Configuration\n\n- Backends determine how Terraform loads and stores state.\n\n```hcl\nterraform {\n  backend \"s3\" {\n    bucket = \"my-terraform-state\"\n    key    = \"global/s3/terraform.tfstate\"\n    region = \"us-east-1\"\n  }\n}\n```\n\n## Providers\n\n- Providers are plugins Terraform uses to manage resources.\n\n```hcl\nprovider \"aws\" {\n  region = \"us-east-1\"\n}\n```\n\n- Specify providers and their configurations within your Terraform configurations.\n\n---\n\nThis cheat sheet covers the fundamental aspects and commands of Terraform. For more detailed information, refer to the [Terraform Documentation](https://www.terraform.io/docs).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyegomez%2Fterraform-cheatsheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkyegomez%2Fterraform-cheatsheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyegomez%2Fterraform-cheatsheet/lists"}