수정 및 추가

This commit is contained in:
ByeonJungHun
2024-11-28 17:16:46 +09:00
parent 5186b2b0fe
commit 2edcf77bda
7 changed files with 474 additions and 8 deletions

View File

@@ -2,8 +2,8 @@
![Static Badge](https://img.shields.io/badge/Terraform-341e4a?logo=terraform) ![Static Badge](https://img.shields.io/badge/AWS%20CLI-232F3E?logo=amazonwebservices)
## 준비 사항
- [ ] Terraform 설치 [<spen style="color:yellow">[문서 이동]</spen>](https://developer.hashicorp.com/terraform/install)
- [ ] AWS CLI 설치 [<spen style="color:yellow">[문서 이동]</spen>](https://docs.aws.amazon.com/ko_kr/cli/latest/userguide/getting-started-install.html)
- [ ] Terraform 설치 [[문서 이동]](https://developer.hashicorp.com/terraform/install)
- [ ] AWS CLI 설치 [[문서 이동]](https://docs.aws.amazon.com/ko_kr/cli/latest/userguide/getting-started-install.html)
- [ ] aws에서 `Access key``Secret access key` 생성
## AWS CLI 설정
@@ -31,4 +31,56 @@ tf 파일 작성 같은 경우 유지보수의 용이를 위하여 종류 별
|route.tf|route table 정의|
|server.tf|EC2 정의|
> 추가 예정
> 추가 예정
## Terraform 실행
1. 디렉토리 초기화 및 프로바이더 플러그인 설치
```shell
terraform init
Initializing the backend...
Initializing provider plugins...
- Finding hashicorp/aws versions matching "5.78.0"...
- Installing hashicorp/aws v5.78.0...
- Installed hashicorp/aws v5.78.0 (signed by HashiCorp)
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
```
2. 현 상태와 변경 사항 확인
```shell
terraform plan
No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
# 변경 사항이 없어 위와 같이 표기
# 변경이 된 사항이 있을 경우 출력
```
3. 리소스 생성
```shell
terraform apply
```
4. 리소스 삭제
```shell
terraform destroy
```
> 추가 예정