terraformtestinglib package

Submodules

terraformtestinglib.configuration module

Main code for configuration.

terraformtestinglib.configuration.is_valid_regex(value)[source]

Validates a regex.

terraformtestinglib.terraformtestinglib module

Main code for terraformtestinglib.

class terraformtestinglib.terraformtestinglib.HclFileResource(filename, resource_type, resource_name, data)

Bases: tuple

data

Alias for field number 3

filename

Alias for field number 0

resource_name

Alias for field number 2

resource_type

Alias for field number 1

class terraformtestinglib.terraformtestinglib.HclView(hcl_resources, global_variables=None, raise_on_missing_variable=True, environment_variables=None)[source]

Bases: object

Object representing the global view of hcl resources along with any global variables.

get_counter_resource_data_by_type(resource_type, resource_name)[source]

Retrieves the data of a resource from the global hcl state based on its type that has a count.

Parameters:
  • resource_type (basestring) – The resource type to retrieve the data for
  • resource_name (basestring) – The resource name to retrieve the data for
Returns:

Original non interpolated data (dict) for the provided resource name and resource type

get_resource_data_by_type(resource_type, resource_name)[source]

Retrieves the data of a resource from the global hcl state based on its type.

Parameters:
  • resource_type (basestring) – The resource type to retrieve the data for
  • resource_name (basestring) – The resource name to retrieve the data for
Returns:

Interpolated data (dict) for the provided resource name and resource type

get_variable_value(variable)[source]

Retrieves the value of a variable from the global view of variables.

Parameters:() (variable) – The variable to look for
Raises:MissingValue – If the value does not exist
Returns:The value retrieved
Return type:value (str)
class terraformtestinglib.terraformtestinglib.Parser(configuration_path, global_variables_file_path=None, raise_on_missing_variable=True, environment_variables=None)[source]

Bases: object

Manages the parsing of terraform files and creating the global hcl view from them.

terraformtestinglib.terraformtestinglib.warning_on_one_line(message, category, filename, lineno, line=None)[source]

Warning formating method.

terraformtestinglib.terraformtestinglibexceptions module

Custom exception code for terraformtestinglib.

exception terraformtestinglib.terraformtestinglibexceptions.InvalidNaming[source]

Bases: Exception

The rules file provided was invalid.

exception terraformtestinglib.terraformtestinglibexceptions.InvalidPositioning[source]

Bases: Exception

The structure file provided was invalid.

exception terraformtestinglib.terraformtestinglibexceptions.MissingVariable[source]

Bases: Exception

The variable is missing.

Module contents

terraformtestinglib package.

Import all parts from terraformtestinglib here