aws_secretsmanager_raw 함수

aws_secretsmanager_raw 함수 (aws_secretsmanager_raw function)

aws_secretsmanager_raw 함수는 Amazon Web Services (AWS) Secrets Manager에서 시크릿(secret)의 원시(raw) 값을 가져와요. 시크릿의 특정 키 하나가 아니라 전체 값을 통째로 필요할 때 사용해요.

출처: Packer 공식 문서

본문

aws_secretsmanager_raw 함수는 Amazon Web Services (AWS) Secrets Manager에서 시크릿의 원시 값을 검색해요.

aws_secretsmanager_raw(NAME)

이 함수는 일반 텍스트(plaintext) 시크릿을 문자열로 반환해요. 키-값(key-value) 시크릿의 경우 원시 JSON 값을 반환해요. 하나의 키가 아니라 완전한 시크릿 값이 필요할 때 이 함수를 사용해요.

Example (예시)

locals {
  database_credentials = jsondecode(
    aws_secretsmanager_raw("production/database")
  )
}

이 함수를 사용하려면 다음 방법 중 하나로 유효한 AWS 자격 증명(credentials)을 구성해야 해요.

  • Environment Variables (환경 변수)
  • CLI Configuration Files (CLI 설정 파일)
  • Container Credentials (컨테이너 자격 증명)
  • Instance Profile Credentials (인스턴스 프로필 자격 증명)
  • aws_secretsmanager 함수는 키-값 시크릿에서 하나의 키를 가져와요.
  • jsondecode 함수는 원시 JSON 값을 객체로 변환해요.

더 알아보기 (Learn more)