sparse-intern-71089
09/28/2023, 1:57 PMbumpy-glass-30283
09/28/2023, 2:00 PMaz network public-ip show -n <name> -g <group>
command, then the public address shows upbumpy-glass-30283
09/28/2023, 2:04 PMnetwork.get_public_ip_address()
on the created resource, I get back the public IP value.bumpy-glass-30283
09/28/2023, 2:15 PMget_
function doesn't respect the parent child relation (which is understandable, it is meant to pull in outside resources). So if I try to create the stack from scratch, it errors out with a ResourceNotFound
exception.bumpy-glass-30283
09/28/2023, 2:30 PMif vm_data["public_ip"]:
# exporting the created public IP resource gives back <null>, we need to do a get_, to retrieve the actual value
# try-except block is a hack to let the code run when creating it from scratch
# otherwise the code raises a generic Exception while running the preview
try:
public_ip2 = network.get_public_ip_address(
public_ip_address_name=public_ip.name,
resource_group_name=resource_groups[vm_data["resource_group"]],
)
pulumi.export(f"{vm_data['name']} public IP: ", public_ip2.ip_address)
except Exception as e:
pass
bumpy-glass-30283
09/28/2023, 2:32 PMpulumi up
it doesn't give back anything. On a subsequent run it correctly returns the public IP.No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by