DevOps/Terraform2022. 4. 25. 18:21[Terraform] 데이터 소스 (Data Source)

✔️ 데이터 소스 (Data Source) Terraform Registry registry.terraform.io 이미지의 버전 변경으로 인해 사용할 이미지를 교체하고 싶을 때는 이미지의 id를 변경해야 한다. 개발 환경 중 특히 test 환경에서는 최신 버전의 이미지로 자주 변경하기 때문에 매번 id를 바꾸는 것은 번거로운 일이다. 이때 데이터 소스를 사용하는데, 데이터 소스는 해당되는 프로바이더에서 정보를 가져오는 역할을 한다. data "aws_ami" "example" { executable_users = ["self"] most_recent = true name_regex = "^myami-\\d{3}" owners = ["self"] filter { name = "name" values = ..

DevOps/Terraform2022. 4. 25. 17:55[Terraform] Count

✔️ Count The count Meta-Argument - Configuration Language | Terraform by HashiCorp Count helps you efficiently manage nearly identical infrastructure resources without writing a separate block for each one. www.terraform.io count는 meta argument이다. resource "aws_instance" "server" { count = 4 # create four similar EC2 instances ami = "ami-a1b2c3d4" instance_type = "t2.micro" tags = { Name = "Serv..

image