diff --git a/README.rst b/README.rst
index 5a41018..2f12619 100644
--- a/README.rst
+++ b/README.rst
@@ -60,7 +60,7 @@ Requirements
* An Amazon AWS account to run this all in (note - it will probably be cheap, but not free)
* Python 2.7+ (currently tested with 2.7, 3.3, 3.4, 3.5). Note that AWS Lambda currently only supports python 2.7 as an execution environment, but you're welcome to use other versions on the machine where you run this project.
* Python `VirtualEnv `_ and ``pip`` (recommended installation method; your OS/distribution should have packages for these)
-* `HashiCorp Terraform `_ to manage the AWS infrastructure, if desired. Terraform is written in Go, and `distributed `_ as a static binary.
+* `HashiCorp Terraform `_ >= 0.6.16 to manage the AWS infrastructure, if desired. Terraform is written in Go, and `distributed `_ as a static binary.
Architecture
------------
diff --git a/webhook2lambda2sqs/terraform_runner.py b/webhook2lambda2sqs/terraform_runner.py
index 7cafe71..3dec615 100644
--- a/webhook2lambda2sqs/terraform_runner.py
+++ b/webhook2lambda2sqs/terraform_runner.py
@@ -77,17 +77,19 @@ def _validate(self):
if res is None:
logger.error('Unable to determine terraform version; will not '
'validate config. Note that this may cause problems '
- 'when using older Terraform versions.')
+ 'when using older Terraform versions. This program '
+ 'requires Terraform >= 0.6.16.')
return
self.tf_version = (
int(res.group(1)), int(res.group(2)), int(res.group(3))
)
logger.debug('Terraform version: %s', self.tf_version)
- if self.tf_version < (0, 6, 12):
- logger.warning('Terraform config validation requires terraform '
- '>= 0.6.12, but you are running %s. Config '
- 'validation will not be performed', self.tf_version)
- return
+ if self.tf_version < (0, 6, 16):
+ raise Exception('This program requires Terraform >= 0.6.16, as '
+ 'that version introduces a bug fix for working '
+ 'with api_gateway_integration_response resources; '
+ 'see: https://github.com/hashicorp/terraform/pull'
+ '/5893')
try:
self._run_tf('validate', ['.'])
except:
diff --git a/webhook2lambda2sqs/tests/test_terraform_runner.py b/webhook2lambda2sqs/tests/test_terraform_runner.py
index a957588..92c1d73 100644
--- a/webhook2lambda2sqs/tests/test_terraform_runner.py
+++ b/webhook2lambda2sqs/tests/test_terraform_runner.py
@@ -467,7 +467,8 @@ def se_run(*args, **kwargs):
assert mock_logger.mock_calls == [
call.error('Unable to determine terraform version; will not '
'validate config. Note that this may cause problems '
- 'when using older Terraform versions.')
+ 'when using older Terraform versions. This program '
+ 'requires Terraform >= 0.6.16.')
]
def test_validate_old_version(self):
@@ -482,16 +483,17 @@ def se_run(*args, **kwargs):
with patch('%s._run_tf' % pb, autospec=True) as mock_run:
mock_run.side_effect = se_run
with patch('%s.logger' % pbm) as mock_logger:
- cls = TerraformRunner(self.mock_config(), 'terraform-bin')
+ with pytest.raises(Exception) as excinfo:
+ TerraformRunner(self.mock_config(), 'terraform-bin')
assert mock_logger.mock_calls == [
- call.debug('Terraform version: %s', (0, 6, 3)),
- call.warning('Terraform config validation requires terraform '
- '>= 0.6.12, but you are running %s. Config '
- 'validation will not be performed', (0, 6, 3))
- ]
- assert mock_run.mock_calls == [
- call(cls, 'version')
- ]
+ call.debug('Terraform version: %s', (0, 6, 3))
+ ]
+ assert exc_msg(excinfo.value) == 'This program requires Terraform >= ' \
+ '0.6.16, as that version introduces ' \
+ 'a bug fix for working with api_' \
+ 'gateway_integration_response ' \
+ 'resources; see: https://github.com/' \
+ 'hashicorp/terraform/pull/5893'
def test_validate_fail(self):
def se_run(*args, **kwargs):