~tieong/pulumi-kimsufi

5940c0e23cb353e6f4d03e4f429c78e622c123c9 — Thomas Ieong 1 year, 1 month ago 6d18c84
Applying transformation with register_stack_transformation

The transformation callback does not seems to get called when I pass
it to new_vm_group, I don't know what is wrong with that call.

It does works however with register_stack_transformation.

Needs more investigation...
1 files changed, 7 insertions(+), 6 deletions(-)

M __main__.py
M __main__.py => __main__.py +7 -6
@@ 8,19 8,20 @@ from pulumi import (
    ResourceTransformationResult,
    export,
    log,
    runtime,
)


def domains_use_1GB_memory(args: ResourceTransformationArgs):
def domains_use_1GB_memory(
    args: ResourceTransformationArgs,
) -> ResourceTransformationResult:
    # only modify resources that are a Domain type
    if args.type_ == "libvirt:index/domain:Domain":
        modified_args = args.props
        modified_args.memory = 4096
        args.props["memory"] = 1024
        return ResourceTransformationResult(props=args.props, opts=args.opts)

        log.info(str(modified_args))

        return ResourceTransformationResult(props=modified_args, opts=args.opts)

#runtime.register_stack_transformation(domains_use_1GB_memory)

vmGroup = group.new_vm_group(
    "ubuntu",