카테고리 없음

인프라 설정시의 multi-line string indicators

phin09 2025. 7. 26. 22:34

 

yaml 파일을 보다보면 아래처럼 | (pipe) 가 들어간 부분이 있습니다.

python의 f-string 처럼 작성 그대로의 multi-line 인식을 지원하는 indicator입니다.

(전략)
    metadata:
      labels:
        app: good-service
      annotations:
        # Critical for Istio/Envoy sidecar lifecycle management
        sidecar.istio.io/holdApplicationUntilProxyStarts: "true"
        proxy.istio.io/config: |
          proxyMetadata:
            EXIT_ON_ZERO_ACTIVE_CONNECTIONS: "true"
(후략)

 

인프라 세팅에 terraform을 사용하는 경우에는 | 대신 EOF(End Of File)를 사용할 수 있습니다.

<<EOF
내용
여러줄
EOF

 

이런 indicator로는 EOT(End of Text)도 있습니다.

terraform 공식문서에서 heredoc string을 설명할 때 나오는 구분자(delimiter word)입니다.

 

참고

https://weblog.plexobject.com/#:~:text=io/holdApplicationUntilProxyStarts%3A%20%22true%22-,proxy.istio.io/config%3A%20%7C,-proxyMetadata%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20EXIT_ON_ZERO_ACTIVE_CONNECTIONS%3A%20%22true

https://medium.com/@sabryelhasanin/what-is-the-difference-between-using-the-pipe-character-and-the-greater-than-character-in-deb5b89434f0

https://yaml-multiline.info/#:~:text=the%20literal%20style%2C%20indicated%20by%20a%20pipe%20(%7C).

https://developer.hashicorp.com/terraform/language/expressions/strings#heredoc-strings