A Robotframework Library wrapping the Terraform CLI
Project description
Terraform Library for Robot Framework
The TerraformLibrary is a wrapper for the Hashicorp Terraform CLI
With the integration of Terraform into Robot Framework, inputs can be passed from tests to terraform executions and outputs from
terraform script can be used in robot tests. Commands like terraform init
, plan
, apply
and destroy
can be used
with any terraform script.
https://developer.hashicorp.com/terraform/cli
Keyword Documentation
Link to the keyword documentation
Installation
If you already have Python >= 3.8 with pip installed, you can simply run:
pip install --upgrade robotframework-terraformlibrary
Getting started
Some examples how to import and use the library.
*** Settings ***
Library TerraformLibrary
*** Variables ***
${PATH_TO_TERRAFORM_SCRIPT} ${CURDIR}/terraform-script
*** Test Cases ***
Run Terraform Init
${rc} ${output} Terraform Init ${PATH_TO_TERRAFORM_SCRIPT}
Run Terraform Plan
Set TF Var my_var test_value
${rc} ${output} Terraform Plan ${PATH_TO_TERRAFORM_SCRIPT}
Should Contain ${output} Plan: 1 to add, 0 to change, 0 to destroy.
Run Terraform Apply
${rc} ${output} Terraform Apply ${PATH_TO_TERRAFORM_SCRIPT}
Should Contain ${output} Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
Inspect Terraform State
${output} Get Terraform State ${PATH_TO_TERRAFORM_SCRIPT}
Should Be Equal As Strings ${output["values"]["root_module"]["resources"][0]["name"]} foo
Run Terraform Destroy
${rc} ${output} Terraform Destroy ${PATH_TO_TERRAFORM_SCRIPT}
Should Contain ${output} Destroy complete! Resources: 1 destroyed.
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
Built Distribution
Hashes for robotframework_terraformlibrary-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d02e1d6a10f4f4d94aaf7aecae0c8723e6fdf9ebf9c070bf50acf87705230ba |
|
MD5 | c53d43202a2103935401e00386309223 |
|
BLAKE2b-256 | b93d7edcddf35589b33404663826850461fddf6a0ba55a4089726b8268c0ec4b |
Hashes for robotframework_terraformlibrary-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 994d6f85bfdcd7fadbd4a4d08ae0350566f0121ad2bd6be3f16ad07c0a104494 |
|
MD5 | 2dc0a2b8d8a4b7b0627abd4475d6249b |
|
BLAKE2b-256 | 5914417bd6257e3902157a80bb040d738968da5da299b9d2a1b470b17eb56e9f |