【发布时间】:2022-12-05 15:40:43
【问题描述】:
我想了解如何在 Terraform 中注释掉 VS 代码上的代码。我是编码和亚马逊网络服务领域的新手。我仍在学习使用 Terraform。
【问题讨论】:
我想了解如何在 Terraform 中注释掉 VS 代码上的代码。我是编码和亚马逊网络服务领域的新手。我仍在学习使用 Terraform。
【问题讨论】:
在 Terraform 中注释掉代码的最常见方法是在行的开头添加一个散列:
variable "var_1" {
type = string
default = "value-1"
}
# variable "var_2" {
# type = string
# default = "value-2"
# }
在上面的示例中,Terraform 将创建名为 var_1 的变量,但不会创建名为 var_2 的变量,因为该变量已被注释掉。
【讨论】:
Attaching the Terraform documentation for commenting
Terraform 语言支持三种不同的 cmet 语法:
// also begins a single-line comment, as an alternative to #. /* and */ are start and end delimiters for a comment that might span over multiple lines. The # single-line comment style is the default comment style and should be used in most cases. Automatic configuration formatting tools may automatically transform // cmets into # cmets, since the double-slash style is not idiomatic.
【讨论】: