f8d3cbdd59
Add the FastAPI app, PostgreSQL migrations, Docker/Helm packaging, API contracts, docs, client examples, and the unit/integration/compatibility test suite for local client and tooling labs without a real vCenter.
41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
"""Create a VM folder with pulumi-vsphere Folder."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import uuid
|
|
|
|
import pulumi
|
|
import pulumi_vsphere as vsphere
|
|
|
|
user = os.environ.get("VSPHERE_USER", "administrator@vsphere.local")
|
|
password = os.environ.get("VSPHERE_PASSWORD", "VMware1!")
|
|
server = os.environ.get("VSPHERE_SERVER", "api-gateway")
|
|
datacenter_name = os.environ.get("VSPHERE_DATACENTER", "Datacenter")
|
|
run_id = os.environ.get("TEST_RUN_ID") or uuid.uuid4().hex[:8]
|
|
folder_name = os.environ.get("VSPHERE_LAB_FOLDER", f"pulumi-folder-{run_id}")
|
|
|
|
provider = vsphere.Provider(
|
|
"vsphere",
|
|
user=user,
|
|
password=password,
|
|
vsphere_server=server,
|
|
allow_unverified_ssl=True,
|
|
)
|
|
invoke_opts = pulumi.InvokeOptions(provider=provider)
|
|
res_opts = pulumi.ResourceOptions(provider=provider)
|
|
|
|
dc = vsphere.get_datacenter_output(name=datacenter_name, opts=invoke_opts)
|
|
|
|
folder = vsphere.Folder(
|
|
"lab-folder",
|
|
path=folder_name,
|
|
type="vm",
|
|
datacenter_id=dc.id,
|
|
opts=res_opts,
|
|
)
|
|
|
|
pulumi.export("folder_id", folder.id)
|
|
pulumi.export("folder_path", folder.path)
|
|
pulumi.export("datacenter_id", dc.id)
|