공식문서
https://learn.hashicorp.com/tutorials/terraform/cloud-sign-up
What is Terraform Cloud - Intro and Sign Up | Terraform - HashiCorp Learn
Sign up for Terraform Cloud, which provides free remote state storage, a stable run environment, version control system (VCS) driven plans and applies, a collaborative web GUI, and more. Create your first organization.
learn.hashicorp.com
Workflow
1. git hub에서 본 레포지토리 pork
https://github.com/bajutae/tfc-guide-example
GitHub - bajutae/tfc-guide-example: Example Terraform configuration
Example Terraform configuration. Contribute to bajutae/tfc-guide-example development by creating an account on GitHub.
github.com
위 레포지토리에는 region이 variables.tf에 "us-west-1"으로 작성되어있기 때문에 terrafrom apply 됐을 시 캘리포니아에 생성 된다. 난 서울 region에 만들고 싶었기 때문에 "ap-northeast-2"로 바꿔줬다.
Terraform by HashiCorp
Terraform is an open-source infrastructure as code software tool that enables you to safely and predictably create, change, and improve infrastructure.
www.terraform.io
- (1) 계정 생성 -> new work space
- (2) Choose Type
: git repository를 통해 terraform을 관리할 것이므로 Version control workflow를 선택
(사실 맞는지 모르겠는데 설명 보면 맞는거 같다 ..)
1. Version control workflow - git으로 적용할 때 경우
2. CLI-driven workflow - local에서 바로 적용할 때
3. Ai-driven workflow - api(?)로 적용할 때
-(3) Connect to vcs
: Github 선택 (git lab 또는 다른 vcs를 사용한다면 맞는 것 선택)
-(4) Choose a Repository
: 맞는 reposirtory 선택
-(5) Configure setting
: work space name 작성 후 create workspace
3. 생성한 Work Space에 들어가 Variables 설정
: aws의 key를 통해 terraform과 연결해주는 과정이다.
(1) aws에서 key를 발급받는다
(2) Workspace variables에서 Add variable 클릭
(3) Environment variable 선택
-(1) key값에 AWS_ACCESS_KEY_ID 입력, value에 발급받은 access key갑 입력
-(2) key 값에 AWS_SECRET_ACCESS_KEY 입력, value에 발급받은 secret key값 입력
(4) Terraform variable 선택
-(1) key에 tag_user_name, value에 aws 계정 이름 작성 (e-mail 형식 아이디 아니고 이름!)
-(2) key에 db_read_capacity, value에 2 입력 (읽기 용량 모드)
-(3) key에 db_write_capacity, value에 1 입력 (쓰기 용량 모드)
4. 해당 work space 홈으로 돌아와 Action에서 start new run
plan(제대로 작동 되는지 확인)만 하고 싶을 경우 - Plan only
plan 뒤 적용 하고 싶을 경우 - Plan and apply
5. 성공적으로 Apply됐다면 aws의 DynamoDB의 테이블에 정상적으로 생성 된 걸 확인 할 수 있다.
[VScode] local에서 Terraform vpc 생성 (0) | 2022.07.28 |
---|---|
Terraform이란 (0) | 2022.07.28 |
댓글 영역