티스토리 뷰
반응형
2. format
1. String 연결 방법인 format 사용법
- format 유형
foramt은 string 형식의 variable이나 tpye을 연결이 가능하게 합니다.
typing을 하게 되면 가능하지만, 변수를 연결을 하고자 할때 사용을 하면 유용하게 사용이 가능합니다.
예시) main.tf 내용
variable "name" {
description = "input your name"
type = string
default = "sdh"
}
output "format_test" {
value=format("%s-test-%s", "format", var.name)
}
결과를 확인하면 어떻게 나올까요?
결과 확인
$ terraform apply
No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Outputs:
format_test = "format-test-sdh"
설정한 것처럼, 이름이 format되어 확인이 되는걸 확인 할 수 있습니다.
반응형
'IaC > Terraform' 카테고리의 다른 글
[Terraform] 많이 사용 Meta Argument 4편 - max (0) | 2022.10.14 |
---|---|
[Terraform] 많이 사용 Meta Argument 3편 - element (0) | 2022.10.02 |
[Terraform] 많이 사용 Meta Argument 1편 - count (0) | 2022.10.02 |
Alicloud에서 Terraform을 활용하여 3tire 구축하기 (0) | 2021.06.17 |
댓글
반응형
최근에 올라온 글
- Total
- Today
- Yesterday