1. Sensitive variable란?
- 민감한 변수 값임을 알리고 테라폼의 출력문에서 값 노출을 제한한다.
- 민감한 변수로 지정해도 terraform.tfstate 파일에는 결과물이 평문으로 기록되므로 State 파일의 보안에 유의해야 한다.
2. Sensitive variable 설정 테스트
1) variables.tf에서 resource_group_name 변수에 "sensitive = true" 추가
2) terraform.auto.tfvars에서 resource_group_name의 변수 값은 정의하지 않음
3) terraform apply 명령어 실행 후 변수 값인 "jql-rg" 수동 입력
- Sensitive variable로 구성되어 변수 값 입력 시 화면에 표출되지 않는다.
- 예상 결과 값에서도 확인이 불가능하다.
4) terraform.tfstate 파일 확인
- 단, Sensitive variable를 사용해도 terraform.tfstate 파일에서 변수 값이 확인됨으로 state 파일의 보안에 유의해야 한다.
참고
Protect sensitive input variables | Terraform | HashiCorp Developer
Protect sensitive values from accidental exposure using Terraform sensitive input variables. Provision a web application with Terraform, and mark input variables as sensitive to restrict when Terraform prints them out to the console.
developer.hashicorp.com
'IaC > Terraform' 카테고리의 다른 글
[Terraform] 다중 Provider 구성 (0) | 2023.12.29 |
---|---|
[Terraform] Azure에 Terraform을 인증하는 방법 (0) | 2023.12.28 |
[Terraform] 기본 명령어 및 파일/디렉터리 (1) | 2023.12.28 |