Skip to main content

generate terraform resources to use with pytest

Project description

pytest-terraform-fixture
================

🚀 Description
-----------

`--terraform-dir` で指定したディレクトリにある Terraform で作成されるリソースを動的に pytest の fixture として自動で定義してくれる pluginです

🚀 Install
-------

github から引っ張ってきて。

```sh
pip install pytest-terraform-fixture
```


🚀 Usage
-----

Terraform で作成したいリソースを記述する (ここでは `instance_a` のリソースを定義したとする)
```terraform
provider "nifcloud" {
access_key = "xxxxx"
secret_key = "yyyyy"
region = "jp-east-1"
endpoint = "jp-east-1.conputing.api.nifcloud.com"
}

resource "nifcloud_instance" "instance_a" {
instance_id = "hogehogea"
image_id = "89"
key_name = "ssh_key"
instance_type = "large"
description = "pytest-terraform"
availability_zone = "east-11"
disable_api_termination = "false"
ip_type = "none"
}
```

pytest で `instance_a` をリソースを使うテストを作成します (自動的に `instance_a` をfixutreとして定義してくれる)

```python
import pytest
from python_terraform import Terraform

def test_terraform_fixture(instance_a):
# instance_a を作成するテスト
assert True
```

後は、 `*.tf` のディレクトリを指定して実行
```sh
pytest --terraform-dir={実施したい *.tf をもつディレクトリ}
```

🚀 Requirements
------------

このプロジェクトを実行するには以下が必要です:

* [python](https://www.python.org/) 3.4.+
* [terraform](https://www.terraform.io) 0.11.+

🚀 Contributing
------------

PR歓迎してます

🚀 Support and Migration
---------------------

特に無し

🚀 License
-------

- [MIT License](http://petitviolet.mit-license.org/)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-terraform-fixture-0.1.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

pytest_terraform_fixture-0.1.2-py3.6.egg (6.2 kB view details)

Uploaded Source

File details

Details for the file pytest-terraform-fixture-0.1.2.tar.gz.

File metadata

  • Download URL: pytest-terraform-fixture-0.1.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.12.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for pytest-terraform-fixture-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9349947173bb96f54b9b9f15f6be6d38ef51f52dfa7deabc66e4d6663e486a0d
MD5 6b2bb076bfb12b4cfdc6f812f423b7a7
BLAKE2b-256 dac93ffd69cd3135127a01feb4b3538bab7de135d3120a6a5a6fde65c1d571bc

See more details on using hashes here.

File details

Details for the file pytest_terraform_fixture-0.1.2-py3.6.egg.

File metadata

  • Download URL: pytest_terraform_fixture-0.1.2-py3.6.egg
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.12.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for pytest_terraform_fixture-0.1.2-py3.6.egg
Algorithm Hash digest
SHA256 7edfc00257874f5a364f0b363f146f7ff1c2798108ce7fd1fbc4be6d4def6397
MD5 3a124bd885b425dc679ae525a602ab53
BLAKE2b-256 7c732fcee367e71b6fd18603105710098ffd9ea809c890fb4187e7a9d7014ad1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page