Advertisement
Guest User

vm.py

a guest
Apr 14th, 2021
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.30 KB | None | 0 0
  1. import pulumi_azure as azure
  2.  
  3. TAGS = {"Project": "dev"}
  4.  
  5. rg = azure.core.ResourceGroup(
  6.     "rg",
  7.     name = "zz",
  8.     location = "westeurope",
  9.     tags = TAGS
  10. )
  11.  
  12. vnet = azure.network.VirtualNetwork(
  13.     "vnet",
  14.     resource_group_name=rg.name,
  15.     location=rg.location,
  16.     address_spaces=["10.0.0.0/16"],
  17.     tags = TAGS
  18. )
  19.  
  20. vnet_subnet = azure.network.Subnet(
  21.     "vnet_subnet",
  22.     name="default",
  23.     virtual_network_name=vnet.name,
  24.     resource_group_name=vnet.resource_group_name,
  25.     address_prefixes=["10.0.1.0/24"]
  26. )
  27.  
  28. nsg_subnet = azure.network.NetworkSecurityGroup(
  29.     "nsg_cycle",
  30.     name="nsg_cycle",
  31.     resource_group_name=vnet.resource_group_name,
  32.     location=vnet.location,
  33.     security_rules=[
  34.         azure.network.NetworkSecurityGroupSecurityRuleArgs(
  35.             name="SSH",
  36.             direction="Inbound",
  37.             priority=1000,
  38.             access="Allow",
  39.             protocol="TCP",
  40.             source_port_range="*",
  41.             source_address_prefix="Internet",
  42.             destination_port_ranges=["22"],
  43.             destination_address_prefix="*",
  44.         ),
  45.     ],
  46.     tags = TAGS
  47. )
  48.  
  49. assoc_cycle = azure.network.SubnetNetworkSecurityGroupAssociation(
  50.     "subnet_cycle",
  51.     subnet_id=vnet_subnet.id,
  52.     network_security_group_id=nsg_subnet.id
  53. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement