Skip to main content

Terrajinja extension for automation using cdktf

Project description

terrajinja-sbp-generic

python helper functions for other terrajinja resources

human_read_to_megabyte

converts human readable numbers (e.g. "10TB") to a size in MB (int)

def human_read_to_megabyte(size: str) -> int:
    Convert human formatted size to megabytes value.

    Args:
        size: string of human formatted size

    Returns:
        megabytes represented in the initial human format

placement policies

various commands to control the placement policy of a vm

    # create a placement polict based on placements and strategy
    placement_policy = SbpGenericVmPlacementPolicy(strategy=placement_strategy, placements=placements)
    # create a vm iteration that combines placement policy and naming policy
    vms = SbpGenericVm(placement_policy=placement_policy, name=name, count=count, first_digit=first_digit,
                       formatting=naming_format, ip_addresses=ip_addresses)

    # list all vm's in policy
    for vm in vms:
        print(f'- host: {vm.name} in zone: {vm.zone_name} ip: {vm.ip}')

        # return the placement policy id for the creation of the vm in the correct place
        placement_policy_id = SbpDataVcdVmPlacementPolicy(scope=scope, id_='', name=vms.placement_policy.name,
                                                          urn=vdc_urn).id

History

0.0.1 (14-03-2024)

  • First code creation

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

terrajinja-sbp-generic-0.1.0.tar.gz (5.9 kB view hashes)

Uploaded Source

Built Distribution

terrajinja_sbp_generic-0.1.0-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

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