{"id":20136063,"url":"https://github.com/zkfmapf123/terraform","last_synced_at":"2026-03-19T14:03:57.828Z","repository":{"id":115888974,"uuid":"603675276","full_name":"zkfmapf123/terraform","owner":"zkfmapf123","description":"practice of terraform","archived":false,"fork":false,"pushed_at":"2023-04-04T04:44:37.000Z","size":486,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-13T09:38:24.556Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/zkfmapf123.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,"publiccode":null,"codemeta":null}},"created_at":"2023-02-19T08:31:55.000Z","updated_at":"2023-02-19T08:33:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"14f02fdc-ca31-4067-8f77-c83ee364260a","html_url":"https://github.com/zkfmapf123/terraform","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zkfmapf123%2Fterraform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zkfmapf123%2Fterraform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zkfmapf123%2Fterraform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zkfmapf123%2Fterraform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zkfmapf123","download_url":"https://codeload.github.com/zkfmapf123/terraform/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241582521,"owners_count":19985846,"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","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":[],"created_at":"2024-11-13T21:17:35.795Z","updated_at":"2026-02-25T12:39:27.209Z","avatar_url":"https://github.com/zkfmapf123.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform\n\n## tf-docker\n\n- deploy docker use terraform\n\n## tf-playground\n\n- use variables use terraform console\n\n```\n    terraform console\n\n    \u003e\u003e var.myVar\n    \u003e\u003e var.myMap[\"name\"]\n    \u003e\u003e var.myList[0]\n    \u003e\u003e slice(var.myList,0,1)\n```\n\n## tf-advance\n\n- vars를 사용한 terraform 구조 정의 (Simple)\n\n- provider\n\n  - provider를 정의\n\n- instance\n\n  - 인스턴스를 정의\n\n- vars.tf\n\n  - \\*.tfvars의 해당하는 변수네이밍\n\n- terraform.tfvars\n\n  - 변수의 값을 저장\n\n  ```\n    // 1. terraform.tfvars\n    AWS_ACCESS_KEY = \"\"\n    AWS_SECRET_KEY = \"\"\n    AWS_REGION = \"ap-northeast-2\"\n\n    // 2. DEV OR PROD 설정\n    terraform apply -var ENV=dev\n\n    // 3. Stored Function\n    basename(\"/home/leedonggyu/file.txt\") \u003e\u003e file.txt 경로의 마지막 요소의 파일이름 반환\n    coalesce(\"\",\"\",\"hello) \u003e\u003e hello 값이 있는것만 반환\n    element(module.vpc.public_subnets, count.index) \u003e\u003e module.vpc.public_subnest[count.index]\n    ... more homepage\n  ```\n\n## tf-vpc\n\n![vpc](./public/vpc.png)\n\n- vpc.tf\n  - Mapping Route Table == Public Subnet\n- nat.tf\n  - Mapping Route Table == Private Subnet\n\n## tf-vpc-ec2\n\n- VPC\n  - vpc.tf\n  - nat.tf\n- EBS\n  - instance.tf\n- EIP\n  - instance.tf\n- RDS\n  - rds.tf\n\n## tf-iam\n\n- set iam use terraform\n\n## tf-elasticBeanstalk\n\n- setting ealsticBeanstalk use terraform\n\n## tf-architecture\n\n- best practice terraform folder architecture\n\n![folder](./public/folder.png)\n\n```\n  modules\n    instance (module로 관리)\n    vpc (module로 관리)\n  dev\n  prod\n\n  ~/dev terraform init\n  ~/prod terraform init\n```\n\n## tf-state\n\n- 상태 조작 예시\n\n```\n  terraform init\n  terraform apply\n```\n\n# In Terraform File\n\n## .terraform.lock.hcl\n\n- 사용중인 공급자와 모듈의 버전을 추적\n- git에 commit 되어야 함 (pacakge.lock.json 과 같은 역할)\n\n```hcl\n  // 공급자 변경\n\n  terraform {\n    required_providers {\n      aws = {\n        version = \"\u003e=3.20.0\"\n      }\n    }\n\n    required_version = \"\u003e=0.14\"\n  }\n```\n\n## Terraform State Command\n\n\u003e terraform state list\n\n- 리소스 나열\n\n\u003e terraform state mv\n\n- 상태의 항목을 이동\n- 이름 수정, 모듈 위치 수정\n\n\u003e terraform state pull\n\n- 전체상태를 표시 (Print.ALL)\n\n\u003e terraform state push\n\n- 상태 재정의\n\n\u003e terraform state replace-provider\n\n- 공급자 대체\n- ex) 0.12 -\u003e 0.13 업그레이드 시\n\n\u003e terraform state rm\n\n- 항목 제거\n\n\u003e terraform state show\n\n- 상태의 있는 항목 나열\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzkfmapf123%2Fterraform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzkfmapf123%2Fterraform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzkfmapf123%2Fterraform/lists"}