【发布时间】:2021-03-18 06:48:03
【问题描述】:
我不确定此处的 Terraform 端口转发命名法。如果我在专用网络的 5000 端口上有一个应用程序,我想在 8000 端口上向公众公开 - 我应该设置哪些变量?
会不会是从私网的角度?
from_port: 5000
to_port: 8000
还是公网视角?
from_port: 8000
to_port: 5000
如果我的内部应用程序需要响应数据,我是否还需要设置出口值?
示例来自:intro to terraform
resource "aws_security_group" "elb" {
name = "terraform-example-elb"
# Allow all outbound
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
# Inbound HTTP from anywhere
ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
【问题讨论】:
-
你有完整的例子吗?入口/出口规则是什么? AWS 安全组?
-
您好 - 我在原始问题中添加了一个示例。它来自流行的博客文章“Terraform 简介”,这是我的问题的来源。由于该示例对 from_port 和 to_port 使用相同的端口号 - 我无法理解哪个端口是哪个 [
标签: terraform