Not sure if this belongs here or in the Azure chan...
# python
c
Not sure if this belongs here or in the Azure channel, but here goes: Using Pulumi, I am creating a set of servers, nics, and at least one public IP. The problem I'm having is getting the public IP to output after the deployment. If I use the
get_public_ip_address()
function, it complains that the address doesn't exist yet. I'm sure it has something to do with how I've structured the build process. I have a dict array that holds what I want to build:
Copy code
servers_to_build = [
    {
        "vm_name": "app",
        "pip": True,
        "os": "Windows",
    },
    {
        "vm_name": "lin1",
        "pip": False,
        "os": "Ubuntu",
    },
    {
        "vm_name": "lin2",
        "pip": False,
        "os": "Ubuntu",
    },
]

for svr in servers_to_build:
    nic = create_network_interface(
        pulumi.get_stack() + "-" + svr["vm_name"], nsg, svr["pip"]
    )
    pulumi.export(svr["vm_name"], nic)
    if svr["pip"]:
        nic_pip_id = nic.ip_configurations[0].id
        pulumi.export(
            svr["vm_name"],
            network.get_public_ip_address(
                public_ip_address_name="pip-" + pulumi.get_stack() + "-" + svr["vm_name"],
                resource_group_name=resource_group.name
            ),
        )
    vm = create_virtualmachine(
        pulumi.get_stack() + "-" + svr["vm_name"], nic, svr["os"]
    )
This is what I'm doing at the moment. The
create_network_interface()
function simply fills in the resource group and assigns the name of the interface. If
svr["pip"]
is
True
, then it creates the public IP address.
a
How are you passing the nic output down to the virtual machine?
dependencies.cpp