terraform workspace new 명령

terraform workspace new 명령

terraform workspace new 명령은 새 워크스페이스를 만드는 데 사용하는 명령이에요.

출처: 문서

본문

사용법 (Usage)

사용법: terraform workspace new [OPTIONS] NAME

이 명령은 주어진 이름의 새 워크스페이스를 생성해요. 이 이름의 워크스페이스는 이미 존재하면 안 돼요.

-state 플래그가 주어지면, 주어진 경로로 지정된 상태가 복사되어 이 새 워크스페이스의 상태를 초기화해요.

커맨드 라인 플래그는 모두 선택적이에요. 지원되는 플래그는 다음과 같아요:

  • -lock=false - 작업 중에 상태 락을 보유하지 않아요. 다른 사람들이 같은 워크스페이스에 대해 동시에 명령을 실행할 수 있다면 위험해요.
  • -lock-timeout=DURATION - 상태 락을 재시도할 기간이에요. 기본값은 0s예요.
  • -state=path - 이 환경의 상태를 초기화할 기존 상태 파일의 경로예요.

예제: 생성 (Example: Create)

$ terraform workspace new example
Created and switched to workspace "example"!
 
You're now on a new, empty workspace. Workspaces isolate their state,
so if you run "terraform plan" Terraform will not see any existing state
for this configuration.

예제: 상태에서 생성 (Example: Create from State)

기존 로컬 상태 파일에서 새 워크스페이스를 만들려면:

$ terraform workspace new -state=old.terraform.tfstate example
Created and switched to workspace "example".
 
You're now on a new, empty workspace. Workspaces isolate their state,
so if you run "terraform plan" Terraform will not see any existing state
for this configuration.

더 알아보기 (Learn more)