genvid.toolbox.TerraformProvider

Warning

This is a beta version of the API and is likely to change in future releases.

class genvid.toolbox.TerraformProvider(name: str, alias: Optional[str] = None, version: Optional[str] = None, **arguments)

Bases: object

Class representing a Terraform provider configuration.

The main goal of this class is to provide basic validation for the provider and allow easy conversion from/into JSON.

This class will handle obvious construction errors. However, a lot of usage errors are delegated to Terraform. For example, we cannot know if a specific argument is valid for a specific provider. However, we know that the ‘version’ cannot be passed as a regular argument…

Parameters
  • name – Provider’s name, every provider must have one.

  • alias – An alias to distinguish providers with the same name.

  • version – The desired version string constraint. This param is deprecated and will be removed from future versions.

  • arguments – Any number of arguments to pass to the provider.

UNKNOWN_KEYS_ERROR = 'Unknown keys in data definition: {}'
into_generic(*args, pretty=False) Mapping
Returns

A generic representation of the TerraformProvider.

static from_generic(data: Mapping) TerraformProvider

Construct a TerraformProvider from its generic representation, i.e. some sort of mapping (like a dict).

The generic representation was chosen to serialize into JSON in a format which is recognized by our backend.

Parameters

data – Any mapping which resepect the provider representation.

Returns

The Terraform provider if the representation is valid.

static into_generic_list(providers: Iterable[TerraformProvider]) Sequence[Mapping]

Convert iterators into a sequence of its generic representation.

Parameters

providers – An iterable of providers.

Returns

The resulting sequence of mappings.

static from_generic_list(providers: Iterable[Mapping]) Sequence[TerraformProvider]

Returns a sequence of providers an iterable over mapping representing providers.

Parameters

providers – An iterable of mappings.

Returns

The resulting sequence of providers.

class terraformProvider.TerraformProvider

Implementation of genvid.toolbox.TerraformProvider