왜 Remote State인가
로컬 상태 파일은 팀 협업과 CI/CD에서 문제를 일으킵니다. S3 + DynamoDB로 안전한 Remote State를 구성합니다.
S3 Backend 설정
terraform {
backend "s3" {
bucket = "my-terraform-state"
key = "prod/terraform.tfstate"
region = "ap-northeast-2"
dynamodb_table = "terraform-lock"
encrypt = true
}
}워크스페이스
terraform workspace new staging
terraform workspace select production
# 같은 코드로 여러 환경 관리
댓글 0