From 472a290a59edcd6f348fd7e37e00b1124e542e46 Mon Sep 17 00:00:00 2001 From: Kazuma Watanabe Date: Sun, 18 Feb 2024 07:54:56 +0000 Subject: [PATCH] Revise rules documentation --- docs/rules/README.md | 2 +- docs/rules/terraform_comment_syntax.md | 2 +- docs/rules/terraform_deprecated_index.md | 2 +- docs/rules/terraform_deprecated_interpolation.md | 2 +- docs/rules/terraform_documented_outputs.md | 2 +- docs/rules/terraform_documented_variables.md | 2 +- docs/rules/terraform_module_version.md | 8 ++++---- docs/rules/terraform_naming_convention.md | 4 ++-- docs/rules/terraform_required_providers.md | 2 +- docs/rules/terraform_standard_module_structure.md | 4 ++-- docs/rules/terraform_typed_variables.md | 2 +- docs/rules/terraform_unused_required_providers.md | 2 ++ docs/rules/terraform_workspace_remote.md | 2 +- 13 files changed, 19 insertions(+), 17 deletions(-) diff --git a/docs/rules/README.md b/docs/rules/README.md index e885534..8480da7 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -22,4 +22,4 @@ All rules are enabled by default, but by setting `preset = "recommended"`, you c |[terraform_typed_variables](terraform_typed_variables.md)|Disallow `variable` declarations without type|✔| |[terraform_unused_declarations](terraform_unused_declarations.md)|Disallow variables, data sources, and locals that are declared but never used|✔| |[terraform_unused_required_providers](terraform_unused_required_providers.md)|Check that all `required_providers` are used in the module|| -|[terraform_workspace_remote](terraform_workspace_remote.md)|`terraform.workspace` should not be used with a "remote" backend with remote execution|✔| +|[terraform_workspace_remote](terraform_workspace_remote.md)|`terraform.workspace` should not be used with a "remote" backend with remote execution in Terraform v1.0.x|✔| diff --git a/docs/rules/terraform_comment_syntax.md b/docs/rules/terraform_comment_syntax.md index f7f3f13..78a6fea 100644 --- a/docs/rules/terraform_comment_syntax.md +++ b/docs/rules/terraform_comment_syntax.md @@ -25,7 +25,7 @@ Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0 The Terraform language supports two different syntaxes for single-line comments: `#` and `//`. However, `#` is the default comment style and should be used in most cases. -* [Configuration Syntax: Comments](https://www.terraform.io/docs/configuration/syntax.html#comments) +* [Configuration Syntax: Comments](https://developer.hashicorp.com/terraform/language/syntax/configuration#comments) ## How To Fix diff --git a/docs/rules/terraform_deprecated_index.md b/docs/rules/terraform_deprecated_index.md index fda5640..dc7efb7 100644 --- a/docs/rules/terraform_deprecated_index.md +++ b/docs/rules/terraform_deprecated_index.md @@ -46,7 +46,7 @@ Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0 ## Why -Terraform v0.12 supports traditional square brackets for accessing list items by index or using the splat operator (`*`). However, for backward compatibility with v0.11, Terraform continues to support accessing list items with the dot syntax normally used for attributes. While Terraform does not print warnings for this syntax, it is no longer documented and its use is discouraged. +Terraform supports traditional square brackets for accessing list items by index or using the splat operator (`*`). However, for backward compatibility, Terraform continues to support accessing list items with the dot syntax normally used for attributes. While Terraform does not print warnings for this syntax, it is no longer documented and its use is discouraged. * [Legacy Splat Expressions](https://developer.hashicorp.com/terraform/language/expressions/splat#legacy-attribute-only-splat-expressions) diff --git a/docs/rules/terraform_deprecated_interpolation.md b/docs/rules/terraform_deprecated_interpolation.md index 1657dc2..b4dd447 100644 --- a/docs/rules/terraform_deprecated_interpolation.md +++ b/docs/rules/terraform_deprecated_interpolation.md @@ -33,7 +33,7 @@ Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0 Terraform v0.12 introduces a new interpolation syntax, but continues to support the old 0.11-style interpolation syntax for compatibility. -Terraform will currently print diagnostic warnings when deprecated interpolations are used. Consistent with its deprecation policy, they will raise errors in the next major release (v0.13). TFLint emits an issue instead of a warning with the same logic. +`terraform fmt` can replace this redundant interpolation, so although it is not deprecated in the latest Terraform version, this rule allows you to issue a warning similar to Terraform v0.12.14. ## How To Fix diff --git a/docs/rules/terraform_documented_outputs.md b/docs/rules/terraform_documented_outputs.md index 26e06b6..915f7b2 100644 --- a/docs/rules/terraform_documented_outputs.md +++ b/docs/rules/terraform_documented_outputs.md @@ -42,7 +42,7 @@ Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0 ## Why -Since `description` is optional value, it is not always necessary to write it. But this rule is useful if you want to force the writing of description. Especially it is useful when combined with [terraform-docs](https://github.com/segmentio/terraform-docs). +Since `description` is optional value, it is not always necessary to write it. But this rule is useful if you want to force the writing of description. Especially it is useful when combined with [terraform-docs](https://github.com/terraform-docs/terraform-docs). ## How To Fix diff --git a/docs/rules/terraform_documented_variables.md b/docs/rules/terraform_documented_variables.md index d535322..e14de31 100644 --- a/docs/rules/terraform_documented_variables.md +++ b/docs/rules/terraform_documented_variables.md @@ -42,7 +42,7 @@ Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0 ## Why -Since `description` is optional value, it is not always necessary to write it. But this rule is useful if you want to force the writing of description. Especially it is useful when combined with [terraform-docs](https://github.com/segmentio/terraform-docs). +Since `description` is optional value, it is not always necessary to write it. But this rule is useful if you want to force the writing of description. Especially it is useful when combined with [terraform-docs](https://github.com/terraform-docs/terraform-docs). ## How To Fix diff --git a/docs/rules/terraform_module_version.md b/docs/rules/terraform_module_version.md index ff6c332..73e366a 100644 --- a/docs/rules/terraform_module_version.md +++ b/docs/rules/terraform_module_version.md @@ -1,6 +1,6 @@ # terraform_module_version -Ensure that all modules sourced from a [Terraform Registry](https://www.terraform.io/docs/language/modules/sources.html#terraform-registry) specify a `version`. +Ensure that all modules sourced from a [Terraform Registry](https://developer.hashicorp.com/terraform/language/modules/sources#terraform-registry) specify a `version`. > This rule is enabled by "recommended" preset. @@ -82,7 +82,7 @@ Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/v0.1.0/ ## Why -Terraform's [module version documentation](https://www.terraform.io/docs/language/modules/syntax.html#version) states: +Terraform's [module version documentation](https://developer.hashicorp.com/terraform/language/modules/syntax#version) states: > When using modules installed from a module registry, we recommend explicitly constraining the acceptable version numbers to avoid unexpected or unwanted changes. @@ -90,9 +90,9 @@ When no `version` is specified, Terraform will download the latest version avail ### Exact Versions -Depending on your workflow, you may want to enforce that modules specify an _exact_ version by settings `exact = true` for this rule. This will disallow any module that includes multiple comma-separated version constraints, or any [constraint operator](https://www.terraform.io/docs/language/expressions/version-constraints.html#version-constraint-syntax) other than `=`. Exact versions are often used with automated dependency managers like [Dependabot](https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates) and [Renovate](https://docs.renovatebot.com), which will automatically propose a pull request to update the module when a new version is released. +Depending on your workflow, you may want to enforce that modules specify an _exact_ version by settings `exact = true` for this rule. This will disallow any module that includes multiple comma-separated version constraints, or any [constraint operator](https://developer.hashicorp.com/terraform/language/expressions/version-constraints#version-constraint-syntax) other than `=`. Exact versions are often used with automated dependency managers like [Dependabot](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/about-dependabot-version-updates) and [Renovate](https://docs.renovatebot.com), which will automatically propose a pull request to update the module when a new version is released. -Keep in mind that the module may include further child modules, which have their own version constraints. TFLint _does not_ check version constraints set in child modules. **Enabling this rule cannot guarantee that `terraform init` will be deterministic**. Use [Terraform dependency lock files](https://www.terraform.io/docs/language/dependency-lock.html) to ensure that Terraform will always use the same version of all modules (and providers) until you explicitly update them. +Keep in mind that the module may include further child modules, which have their own version constraints. TFLint _does not_ check version constraints set in child modules. **Enabling this rule cannot guarantee that `terraform init` will be deterministic**. Use [Terraform dependency lock files](https://developer.hashicorp.com/terraform/language/files/dependency-lock) to ensure that Terraform will always use the same version of all modules (and providers) until you explicitly update them. ## How To Fix diff --git a/docs/rules/terraform_naming_convention.md b/docs/rules/terraform_naming_convention.md index 979f406..671c0e0 100644 --- a/docs/rules/terraform_naming_convention.md +++ b/docs/rules/terraform_naming_convention.md @@ -279,8 +279,8 @@ Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0 ## Why -Naming conventions are optional, so it is not necessary to follow this. -But this rule is useful if you want to force the following naming conventions in line with the [Terraform Plugin Naming Best Practices](https://www.terraform.io/docs/extend/best-practices/naming.html). +Naming conventions are optional, so you don't necessarily have to follow them. +However, if your team owns Terraform configurations, it can be helpful to have a consistent naming convention. ## How To Fix diff --git a/docs/rules/terraform_required_providers.md b/docs/rules/terraform_required_providers.md index fc33769..8dfa25e 100644 --- a/docs/rules/terraform_required_providers.md +++ b/docs/rules/terraform_required_providers.md @@ -136,6 +136,6 @@ terraform { } ``` -Provider version constraints can be specified using a [version argument within a provider block](https://www.terraform.io/docs/configuration/providers.html#provider-versions) for backwards compatibility. This approach is now discouraged, particularly for child modules. +Provider version constraints can be specified using a [version argument within a provider block](https://developer.hashicorp.com/terraform/language/providers/configuration#provider-versions) for backwards compatibility. This approach is now discouraged, particularly for child modules. Optionally, you can disable enforcement of either `source` or `version` by setting the corresponding attribute in the rule configuration to `false`. diff --git a/docs/rules/terraform_standard_module_structure.md b/docs/rules/terraform_standard_module_structure.md index b67b412..ff24a21 100644 --- a/docs/rules/terraform_standard_module_structure.md +++ b/docs/rules/terraform_standard_module_structure.md @@ -1,6 +1,6 @@ # terraform_standard_module_structure -Ensure that a module complies with the Terraform [Standard Module Structure](https://www.terraform.io/docs/modules/index.html#standard-module-structure) +Ensure that a module complies with the Terraform [Standard Module Structure](https://developer.hashicorp.com/terraform/language/modules/develop/structure) ## Example @@ -23,7 +23,7 @@ Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0 ## Why -Terraform's documentation outlines a [Standard Module Structure](https://www.terraform.io/docs/modules/structure.html). A minimal module should have a `main.tf`, `variables.tf`, and `outputs.tf` file. Variable and output blocks should be included in the corresponding file. +Terraform's documentation outlines a [Standard Module Structure](https://developer.hashicorp.com/terraform/language/modules/develop/structure). A minimal module should have a `main.tf`, `variables.tf`, and `outputs.tf` file. Variable and output blocks should be included in the corresponding file. ## How To Fix diff --git a/docs/rules/terraform_typed_variables.md b/docs/rules/terraform_typed_variables.md index 95bed83..c0c231f 100644 --- a/docs/rules/terraform_typed_variables.md +++ b/docs/rules/terraform_typed_variables.md @@ -36,4 +36,4 @@ Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0 Since `type` is optional value, it is not always necessary to declare it. But this rule is useful if you want to force declaration of a type. ## How To Fix -Add a type to the variable. See https://www.terraform.io/docs/configuration/variables.html#type-constraints for more details about types +Add a type to the variable. See https://developer.hashicorp.com/terraform/language/values/variables#type-constraints for more details about types diff --git a/docs/rules/terraform_unused_required_providers.md b/docs/rules/terraform_unused_required_providers.md index 8a53003..56953ab 100644 --- a/docs/rules/terraform_unused_required_providers.md +++ b/docs/rules/terraform_unused_required_providers.md @@ -2,6 +2,8 @@ Check that all `required_providers` are used in the module. +Note: Because TFLint cannot traverse the complete module tree, it may issue warnings for `required_providers` declared to specify constraints on the provider versions used by a module. If this false positive is unacceptable, you can disable the rule. See also https://github.com/terraform-linters/tflint-ruleset-terraform/issues/21. + ## Configuration ```hcl diff --git a/docs/rules/terraform_workspace_remote.md b/docs/rules/terraform_workspace_remote.md index 9638026..f4b2c92 100644 --- a/docs/rules/terraform_workspace_remote.md +++ b/docs/rules/terraform_workspace_remote.md @@ -2,7 +2,7 @@ `terraform.workspace` should not be used with a "remote" backend with remote execution in Terraform v1.0.x. -If remote operations are [disabled](https://www.terraform.io/docs/cloud/run/index.html#disabling-remote-operations) for your workspace, you can safely disable this rule: +If remote operations are [disabled](https://developer.hashicorp.com/terraform/cloud-docs/run/remote-operations#disabling-remote-operations) for your workspace, you can safely disable this rule: ```hcl rule "terraform_workspace_remote" {