resource "aws_lb" "test" {
name = "test-lb-tf"
internal = false
load_balancer_type = "application"
security_groups = [aws_security_group.lb_sg.id]
subnets = [for subnet in aws_subnet.public : subnet.id]
enable_deletion_protection = true
access_logs {
bucket = aws_s3_bucket.lb_logs.bucket
prefix = "test-lb"
enabled = true
}
tags = {
Environment = "production"
}
}
- 기본 틀
- 붙여 넣는다.
resource "aws_security_group" "allow_tls" {
name = "allow_tls"
description = "Allow TLS inbound traffic"
vpc_id = aws_vpc.main.id
ingress {
description = "TLS from VPC"
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = [aws_vpc.main.cidr_block]
ipv6_cidr_blocks = [aws_vpc.main.ipv6_cidr_block]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
ipv6_cidr_blocks = ["::/0"]
}
tags = {
Name = "allow_tls"
}
}
- 보안 그룹에 대한 기본 정의다.
728x90
'Cloud > Terraform' 카테고리의 다른 글
Terraform - Target Group 추가 (1. instance / 2. IP Address (0) | 2022.07.07 |
---|---|
Terraform - Subnet 적용(1. 직접 입력 / 2. Variable 블록 / 3. Data Source 블록) (0) | 2022.07.07 |
Terraform - Subnet, Availability zone 및 User Data 적용 (0) | 2022.06.23 |
Terraform - Security Group 생성 및 적용 (0) | 2022.06.23 |
Terraform - Key Pair 적용 및 EBS 볼륨 늘리기 (0) | 2022.06.23 |