Skip to content

Instantly share code, notes, and snippets.

@mehd-io
Created May 24, 2022 18:24
Show Gist options
  • Save mehd-io/7f40f589b19581cf64f3fa655e7eadb5 to your computer and use it in GitHub Desktop.
Save mehd-io/7f40f589b19581cf64f3fa655e7eadb5 to your computer and use it in GitHub Desktop.
medium-tftest-infra
import pytest
import tftest
from pathlib import Path
@pytest.fixture
def plan():
file_path = Path(__file__).resolve()
base_dir = file_path.parent.parent.parent.absolute()
tf = tftest.TerraformTest(tfdir="terraform", basedir=base_dir)
tf.setup()
return tf.plan(output=True)
def test_outputs(plan):
"""Simple test of the output vars after a terraform plan cmd
"""
assert plan.outputs['cloud_run_api_image_name'] == f"{plan.variables['prefix']}-cloudrun-api"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment