github.com/terraform-linters/tflint@v0.51.2-0.20240520175844-3750771571b6/docs/user-guide/annotations.md (about) 1 # Annotations 2 3 Annotation comments can disable rules on specific lines: 4 5 ```hcl 6 resource "aws_instance" "foo" { 7 # tflint-ignore: aws_instance_invalid_type 8 instance_type = "t1.2xlarge" 9 } 10 ``` 11 12 Multiple rules can be specified as a comma-separated list: 13 14 ```hcl 15 resource "aws_instance" "foo" { 16 # tflint-ignore: aws_instance_invalid_type, other_rule 17 instance_type = "t1.2xlarge" 18 } 19 ``` 20 21 All rules can be ignored by specifying the `all` keyword: 22 23 ```hcl 24 resource "aws_instance" "foo" { 25 # tflint-ignore: all 26 instance_type = "t1.2xlarge" 27 } 28 ``` 29 30 It's a good idea to add a reason for why a rule is ignored, especially temporarily: 31 32 ```hcl 33 resource "aws_instance" "foo" { 34 # This instance type is new and TFLint doesn't know about it yet 35 # tflint-ignore: aws_instance_invalid_type 36 instance_type = "t10.2xlarge" 37 } 38 ``` 39 40 Or, on the same line: 41 42 ```hcl 43 resource "aws_instance" "foo" { 44 # tflint-ignore: aws_instance_invalid_type # too new for TFLint 45 instance_type = "t10.2xlarge" 46 } 47 ``` 48 49 The `//` comment style is also supported, but Terraform recommends `#`. 50 51 ```hcl 52 resource "aws_instance" "foo" { 53 // tflint-ignore: aws_instance_invalid_type // too new for TFLint 54 instance_type = "t10.2xlarge" 55 } 56 ``` 57 58 To disable an entire file, you can also use the `tflint-ignore-file` annotation: 59 60 ```hcl 61 # tflint-ignore-file: aws_instance_invalid_type 62 63 resource "aws_instance" "foo" { 64 instance_type = "t1.2xlarge" 65 } 66 ``` 67 68 This annotation is valid only at the top of the file. The following cannot be used and will result in an error: 69 70 ```hcl 71 resource "aws_instance" "foo" { 72 # tflint-ignore-file: aws_instance_invalid_type 73 instance_type = "t1.2xlarge" 74 } 75 ``` 76 77 ```hcl 78 resource "aws_instance" "foo" { # tflint-ignore-file: aws_instance_invalid_type 79 instance_type = "t1.2xlarge" 80 } 81 ```