<1> 반복문 count 매개변수 - 버킷 3개 생성 NICKNAME=masterseo cat < s3.tf provider "aws" { region = "ap-northeast-2" } resource "aws_s3_bucket" "mybucket" { count = 3 bucket = "$NICKNAME.\${count.index}" } EOT terraform init && terraform plan && terraform apply -auto-approve aws_s3_bucket.mybucket[0]: Creation complete after 3s [id=masterseo.0] aws_s3_bucket.mybucket[1]: Creation complete after 4s [id=masterseo.1] aws_s3_bucket.mybucket[2]: Creation complete after 4s [id=masterseo.2] Apply complete! Resources: 3 added, 0 changed, 0 destroyed. [root@ip-172-31-61-209 test]# terraform destroy -auto-approve rm -rf * <2> 반복문 count 매개변수 - 입력 변수로 s3 만들기 버킷 3개 생성 cat < variables.tf variable "bucket_names" { description = "Create s3" type = list(string) default = ["seo111", "tae1112", "ho111"] } EOT cat < s3.tf provider "aws" { region = "ap-northeast-2" } resource "aws_s3_bucket" "mybucket" { count = length(var.bucket_names) bucket = var.bucket_names[count.index] } EOT terraform init && terraform plan && terraform apply -auto-approve aws s3 ls 2022-11-15 07:23:15 ho111 2022-11-15 07:23:15 seo111 2022-11-15 07:23:16 tae111 3 terraform destroy -auto-approve rm -rf * 감사합니다.