diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2986ac1..25da1fe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,12 +9,12 @@ repos: - repo: https://github.com/antonbabenko/pre-commit-terraform rev: v1.74.1 hooks: - - id: terraform_fmt - - id: terraform_validate - id: terraform_docs args: - - '--args=--lockfile=false' + - --args=--lockfile=false - --args=--config=.tfdocs-config.yml + - id: terraform_fmt + - id: terraform_validate - id: terraform_tflint args: - '--args=--only=terraform_deprecated_interpolation' diff --git a/.tfdocs-config.yml b/.tfdocs-config.yml index 1752929..37959ce 100644 --- a/.tfdocs-config.yml +++ b/.tfdocs-config.yml @@ -79,7 +79,7 @@ settings: hide-empty: false html: true indent: 3 - lockfile: true + lockfile: false read-comments: true required: true sensitive: true diff --git a/README.md b/README.md index f268093..ed6402f 100644 --- a/README.md +++ b/README.md @@ -259,7 +259,7 @@ locals { | Name | Version | |------|---------| -| [aws](#provider\_aws) | 4.38.0 | +| [aws](#provider\_aws) | >= 4.9, <5 | ---- ### Requirements @@ -267,7 +267,7 @@ locals { | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 0.13.1 | -| [aws](#requirement\_aws) | >= 4.9 | +| [aws](#requirement\_aws) | >= 4.9, <5 | | [http](#requirement\_http) | 3.0.1 | ---- diff --git a/tests/conftest.py b/tests/conftest.py index e97f5d1..85653c9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -42,7 +42,6 @@ def config(config_file) -> dict: return {} else: raise FileNotFoundError(config_file) - return config @pytest.fixture(scope="session") @@ -51,13 +50,6 @@ def terraform_default_variables(request, config): variables = {} for name, value in config.get("variables", {}).items(): variables[name] = value - """value = None - if variable_config.get("parameter", False): - value = request.config.getoption(variable_config["parameter"]) - if variable_config.get("required", False): - if value is None: - raise Exception(f"Variable {variable} must be specified.") - variables[variable] = value""" return variables @@ -148,5 +140,9 @@ def terraform_apply_and_output(test_name, terraform_config, variables=None): try: tf.apply() yield tf.output() + # Shorten the default exception message. + except tftest.TerraformTestError as e: + tf.destroy(**{"auto_approve": True}) + raise tftest.TerraformTestError(e.cmd_error) from e finally: tf.destroy(**{"auto_approve": True}) diff --git a/versions.tf b/versions.tf index 4df33fe..2b1559f 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.9" + version = ">= 4.9, <5" } http = { source = "hashicorp/http"