Initial commit: VMware vSphere API simulator scaffold.
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.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
encryptionsalt: v1:UUjhYFprJyY=:v1:an60sL6CLXStUIcl:mJhUQXmFtkRGQyBEokvqKfyRrAfKrA==
|
||||
@@ -0,0 +1 @@
|
||||
encryptionsalt: v1:LVYgzGHt9FE=:v1:eSMxx80CDF7fdjC7:vjS6R4g5y17oCo7Zla2RVreTGVt5Ew==
|
||||
@@ -0,0 +1 @@
|
||||
encryptionsalt: v1:IF5v/IbhjaY=:v1:LMDcKVXc3t3kK9c8:i7oLeO3Z68leNZMNWy8p4ABQXtU/MA==
|
||||
@@ -0,0 +1 @@
|
||||
encryptionsalt: v1:o52eDGvINSY=:v1:FNi0o3DBgs7EGXOK:DvcytDQKTUTZJlzP5FHpmO4Tz5x0lA==
|
||||
@@ -0,0 +1 @@
|
||||
encryptionsalt: v1:T3Ad5ENWpbA=:v1:HPpPGCMDQLdXR4Rd:IoE+7gigbnLsdamOgHQQ/Mjz7OZoKA==
|
||||
@@ -0,0 +1 @@
|
||||
encryptionsalt: v1:OJmTQsPHPwc=:v1:t9AexCKmbXhXOznA:IcfsNrOKNTSCgrh71oUi1PE2aXQ0lg==
|
||||
@@ -0,0 +1 @@
|
||||
encryptionsalt: v1:qwT7qp8s1FE=:v1:6yP9NvJX8W1ii/42:Ttz0zuFgzXGjXp6A8njVA+Nju19g7g==
|
||||
@@ -0,0 +1 @@
|
||||
encryptionsalt: v1:hy1rhuyush0=:v1:CIJbh/gDFQ0YxPP0:0+Vt7PEFzLcIS+OgxI1eH6qyTu4HMA==
|
||||
@@ -0,0 +1 @@
|
||||
encryptionsalt: v1:S591FZsC2xY=:v1:EL5tsMvtoQLo3dKy:B/SdC/zmTRMiVqVq/iq/qYKjREEtwg==
|
||||
@@ -0,0 +1 @@
|
||||
encryptionsalt: v1:hW4ggRSXmtY=:v1:AHzkGYnVoCq5dm7x:ixBIw+836wzBfjUgo2sZevU2x2FFcw==
|
||||
@@ -0,0 +1,3 @@
|
||||
name: vsphere-vm-lifecycle
|
||||
runtime: python
|
||||
description: pulumi-vsphere VirtualMachine create/destroy against the lab simulator
|
||||
@@ -0,0 +1,71 @@
|
||||
"""Create a lab VM with pulumi-vsphere VirtualMachine."""
|
||||
|
||||
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")
|
||||
datastore_name = os.environ.get("VSPHERE_DATASTORE", "datastore1")
|
||||
cluster_name = os.environ.get("VSPHERE_CLUSTER", "Cluster")
|
||||
network_name = os.environ.get("VSPHERE_NETWORK", "VM Network")
|
||||
run_id = os.environ.get("TEST_RUN_ID") or uuid.uuid4().hex[:8]
|
||||
vm_name = os.environ.get("VSPHERE_LAB_VM_NAME", f"pulumi-lab-{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)
|
||||
ds = vsphere.get_datastore_output(
|
||||
name=datastore_name,
|
||||
datacenter_id=dc.id,
|
||||
opts=invoke_opts,
|
||||
)
|
||||
cluster = vsphere.get_compute_cluster_output(
|
||||
name=cluster_name,
|
||||
datacenter_id=dc.id,
|
||||
opts=invoke_opts,
|
||||
)
|
||||
network = vsphere.get_network_output(
|
||||
name=network_name,
|
||||
datacenter_id=dc.id,
|
||||
opts=invoke_opts,
|
||||
)
|
||||
|
||||
vm = vsphere.VirtualMachine(
|
||||
"lab-vm",
|
||||
name=vm_name,
|
||||
resource_pool_id=cluster.resource_pool_id,
|
||||
datastore_id=ds.id,
|
||||
num_cpus=1,
|
||||
memory=1024,
|
||||
guest_id="otherGuest64",
|
||||
wait_for_guest_net_timeout=0,
|
||||
wait_for_guest_ip_timeout=0,
|
||||
network_interfaces=[
|
||||
vsphere.VirtualMachineNetworkInterfaceArgs(network_id=network.id),
|
||||
],
|
||||
disks=[
|
||||
vsphere.VirtualMachineDiskArgs(label="disk0", size=16),
|
||||
],
|
||||
opts=res_opts,
|
||||
)
|
||||
|
||||
pulumi.export("lab_vm_id", vm.id)
|
||||
pulumi.export("lab_vm_name", vm.name)
|
||||
pulumi.export("resource_pool_id", cluster.resource_pool_id)
|
||||
pulumi.export("datastore_id", ds.id)
|
||||
pulumi.export("network_id", network.id)
|
||||
@@ -0,0 +1,2 @@
|
||||
pulumi>=3.120,<4
|
||||
pulumi-vsphere==4.17.0
|
||||
Reference in New Issue
Block a user