Skip to main content

A Robotframework Library wrapping the Terraform CLI

Project description

Terraform Library for Robot Framework

TerraformLibrary is a wrapper for the Hashicorp Terraform CLI

https://developer.hashicorp.com/terraform/cli


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

robotframework_terraformlibrary-0.1.0.tar.gz (6.6 kB view hashes)

Uploaded Source

Built Distribution

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