Skip to content

Commit 41a201d

Browse files
committed
docs: fix state identities reference
1 parent c66197c commit 41a201d

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

docs/zh/api/terraform-command.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -797,13 +797,15 @@ mirror 目录将包含 JSON 索引文件,可以与 mirror 的包一起发布
797797
show_docstring_warns: false
798798
show_docstring_examples: false
799799

800-
参考 <https://developer.hashicorp.com/terraform/cli/commands/state/identities>
800+
参考 <https://developer.hashicorp.com/terraform/cli/v1.12.x/commands/state>
801801

802802
以 JSON 形式列出 Terraform state 中资源实例的 identities。
803803

804-
Terraform 1.12 起提供该命令。包装方法始终传入 `-json`,并将 stdout 解析为
805-
Python 对象。地址参数可用于按资源或 module 过滤实例;如果没有给定地址,则
806-
列出所有带有 identity 信息的资源实例。
804+
Terraform 1.12 起提供该命令;HashiCorp Developer 目前没有为
805+
`state identities` 提供独立页面,因此这里链接到 Terraform 1.12 的 state
806+
命令总页。包装方法始终传入 `-json`,并将 stdout 解析为 Python 对象。地址
807+
参数可用于按资源或 module 过滤实例;如果没有给定地址,则列出所有带有
808+
identity 信息的资源实例。
807809

808810
参数:
809811

src/libterraform/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,7 @@ def state_identities(
12691269
identity_id: str = None,
12701270
**options,
12711271
):
1272-
"""Refer to https://developer.hashicorp.com/terraform/cli/commands/state/identities
1272+
"""Refer to https://developer.hashicorp.com/terraform/cli/v1.12.x/commands/state
12731273
12741274
List the identities of resources in the Terraform state in JSON format.
12751275

tests/test_docs_site.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,17 @@ def test_chinese_api_reference_has_method_descriptions_and_parameters():
151151
command_page = read_text("docs/zh/api/terraform-command.md")
152152
config_page = read_text("docs/zh/api/terraform-config.md")
153153
exceptions_page = read_text("docs/zh/api/exceptions.md")
154+
cli_source = read_text("src/libterraform/cli.py")
155+
bad_state_identities_link = "/".join(
156+
["https://developer.hashicorp.com/terraform/cli/commands/state", "identities"]
157+
)
154158

155159
for method in public_methods("src/libterraform/cli.py", "TerraformCommand"):
156160
assert f"::: libterraform.cli.TerraformCommand.{method}" in command_page
157161

162+
assert bad_state_identities_link not in command_page
163+
assert bad_state_identities_link not in cli_source
164+
158165
for phrase in [
159166
"#### 通用参数",
160167
"`check`",

0 commit comments

Comments
 (0)