How to comment out Terraform code on VS Code
Asked Answered
G

3

12

I wish to find out how to comment out Terraform code on VS Code. I am new to the world of coding, and AWS. I am still learning to use Terraform.

Glendoraglendower answered 6/10, 2022 at 19:3 Comment(0)
K
20

Attaching the Terraform documentation for commenting

The Terraform language supports three different syntaxes for comments:

# begins a single-line comment, ending at the end of the line.

// 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 // comments into # comments, since the double-slash style is not idiomatic.

Kimono answered 5/12, 2022 at 7:17 Comment(0)
D
1

The most common way to comment out code in Terraform is to add a hash at the start of the lines:

variable "var_1" {
  type    = string
  default = "value-1"
}

# variable "var_2" {
#   type    = string
#   default = "value-2"
# }

In the above example, Terraform will create the variable called var_1, but will not create the variable called var_2 because that variable has been commented out.

You can check out the Terraform Configuration Syntax.

Dodecasyllable answered 7/10, 2022 at 8:35 Comment(0)
D
0

The Terraform language supports three different syntaxes for comments:

  1. hash # begins a single-line comment, ending at the end of the line.
  2. // also begins a single-line comment, as an alternative to #.
  3. /* 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 // comments into # comments, since the double-slash style is not idiomatic.

Doone answered 5/9, 2024 at 21:47 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.