Skip to content

Commit fe4fed5

Browse files
committed
Release libterraform 0.14.0
1 parent 8849c52 commit fe4fed5

17 files changed

Lines changed: 147 additions & 21 deletions

docs/en/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ parsing Terraform configuration directories.
2626

2727
| libterraform | Terraform |
2828
|---|---|
29+
| [0.14.0](https://pypi.org/project/libterraform/0.14.0/) | [1.14.9](https://github.com/hashicorp/terraform/tree/v1.14.9) |
2930
| [0.13.0](https://pypi.org/project/libterraform/0.13.0/) | [1.13.5](https://github.com/hashicorp/terraform/tree/v1.13.5) |
3031
| [0.12.0](https://pypi.org/project/libterraform/0.12.0/) | [1.12.2](https://github.com/hashicorp/terraform/tree/v1.12.2) |
3132
| [0.11.0](https://pypi.org/project/libterraform/0.11.0/) | [1.11.4](https://github.com/hashicorp/terraform/tree/v1.11.4) |

docs/en/release-policy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ libterraform minor versions track Terraform minor versions:
66

77
| libterraform line | Terraform line | Branch |
88
|---|---|---|
9+
| `0.14.x` | `1.14.x` | `release/0.14` |
910
| `0.13.x` | `1.13.x` | `release/0.13` |
1011
| `0.12.x` | `1.12.x` | `release/0.12` |
11-
| `0.11.x` | `1.11.x` | `release/0.11` |
1212

1313
The exact version mapping is stored in `release-matrix.json`. The matrix is the source of truth; README tables and release notes are summaries.
1414

docs/zh/api/terraform-command.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ Terraform 运行所需的全部本地数据(这些数据通常不提交到版
152152
| `lockfile` | `str` | 设置 dependency lockfile 模式,目前 Terraform 仅支持 `readonly`| `None` |
153153
| `ignore_remote_version` | `bool` | 仅用于 HCP Terraform 和 remote backend 的少见选项。设置后将忽略本地和远端 Terraform 版本兼容性检查,允许在可能存在 state 表示不匹配时继续操作。 | `None` |
154154
| `test_directory` | `str` | Terraform test 目录,默认为 `"tests"`| `None` |
155+
| `enable_pluggable_state_storage_experiment` | `bool` | 启用 Terraform 的实验性 pluggable state storage 初始化路径。 | `None` |
155156
| `**options` | | 额外命令选项。 | |
156157

157158
::: libterraform.cli.TerraformCommand.validate
@@ -194,6 +195,7 @@ Terraform 运行所需的全部本地数据(这些数据通常不提交到版
194195
| `no_color` | `bool` | 是否禁用颜色输出。 | `True` |
195196
| `no_test` | `bool` | 设置后 Terraform 将不校验测试文件。 | `None` |
196197
| `test_directory` | `str` | 设置 Terraform 测试目录,默认为 `"tests"`| `None` |
198+
| `query` | `bool` | 设置后 Terraform 还会校验 `.tfquery.hcl` 文件。 | `None` |
197199
| `**options` | | 额外命令选项。 | |
198200

199201
::: libterraform.cli.TerraformCommand.plan
@@ -255,9 +257,8 @@ Terraform 运行所需的全部本地数据(这些数据通常不提交到版
255257

256258
参考 <https://developer.hashicorp.com/terraform/cli/commands/query>
257259

258-
执行实验性的 Terraform query 命令,根据 `.tfquery.hcl` 文件查询远端基础设施中
259-
匹配的资源。Terraform 1.13 起提供该命令,但只有启用 Terraform experimental
260-
features 时才会注册到 CLI。
260+
执行 Terraform query 命令,根据 `.tfquery.hcl` 文件查询远端基础设施中
261+
匹配的资源。Terraform 1.13 起实验性提供该命令;Terraform 1.14 起默认注册该命令。
261262

262263
默认以 JSON 格式输出,并按 JSON 行流解析为 Python 列表。传入 `json=False`
263264
可获取原始文本。
@@ -1186,6 +1187,7 @@ Terraform 会在当前配置和测试目录中搜索 `.tftest.hcl` 文件,然
11861187
| `test_directory` | `str` | 设置 Terraform 测试目录,默认为 `"tests"`| `None` |
11871188
| `run_parallelism` | `int` | 限制同一测试文件内可并行执行的 run block 数量,默认 10。 | `None` |
11881189
| `verbose` | `bool` | 在每个测试运行块执行时打印 plan 或 state。 | `None` |
1190+
| `allow_deferral` | `bool` | 允许测试操作使用 deferral。Terraform 仅在实验性构建中接受该选项。 | `None` |
11891191
| `**options` | | 额外命令选项。 | |
11901192

11911193
::: libterraform.cli.TerraformCommand.workspace

docs/zh/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
| libterraform | Terraform |
2727
|---|---|
28+
| [0.14.0](https://pypi.org/project/libterraform/0.14.0/) | [1.14.9](https://github.com/hashicorp/terraform/tree/v1.14.9) |
2829
| [0.13.0](https://pypi.org/project/libterraform/0.13.0/) | [1.13.5](https://github.com/hashicorp/terraform/tree/v1.13.5) |
2930
| [0.12.0](https://pypi.org/project/libterraform/0.12.0/) | [1.12.2](https://github.com/hashicorp/terraform/tree/v1.12.2) |
3031
| [0.11.0](https://pypi.org/project/libterraform/0.11.0/) | [1.11.4](https://github.com/hashicorp/terraform/tree/v1.11.4) |

docs/zh/release-policy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ libterraform 的 minor 版本跟随 Terraform 的 minor 版本:
66

77
| libterraform 版本线 | Terraform 版本线 | 分支 |
88
|---|---|---|
9+
| `0.14.x` | `1.14.x` | `release/0.14` |
910
| `0.13.x` | `1.13.x` | `release/0.13` |
1011
| `0.12.x` | `1.12.x` | `release/0.12` |
11-
| `0.11.x` | `1.11.x` | `release/0.11` |
1212

1313
准确的版本映射存放在 `release-matrix.json`。该矩阵是事实来源;README
1414
表格和 release notes 只是摘要。

native/go/libterraform.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,12 @@ func NewCommands(meta command.Meta) map[string]cli.CommandFactory {
736736
}, nil
737737
},
738738

739+
"query": func() (cli.Command, error) {
740+
return &command.QueryCommand{
741+
Meta: meta,
742+
}, nil
743+
},
744+
739745
"refresh": func() (cli.Command, error) {
740746
return &command.RefreshCommand{
741747
Meta: meta,
@@ -901,8 +907,8 @@ func NewCommands(meta command.Meta) map[string]cli.CommandFactory {
901907
}
902908

903909
if meta.AllowExperimentalFeatures {
904-
commands["query"] = func() (cli.Command, error) {
905-
return &command.QueryCommand{
910+
commands["test cleanup"] = func() (cli.Command, error) {
911+
return &command.TestCleanupCommand{
906912
Meta: meta,
907913
}, nil
908914
}

release-matrix.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"go_plugin_version": "1.6.3",
5656
"branch": "release/0.12",
5757
"status": "released",
58-
"maintenance": "active"
58+
"maintenance": "passive"
5959
},
6060
{
6161
"libterraform_minor": "0.13",
@@ -74,8 +74,8 @@
7474
"terraform_version": "1.14.9",
7575
"go_plugin_version": "1.7.0",
7676
"branch": "release/0.14",
77-
"status": "planned",
78-
"maintenance": "planned"
77+
"status": "released",
78+
"maintenance": "active"
7979
},
8080
{
8181
"libterraform_minor": "0.15",

src/libterraform/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from libterraform.common import WINDOWS
55

6-
__version__ = "0.13.0"
6+
__version__ = "0.14.0"
77

88
root = os.path.dirname(os.path.abspath(__file__))
99
_lib_filename = "libterraform.dll" if WINDOWS else "libterraform.so"

src/libterraform/cli.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ def init(
231231
lockfile: str = None,
232232
ignore_remote_version: bool = None,
233233
test_directory: str = None,
234+
enable_pluggable_state_storage_experiment: bool = None,
234235
**options,
235236
) -> CommandResult:
236237
"""Refer to https://developer.hashicorp.com/terraform/cli/commands/init
@@ -289,6 +290,8 @@ def init(
289290
See the documentation on configuring Terraform with
290291
HCP Terraform or Terraform Enterprise for more information.
291292
:param test_directory: Set the Terraform test directory, defaults to "tests".
293+
:param enable_pluggable_state_storage_experiment: Enable Terraform's
294+
experimental pluggable state storage initialization path.
292295
:param options: More command options.
293296
"""
294297
options.update(
@@ -308,6 +311,9 @@ def init(
308311
lockfile=lockfile,
309312
ignore_remote_version=flag(ignore_remote_version),
310313
test_directory=test_directory,
314+
enable_pluggable_state_storage_experiment=flag(
315+
enable_pluggable_state_storage_experiment
316+
),
311317
)
312318
retcode, stdout, stderr = self.run(
313319
"init", options=options, chdir=self.cwd, check=check
@@ -321,6 +327,7 @@ def validate(
321327
no_color: bool = True,
322328
no_test: bool = None,
323329
test_directory: str = None,
330+
query: bool = None,
324331
**options,
325332
) -> CommandResult:
326333
"""Refer to https://developer.hashicorp.com/terraform/cli/commands/validate
@@ -354,12 +361,14 @@ def validate(
354361
:param no_color: True to output not contain any color.
355362
:param no_test: If specified, Terraform will not validate test files.
356363
:param test_directory: Set the Terraform test directory, defaults to "tests".
364+
:param query: If specified, Terraform will also validate .tfquery.hcl files.
357365
:param options: More command options.
358366
"""
359367
options.update(
360368
no_color=flag(no_color),
361369
no_test=flag(no_test),
362370
test_directory=test_directory,
371+
query=flag(query),
363372
)
364373
retcode, stdout, stderr = self.run(
365374
"validate", options=options, chdir=self.cwd, check=check, json=json
@@ -1792,6 +1801,7 @@ def test(
17921801
test_directory: str = None,
17931802
run_parallelism: int = None,
17941803
verbose: bool = None,
1804+
allow_deferral: bool = None,
17951805
**options,
17961806
):
17971807
"""Refer to https://developer.hashicorp.com/terraform/cli/commands/test
@@ -1829,6 +1839,8 @@ def test(
18291839
in parallel within a file. Defaults to 10.
18301840
:param verbose: Print the plan or state for each test run block as it
18311841
executes.
1842+
:param allow_deferral: Allow deferred actions during test operations.
1843+
Terraform accepts this flag only in experimental builds.
18321844
:param options: More command options.
18331845
"""
18341846
options.update(
@@ -1841,6 +1853,7 @@ def test(
18411853
test_directory=test_directory,
18421854
run_parallelism=run_parallelism,
18431855
verbose=flag(verbose),
1856+
allow_deferral=flag(allow_deferral),
18441857
)
18451858
retcode, stdout, stderr = self.run(
18461859
"test", options=options, chdir=self.cwd, check=check, json=json

tests/cli/test_init.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,39 @@
1+
import inspect
2+
13
from libterraform import TerraformCommand
24
from tests.consts import TF_SLEEP_DIR
35

46

57
class TestTerraformCommandInit:
8+
def test_init_declares_pluggable_state_storage_experiment_option(self):
9+
params = inspect.signature(TerraformCommand.init).parameters
10+
11+
assert "enable_pluggable_state_storage_experiment" in params
12+
13+
def test_init_accepts_pluggable_state_storage_experiment_option(self, monkeypatch):
14+
call = {}
15+
16+
def fake_run(cmd, args=None, options=None, chdir=None, check=False, json=False):
17+
call.update(
18+
cmd=cmd,
19+
args=args,
20+
options=options,
21+
chdir=chdir,
22+
check=check,
23+
json=json,
24+
)
25+
return 0, "", ""
26+
27+
monkeypatch.setattr(TerraformCommand, "run", staticmethod(fake_run))
28+
29+
cli = TerraformCommand("/work")
30+
r = cli.init(enable_pluggable_state_storage_experiment=True)
31+
32+
assert r.retcode == 0
33+
assert call["cmd"] == "init"
34+
assert call["options"]["enable_pluggable_state_storage_experiment"] is ...
35+
assert call["chdir"] == "/work"
36+
637
def test_init(self):
738
r = TerraformCommand(TF_SLEEP_DIR).init()
839
assert r.retcode == 0, r.error

0 commit comments

Comments
 (0)