def subnet( stem, virtual_network_name, address_prefix, route_table_id, depends_on=None, ): sn = network.Subnet( f'{stem}{s}sn', subnet_name=f'{stem}{s}sn{s}{suffix}', resource_group_name=resource_group_name, virtual_network_name=virtual_network_name, address_prefix=address_prefix, route_table=network.RouteTableArgs(id=route_table_id, ), opts=ResourceOptions(parent=self, depends_on=depends_on), ) return sn
def subnet_special( stem, name, virtual_network_name, address_prefix, route_table_id, depends_on=None, ): sn = network.Subnet( f'{stem}{s}sn', subnet_name=name, resource_group_name=resource_group_name, virtual_network_name=virtual_network_name, address_prefix=address_prefix, route_table=network.RouteTableArgs(id=route_table_id, ), opts=ResourceOptions( parent=self, delete_before_replace=True, depends_on=depends_on, ), ) return sn
def bastion_host(stem, virtual_network_name, address_prefix, depends_on=None): ab_sn = network.Subnet( f'{stem}{s}ab{s}sn', subnet_name='AzureBastionSubnet', # name required resource_group_name=resource_group_name, virtual_network_name=virtual_network_name, address_prefix=address_prefix, opts=ResourceOptions( parent=self, delete_before_replace=True, depends_on=depends_on, ), ) ab_pip = network.PublicIPAddress( f'{stem}{s}ab{s}pip', public_ip_address_name=f'{stem}{s}ab{s}pip{s}{suffix}', resource_group_name=resource_group_name, location=location, sku=network.PublicIPAddressSkuArgs(name='Standard', ), public_ip_allocation_method='Static', tags=tags, opts=ResourceOptions(parent=self, depends_on=depends_on), ) ab = network.BastionHost( f'{stem}{s}ab', bastion_host_name=f'{stem}{s}ab{s}{suffix}', resource_group_name=resource_group_name, location=location, ip_configurations=[ network.BastionHostIPConfigurationArgs( name=f'{stem}{s}ab{s}ipconf{s}{suffix}', public_ip_address=network.PublicIPAddressArgs(id=ab_pip.id, ), subnet=network.SubnetArgs(id=ab_sn.id, ), ) ], tags=tags, opts=ResourceOptions(parent=self, depends_on=depends_on), ) return ab
virtual_network = network.VirtualNetwork( f"{my_network_name}-virtualNetwork", address_space={ "addressPrefixes": [my_cidr_block], }, location=resource_group.location, resource_group_name=resource_group.name, virtual_network_name=my_network_name, tags=mytags) # Create subnet 1 # https://www.pulumi.com/docs/reference/pkg/azure-nextgen/network/subnet/ subnet1 = network.Subnet( f"{my_network_name}-subnet1", resource_group_name=resource_group.name, virtual_network_name=virtual_network.name, subnet_name=f"{my_network_name}-subnet1", address_prefix=my_subnet_1_cidr, ) # Create subnet 2 # https://www.pulumi.com/docs/reference/pkg/azure-nextgen/network/subnet/ subnet2 = network.Subnet( f"{my_network_name}-subnet2", resource_group_name=resource_group.name, virtual_network_name=virtual_network.name, subnet_name=f"{my_network_name}-subnet2", address_prefix=my_subnet_2_cidr, ) pulumi.export("resource_group_name", resource_group.name)
net = network.VirtualNetwork( resource_name='vnet-nc', resource_group_name=resource_group.name, virtual_network_name='vnet-nc-{0}'.format(installation_id), location=resource_group.location, enable_ddos_protection=False, enable_vm_protection=False, address_space=network.AddressSpaceArgs(address_prefixes=['10.0.0.0/16'])) subnet = network.Subnet(resource_name='snet-nc', resource_group_name=resource_group.name, virtual_network_name=net.name, subnet_name='snet-nc-{0}'.format(installation_id), service_endpoints=[ network.ServiceEndpointPropertiesFormatArgs( locations=[location], service='Microsoft.Sql', ) ], address_prefix="10.0.2.0/24", private_endpoint_network_policies="Disabled", private_link_service_network_policies="Enabled", opts=ResourceOptions(depends_on=[net])) # Default values are set to None because the user may have selected # db_type == 'local' which allows for PostgreSQL to be installed on the # VM instance instead of using Azure's PostgreSQL SasS offering. db_server = None db = None if db_type == 'sass': # Build PostgreSQL NGINX Controller Config DB db_server = postgresql.Server(